Bug 1292323 - Update WrapForJNI usages; r=snorp

Replace old flags in WrapForJNI usages with new flags. The calledFrom
and dispatchTo flags are set based on whether the method is native or
non-native, and how the method is used.

Also fix testEventDipatcher to respect NativeJSObject's calledFrom =
"gekco" flag, by moving a test to Gecko thread.
This commit is contained in:
Jim Chen
2016-08-12 23:15:52 -04:00
parent d88b6c6fe2
commit 7db9a1b7e6
38 changed files with 283 additions and 272 deletions

View File

@@ -113,7 +113,7 @@ public class DownloadsIntegration implements NativeEventListener
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT == state); PackageManager.COMPONENT_ENABLED_STATE_DEFAULT == state);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static String getTemporaryDownloadDirectory() { public static String getTemporaryDownloadDirectory() {
Context context = GeckoAppShell.getApplicationContext(); Context context = GeckoAppShell.getApplicationContext();
@@ -132,7 +132,7 @@ public class DownloadsIntegration implements NativeEventListener
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void scanMedia(final String aFile, String aMimeType) { public static void scanMedia(final String aFile, String aMimeType) {
String mimeType = aMimeType; String mimeType = aMimeType;
if (UNKNOWN_MIME_TYPES.contains(mimeType)) { if (UNKNOWN_MIME_TYPES.contains(mimeType)) {

View File

@@ -29,15 +29,15 @@ import android.util.Log;
public class Telemetry { public class Telemetry {
private static final String LOGTAG = "Telemetry"; private static final String LOGTAG = "Telemetry";
@WrapForJNI(stubName = "AddHistogram") @WrapForJNI(stubName = "AddHistogram", dispatchTo = "gecko")
private static native void nativeAddHistogram(String name, int value); private static native void nativeAddHistogram(String name, int value);
@WrapForJNI(stubName = "AddKeyedHistogram") @WrapForJNI(stubName = "AddKeyedHistogram", dispatchTo = "gecko")
private static native void nativeAddKeyedHistogram(String name, String key, int value); private static native void nativeAddKeyedHistogram(String name, String key, int value);
@WrapForJNI(stubName = "StartUISession") @WrapForJNI(stubName = "StartUISession", dispatchTo = "gecko")
private static native void nativeStartUiSession(String name, long timestamp); private static native void nativeStartUiSession(String name, long timestamp);
@WrapForJNI(stubName = "StopUISession") @WrapForJNI(stubName = "StopUISession", dispatchTo = "gecko")
private static native void nativeStopUiSession(String name, String reason, long timestamp); private static native void nativeStopUiSession(String name, String reason, long timestamp);
@WrapForJNI(stubName = "AddUIEvent") @WrapForJNI(stubName = "AddUIEvent", dispatchTo = "gecko")
private static native void nativeAddUiEvent(String action, String method, private static native void nativeAddUiEvent(String action, String method,
long timestamp, String extras); long timestamp, String extras);

View File

@@ -157,11 +157,11 @@ public final class ThumbnailHelper {
requestThumbnail(mBuffer, tab.getId(), mWidth, mHeight); requestThumbnail(mBuffer, tab.getId(), mWidth, mHeight);
} }
@WrapForJNI @WrapForJNI(dispatchTo = "proxy")
private static native void requestThumbnail(ByteBuffer data, int tabId, int width, int height); private static native void requestThumbnail(ByteBuffer data, int tabId, int width, int height);
/* This method is invoked by JNI once the thumbnail data is ready. */ /* This method is invoked by JNI once the thumbnail data is ready. */
@WrapForJNI(stubName = "SendThumbnail") @WrapForJNI(stubName = "SendThumbnail", calledFrom = "gecko")
public static void notifyThumbnail(ByteBuffer data, int tabId, boolean success, boolean shouldStore) { public static void notifyThumbnail(ByteBuffer data, int tabId, boolean success, boolean shouldStore) {
Tab tab = Tabs.getInstance().getTab(tabId); Tab tab = Tabs.getInstance().getTab(tabId);
ThumbnailHelper helper = ThumbnailHelper.getInstance(); ThumbnailHelper helper = ThumbnailHelper.getInstance();

View File

@@ -779,7 +779,7 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
return ((System.nanoTime() - lastStartTimeReRender) < MINIMUM_DELAY_BETWEEN_TWO_RENDER_CALLS_NS); return ((System.nanoTime() - lastStartTimeReRender) < MINIMUM_DELAY_BETWEEN_TWO_RENDER_CALLS_NS);
} }
@WrapForJNI @WrapForJNI(dispatchTo = "gecko")
private static native void requestZoomedViewData(ByteBuffer buffer, int tabId, private static native void requestZoomedViewData(ByteBuffer buffer, int tabId,
int xPos, int yPos, int width, int xPos, int yPos, int width,
int height, float scale); int height, float scale);

View File

@@ -867,7 +867,7 @@ public class Distribution {
return context.getApplicationInfo().dataDir; return context.getApplicationInfo().dataDir;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static String[] getDistributionDirectories() { public static String[] getDistributionDirectories() {
final Context context = GeckoAppShell.getApplicationContext(); final Context context = GeckoAppShell.getApplicationContext();

View File

@@ -24,7 +24,7 @@ public class AudioFocusAgent {
private String mAudioFocusState = LOST_FOCUS; private String mAudioFocusState = LOST_FOCUS;
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void notifyStartedPlaying() { public static void notifyStartedPlaying() {
if (!isAttachedToContext()) { if (!isAttachedToContext()) {
return; return;
@@ -33,7 +33,7 @@ public class AudioFocusAgent {
AudioFocusAgent.getInstance().requestAudioFocusIfNeeded(); AudioFocusAgent.getInstance().requestAudioFocusIfNeeded();
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void notifyStoppedPlaying() { public static void notifyStoppedPlaying() {
if (!isAttachedToContext()) { if (!isAttachedToContext()) {
return; return;
@@ -133,4 +133,4 @@ public class AudioFocusAgent {
intent.setAction(action); intent.setAction(action);
mContext.startService(intent); mContext.startService(intent);
} }
} }

View File

@@ -37,6 +37,6 @@ public class AlarmReceiver extends BroadcastReceiver {
timer.schedule(releaseLockTask, 5 * 1000); timer.schedule(releaseLockTask, 5 * 1000);
} }
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifyAlarmFired(); private static native void notifyAlarmFired();
} }

View File

@@ -129,11 +129,11 @@ public class AndroidGamepadManager {
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void onGamepadChange(int id, boolean added); private static native void onGamepadChange(int id, boolean added);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void onButtonChange(int id, int button, boolean pressed, float value); private static native void onButtonChange(int id, int button, boolean pressed, float value);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void onAxisChange(int id, boolean[] valid, float[] values); private static native void onAxisChange(int id, boolean[] valid, float[] values);
private static boolean sStarted; private static boolean sStarted;
@@ -145,7 +145,7 @@ public class AndroidGamepadManager {
private AndroidGamepadManager() { private AndroidGamepadManager() {
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
private static void start() { private static void start() {
ThreadUtils.postToUiThread(new Runnable() { ThreadUtils.postToUiThread(new Runnable() {
@Override @Override
@@ -164,7 +164,7 @@ public class AndroidGamepadManager {
} }
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
private static void stop() { private static void stop() {
ThreadUtils.postToUiThread(new Runnable() { ThreadUtils.postToUiThread(new Runnable() {
@Override @Override
@@ -184,7 +184,7 @@ public class AndroidGamepadManager {
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
private static void onGamepadAdded(final int device_id, final int service_id) { private static void onGamepadAdded(final int device_id, final int service_id) {
ThreadUtils.postToUiThread(new Runnable() { ThreadUtils.postToUiThread(new Runnable() {
@Override @Override

View File

@@ -243,7 +243,7 @@ public class GeckoAppShell
private static native void reportJavaCrash(String stackTrace); private static native void reportJavaCrash(String stackTrace);
@WrapForJNI @WrapForJNI(dispatchTo = "gecko")
public static native void notifyUriVisited(String uri); public static native void notifyUriVisited(String uri);
public static native void notifyBatteryChange(double aLevel, boolean aCharging, double aRemainingTime); public static native void notifyBatteryChange(double aLevel, boolean aCharging, double aRemainingTime);
@@ -336,10 +336,10 @@ public class GeckoAppShell
public static native void notifyGeckoOfEvent(GeckoEvent event); public static native void notifyGeckoOfEvent(GeckoEvent event);
// Synchronously notify a Gecko observer; must be called from Gecko thread. // Synchronously notify a Gecko observer; must be called from Gecko thread.
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static native void syncNotifyObservers(String topic, String data); public static native void syncNotifyObservers(String topic, String data);
@WrapForJNI(stubName = "NotifyObservers") @WrapForJNI(stubName = "NotifyObservers", dispatchTo = "gecko")
private static native void nativeNotifyObservers(String topic, String data); private static native void nativeNotifyObservers(String topic, String data);
@RobocopTarget @RobocopTarget
@@ -361,7 +361,7 @@ public class GeckoAppShell
* The Gecko-side API: API methods that Gecko calls * The Gecko-side API: API methods that Gecko calls
*/ */
@WrapForJNI(allowMultithread = true, noThrow = true) @WrapForJNI(exceptionMode = "ignore")
public static String handleUncaughtException(Throwable e) { public static String handleUncaughtException(Throwable e) {
if (AppConstants.MOZ_CRASHREPORTER) { if (AppConstants.MOZ_CRASHREPORTER) {
final Throwable exc = CrashHandler.getRootException(e); final Throwable exc = CrashHandler.getRootException(e);
@@ -391,7 +391,7 @@ public class GeckoAppShell
private static native long runUiThreadCallback(); private static native long runUiThreadCallback();
@WrapForJNI(allowMultithread = true) @WrapForJNI
private static void requestUiThreadCallback(long delay) { private static void requestUiThreadCallback(long delay) {
ThreadUtils.getUiHandler().postDelayed(sCallbackRunnable, delay); ThreadUtils.getUiHandler().postDelayed(sCallbackRunnable, delay);
} }
@@ -428,7 +428,7 @@ public class GeckoAppShell
return lastKnownLocation; return lastKnownLocation;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
@SuppressLint("MissingPermission") // Permissions are explicitly checked for within this method @SuppressLint("MissingPermission") // Permissions are explicitly checked for within this method
public static void enableLocation(final boolean enable) { public static void enableLocation(final boolean enable) {
final Runnable requestLocation = new Runnable() { final Runnable requestLocation = new Runnable() {
@@ -493,12 +493,12 @@ public class GeckoAppShell
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void enableLocationHighAccuracy(final boolean enable) { public static void enableLocationHighAccuracy(final boolean enable) {
locationHighAccuracyEnabled = enable; locationHighAccuracyEnabled = enable;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static boolean setAlarm(int aSeconds, int aNanoSeconds) { public static boolean setAlarm(int aSeconds, int aNanoSeconds) {
AlarmManager am = (AlarmManager) AlarmManager am = (AlarmManager)
getApplicationContext().getSystemService(Context.ALARM_SERVICE); getApplicationContext().getSystemService(Context.ALARM_SERVICE);
@@ -514,7 +514,7 @@ public class GeckoAppShell
return true; return true;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void disableAlarm() { public static void disableAlarm() {
AlarmManager am = (AlarmManager) AlarmManager am = (AlarmManager)
getApplicationContext().getSystemService(Context.ALARM_SERVICE); getApplicationContext().getSystemService(Context.ALARM_SERVICE);
@@ -526,11 +526,11 @@ public class GeckoAppShell
am.cancel(pi); am.cancel(pi);
} }
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
/* package */ static native void onSensorChanged(int hal_type, float x, float y, float z, /* package */ static native void onSensorChanged(int hal_type, float x, float y, float z,
float w, int accuracy, long time); float w, int accuracy, long time);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
/* package */ static native void onLocationChanged(double latitude, double longitude, /* package */ static native void onLocationChanged(double latitude, double longitude,
double altitude, float accuracy, double altitude, float accuracy,
float bearing, float speed, long time); float bearing, float speed, long time);
@@ -667,7 +667,7 @@ public class GeckoAppShell
sLocationListener = listener; sLocationListener = listener;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void enableSensor(int aSensortype) { public static void enableSensor(int aSensortype) {
GeckoInterface gi = getGeckoInterface(); GeckoInterface gi = getGeckoInterface();
if (gi == null) { if (gi == null) {
@@ -783,7 +783,7 @@ public class GeckoAppShell
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void disableSensor(int aSensortype) { public static void disableSensor(int aSensortype) {
GeckoInterface gi = getGeckoInterface(); GeckoInterface gi = getGeckoInterface();
if (gi == null) if (gi == null)
@@ -847,20 +847,20 @@ public class GeckoAppShell
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void moveTaskToBack() { public static void moveTaskToBack() {
if (getGeckoInterface() != null) if (getGeckoInterface() != null)
getGeckoInterface().getActivity().moveTaskToBack(true); getGeckoInterface().getActivity().moveTaskToBack(true);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void scheduleRestart() { public static void scheduleRestart() {
getGeckoInterface().doRestart(); getGeckoInterface().doRestart();
} }
// Creates a homescreen shortcut for a web page. // Creates a homescreen shortcut for a web page.
// This is the entry point from nsIShellService. // This is the entry point from nsIShellService.
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void createShortcut(final String aTitle, final String aURI) { public static void createShortcut(final String aTitle, final String aURI) {
final GeckoInterface geckoInterface = getGeckoInterface(); final GeckoInterface geckoInterface = getGeckoInterface();
if (geckoInterface == null) { if (geckoInterface == null) {
@@ -888,7 +888,7 @@ public class GeckoAppShell
} }
} }
@WrapForJNI(stubName = "GetHandlersForMimeTypeWrapper") @WrapForJNI(calledFrom = "gecko")
static String[] getHandlersForMimeType(String aMimeType, String aAction) { static String[] getHandlersForMimeType(String aMimeType, String aAction) {
final GeckoInterface geckoInterface = getGeckoInterface(); final GeckoInterface geckoInterface = getGeckoInterface();
if (geckoInterface == null) { if (geckoInterface == null) {
@@ -897,7 +897,7 @@ public class GeckoAppShell
return geckoInterface.getHandlersForMimeType(aMimeType, aAction); return geckoInterface.getHandlersForMimeType(aMimeType, aAction);
} }
@WrapForJNI(stubName = "GetHandlersForURLWrapper") @WrapForJNI(calledFrom = "gecko")
static String[] getHandlersForURL(String aURL, String aAction) { static String[] getHandlersForURL(String aURL, String aAction) {
final GeckoInterface geckoInterface = getGeckoInterface(); final GeckoInterface geckoInterface = getGeckoInterface();
if (geckoInterface == null) { if (geckoInterface == null) {
@@ -906,12 +906,12 @@ public class GeckoAppShell
return geckoInterface.getHandlersForURL(aURL, aAction); return geckoInterface.getHandlersForURL(aURL, aAction);
} }
@WrapForJNI(stubName = "GetHWEncoderCapability") @WrapForJNI(calledFrom = "gecko")
static boolean getHWEncoderCapability() { static boolean getHWEncoderCapability() {
return HardwareCodecCapabilityUtils.getHWEncoderCapability(); return HardwareCodecCapabilityUtils.getHWEncoderCapability();
} }
@WrapForJNI(stubName = "GetHWDecoderCapability") @WrapForJNI(calledFrom = "gecko")
static boolean getHWDecoderCapability() { static boolean getHWDecoderCapability() {
return HardwareCodecCapabilityUtils.getHWDecoderCapability(); return HardwareCodecCapabilityUtils.getHWDecoderCapability();
} }
@@ -931,12 +931,12 @@ public class GeckoAppShell
return list; return list;
} }
@WrapForJNI(stubName = "GetExtensionFromMimeTypeWrapper") @WrapForJNI(calledFrom = "gecko")
static String getExtensionFromMimeType(String aMimeType) { static String getExtensionFromMimeType(String aMimeType) {
return MimeTypeMap.getSingleton().getExtensionFromMimeType(aMimeType); return MimeTypeMap.getSingleton().getExtensionFromMimeType(aMimeType);
} }
@WrapForJNI(stubName = "GetMimeTypeFromExtensionsWrapper") @WrapForJNI(calledFrom = "gecko")
static String getMimeTypeFromExtensions(String aFileExt) { static String getMimeTypeFromExtensions(String aFileExt) {
StringTokenizer st = new StringTokenizer(aFileExt, ".,; "); StringTokenizer st = new StringTokenizer(aFileExt, ".,; ");
String type = null; String type = null;
@@ -975,7 +975,7 @@ public class GeckoAppShell
return true; return true;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static boolean openUriExternal(String targetURI, public static boolean openUriExternal(String targetURI,
String mimeType, String mimeType,
String packageName, String packageName,
@@ -1015,10 +1015,10 @@ public class GeckoAppShell
PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent.FLAG_UPDATE_CURRENT);
} }
@WrapForJNI @WrapForJNI(dispatchTo = "gecko")
private static native void notifyAlertListener(String name, String topic); private static native void notifyAlertListener(String name, String topic);
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void showAlertNotification(String imageUrl, String alertTitle, String alertText, public static void showAlertNotification(String imageUrl, String alertTitle, String alertText,
String alertCookie, String alertName, String host, String alertCookie, String alertName, String host,
String persistentData) { String persistentData) {
@@ -1059,7 +1059,7 @@ public class GeckoAppShell
alertText, clickIntent, closeIntent); alertText, clickIntent, closeIntent);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void closeNotification(String alertName) { public static void closeNotification(String alertName) {
notifyAlertListener(alertName, "alertfinished"); notifyAlertListener(alertName, "alertfinished");
@@ -1082,7 +1082,7 @@ public class GeckoAppShell
closeNotification(alertName); closeNotification(alertName);
} }
@WrapForJNI(stubName = "GetDpiWrapper") @WrapForJNI(calledFrom = "gecko")
public static int getDpi() { public static int getDpi() {
if (sDensityDpi == 0) { if (sDensityDpi == 0) {
sDensityDpi = getApplicationContext().getResources().getDisplayMetrics().densityDpi; sDensityDpi = getApplicationContext().getResources().getDisplayMetrics().densityDpi;
@@ -1091,7 +1091,7 @@ public class GeckoAppShell
return sDensityDpi; return sDensityDpi;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static float getDensity() { public static float getDensity() {
return getApplicationContext().getResources().getDisplayMetrics().density; return getApplicationContext().getResources().getDisplayMetrics().density;
} }
@@ -1104,7 +1104,7 @@ public class GeckoAppShell
* Returns the colour depth of the default screen. This will either be * Returns the colour depth of the default screen. This will either be
* 24 or 16. * 24 or 16.
*/ */
@WrapForJNI(stubName = "GetScreenDepthWrapper") @WrapForJNI(calledFrom = "gecko")
public static synchronized int getScreenDepth() { public static synchronized int getScreenDepth() {
if (sScreenDepth == 0) { if (sScreenDepth == 0) {
sScreenDepth = 16; sScreenDepth = 16;
@@ -1120,7 +1120,7 @@ public class GeckoAppShell
return sScreenDepth; return sScreenDepth;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static synchronized void setScreenDepthOverride(int aScreenDepth) { public static synchronized void setScreenDepthOverride(int aScreenDepth) {
if (sScreenDepth != 0) { if (sScreenDepth != 0) {
Log.e(LOGTAG, "Tried to override screen depth after it's already been set"); Log.e(LOGTAG, "Tried to override screen depth after it's already been set");
@@ -1130,13 +1130,13 @@ public class GeckoAppShell
sScreenDepth = aScreenDepth; sScreenDepth = aScreenDepth;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void setFullScreen(boolean fullscreen) { public static void setFullScreen(boolean fullscreen) {
if (getGeckoInterface() != null) if (getGeckoInterface() != null)
getGeckoInterface().setFullScreen(fullscreen); getGeckoInterface().setFullScreen(fullscreen);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void performHapticFeedback(boolean aIsLongPress) { public static void performHapticFeedback(boolean aIsLongPress) {
// Don't perform haptic feedback if a vibration is currently playing, // Don't perform haptic feedback if a vibration is currently playing,
// because the haptic feedback will nuke the vibration. // because the haptic feedback will nuke the vibration.
@@ -1169,14 +1169,14 @@ public class GeckoAppShell
} }
} }
@WrapForJNI(stubName = "Vibrate1") @WrapForJNI(calledFrom = "gecko")
public static void vibrate(long milliseconds) { public static void vibrate(long milliseconds) {
sVibrationEndTime = System.nanoTime() + milliseconds * 1000000; sVibrationEndTime = System.nanoTime() + milliseconds * 1000000;
sVibrationMaybePlaying = true; sVibrationMaybePlaying = true;
vibrator().vibrate(milliseconds); vibrator().vibrate(milliseconds);
} }
@WrapForJNI(stubName = "VibrateA") @WrapForJNI(calledFrom = "gecko")
public static void vibrate(long[] pattern, int repeat) { public static void vibrate(long[] pattern, int repeat) {
// If pattern.length is even, the last element in the pattern is a // If pattern.length is even, the last element in the pattern is a
// meaningless delay, so don't include it in vibrationDuration. // meaningless delay, so don't include it in vibrationDuration.
@@ -1191,14 +1191,14 @@ public class GeckoAppShell
vibrator().vibrate(pattern, repeat); vibrator().vibrate(pattern, repeat);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void cancelVibrate() { public static void cancelVibrate() {
sVibrationMaybePlaying = false; sVibrationMaybePlaying = false;
sVibrationEndTime = 0; sVibrationEndTime = 0;
vibrator().cancel(); vibrator().cancel();
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void setKeepScreenOn(final boolean on) { public static void setKeepScreenOn(final boolean on) {
ThreadUtils.postToUiThread(new Runnable() { ThreadUtils.postToUiThread(new Runnable() {
@Override @Override
@@ -1208,7 +1208,7 @@ public class GeckoAppShell
}); });
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void notifyDefaultPrevented(final boolean defaultPrevented) { public static void notifyDefaultPrevented(final boolean defaultPrevented) {
ThreadUtils.postToUiThread(new Runnable() { ThreadUtils.postToUiThread(new Runnable() {
@Override @Override
@@ -1222,7 +1222,7 @@ public class GeckoAppShell
}); });
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static boolean isNetworkLinkUp() { public static boolean isNetworkLinkUp() {
ConnectivityManager cm = (ConnectivityManager) ConnectivityManager cm = (ConnectivityManager)
getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
@@ -1236,7 +1236,7 @@ public class GeckoAppShell
return true; return true;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static boolean isNetworkLinkKnown() { public static boolean isNetworkLinkKnown() {
ConnectivityManager cm = (ConnectivityManager) ConnectivityManager cm = (ConnectivityManager)
getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
@@ -1249,8 +1249,8 @@ public class GeckoAppShell
return true; return true;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static int networkLinkType() { public static int getNetworkLinkType() {
ConnectivityManager cm = (ConnectivityManager) ConnectivityManager cm = (ConnectivityManager)
getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo(); NetworkInfo info = cm.getActiveNetworkInfo();
@@ -1308,7 +1308,7 @@ public class GeckoAppShell
} }
} }
@WrapForJNI(stubName = "GetSystemColoursWrapper") @WrapForJNI(calledFrom = "gecko")
public static int[] getSystemColors() { public static int[] getSystemColors() {
// attrsAppearance[] must correspond to AndroidSystemColors structure in android/AndroidBridge.h // attrsAppearance[] must correspond to AndroidSystemColors structure in android/AndroidBridge.h
final int[] attrsAppearance = { final int[] attrsAppearance = {
@@ -1345,7 +1345,7 @@ public class GeckoAppShell
return result; return result;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void killAnyZombies() { public static void killAnyZombies() {
GeckoProcessesVisitor visitor = new GeckoProcessesVisitor() { GeckoProcessesVisitor visitor = new GeckoProcessesVisitor() {
@Override @Override
@@ -1475,7 +1475,7 @@ public class GeckoAppShell
} catch (Exception e) { } } catch (Exception e) { }
} }
@WrapForJNI(stubName = "GetIconForExtensionWrapper") @WrapForJNI(calledFrom = "gecko")
public static byte[] getIconForExtension(String aExt, int iconSize) { public static byte[] getIconForExtension(String aExt, int iconSize) {
try { try {
if (iconSize <= 0) if (iconSize <= 0)
@@ -1533,7 +1533,7 @@ public class GeckoAppShell
return activityInfo.loadIcon(pm); return activityInfo.loadIcon(pm);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static boolean getShowPasswordSetting() { public static boolean getShowPasswordSetting() {
try { try {
int showPassword = int showPassword =
@@ -1546,7 +1546,7 @@ public class GeckoAppShell
} }
} }
@WrapForJNI(stubName = "AddPluginViewWrapper") @WrapForJNI(calledFrom = "gecko")
public static void addPluginView(View view, public static void addPluginView(View view,
float x, float y, float x, float y,
float w, float h, float w, float h,
@@ -1555,7 +1555,7 @@ public class GeckoAppShell
getGeckoInterface().addPluginView(view, new RectF(x, y, x + w, y + h), isFullScreen); getGeckoInterface().addPluginView(view, new RectF(x, y, x + w, y + h), isFullScreen);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void removePluginView(View view, boolean isFullScreen) { public static void removePluginView(View view, boolean isFullScreen) {
if (getGeckoInterface() != null) if (getGeckoInterface() != null)
getGeckoInterface().removePluginView(view, isFullScreen); getGeckoInterface().removePluginView(view, isFullScreen);
@@ -1767,7 +1767,7 @@ public class GeckoAppShell
return pluginCL.loadClass(className); return pluginCL.loadClass(className);
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
public static Class<?> loadPluginClass(String className, String libName) { public static Class<?> loadPluginClass(String className, String libName) {
if (getGeckoInterface() == null) if (getGeckoInterface() == null)
return null; return null;
@@ -1790,7 +1790,7 @@ public class GeckoAppShell
private static ContextGetter sContextGetter; private static ContextGetter sContextGetter;
@Deprecated @Deprecated
@WrapForJNI(allowMultithread = true) @WrapForJNI
public static Context getContext() { public static Context getContext() {
return sContextGetter.getContext(); return sContextGetter.getContext();
} }
@@ -1799,7 +1799,7 @@ public class GeckoAppShell
sContextGetter = cg; sContextGetter = cg;
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
public static Context getApplicationContext() { public static Context getApplicationContext() {
return sApplicationContext; return sApplicationContext;
} }
@@ -1920,7 +1920,7 @@ public class GeckoAppShell
static byte[] sCameraBuffer; static byte[] sCameraBuffer;
@WrapForJNI(stubName = "InitCameraWrapper") @WrapForJNI(calledFrom = "gecko")
static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) { static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) {
ThreadUtils.postToUiThread(new Runnable() { ThreadUtils.postToUiThread(new Runnable() {
@Override @Override
@@ -2014,7 +2014,7 @@ public class GeckoAppShell
return result; return result;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
static synchronized void closeCamera() { static synchronized void closeCamera() {
ThreadUtils.postToUiThread(new Runnable() { ThreadUtils.postToUiThread(new Runnable() {
@Override @Override
@@ -2036,28 +2036,28 @@ public class GeckoAppShell
/* /*
* Battery API related methods. * Battery API related methods.
*/ */
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void enableBatteryNotifications() { public static void enableBatteryNotifications() {
GeckoBatteryManager.enableNotifications(); GeckoBatteryManager.enableNotifications();
} }
@WrapForJNI(stubName = "HandleGeckoMessageWrapper") @WrapForJNI(calledFrom = "gecko")
public static void handleGeckoMessage(final NativeJSContainer message) { public static void handleGeckoMessage(final NativeJSContainer message) {
EventDispatcher.getInstance().dispatchEvent(message); EventDispatcher.getInstance().dispatchEvent(message);
message.disposeNative(); message.disposeNative();
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void disableBatteryNotifications() { public static void disableBatteryNotifications() {
GeckoBatteryManager.disableNotifications(); GeckoBatteryManager.disableNotifications();
} }
@WrapForJNI(stubName = "GetCurrentBatteryInformationWrapper") @WrapForJNI(calledFrom = "gecko")
public static double[] getCurrentBatteryInformation() { public static double[] getCurrentBatteryInformation() {
return GeckoBatteryManager.getCurrentInformation(); return GeckoBatteryManager.getCurrentInformation();
} }
@WrapForJNI(stubName = "CheckURIVisited") @WrapForJNI(stubName = "CheckURIVisited", calledFrom = "gecko")
static void checkUriVisited(String uri) { static void checkUriVisited(String uri) {
final GeckoInterface geckoInterface = getGeckoInterface(); final GeckoInterface geckoInterface = getGeckoInterface();
if (geckoInterface == null) { if (geckoInterface == null) {
@@ -2066,7 +2066,7 @@ public class GeckoAppShell
geckoInterface.checkUriVisited(uri); geckoInterface.checkUriVisited(uri);
} }
@WrapForJNI(stubName = "MarkURIVisited") @WrapForJNI(stubName = "MarkURIVisited", calledFrom = "gecko")
static void markUriVisited(final String uri) { static void markUriVisited(final String uri) {
final GeckoInterface geckoInterface = getGeckoInterface(); final GeckoInterface geckoInterface = getGeckoInterface();
if (geckoInterface == null) { if (geckoInterface == null) {
@@ -2075,7 +2075,7 @@ public class GeckoAppShell
geckoInterface.markUriVisited(uri); geckoInterface.markUriVisited(uri);
} }
@WrapForJNI(stubName = "SetURITitle") @WrapForJNI(stubName = "SetURITitle", calledFrom = "gecko")
static void setUriTitle(final String uri, final String title) { static void setUriTitle(final String uri, final String title) {
final GeckoInterface geckoInterface = getGeckoInterface(); final GeckoInterface geckoInterface = getGeckoInterface();
if (geckoInterface == null) { if (geckoInterface == null) {
@@ -2084,7 +2084,7 @@ public class GeckoAppShell
geckoInterface.setUriTitle(uri, title); geckoInterface.setUriTitle(uri, title);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
static void hideProgressDialog() { static void hideProgressDialog() {
// unused stub // unused stub
} }
@@ -2100,12 +2100,12 @@ public class GeckoAppShell
SmsManager.getInstance().send(aNumber, aMessage, aRequestId, aShouldNotify); SmsManager.getInstance().send(aNumber, aMessage, aRequestId, aShouldNotify);
} }
@WrapForJNI(stubName = "SendMessageWrapper") @WrapForJNI(calledFrom = "gecko")
public static void sendMessage(String aNumber, String aMessage, int aRequestId) { public static void sendMessage(String aNumber, String aMessage, int aRequestId) {
sendMessage(aNumber, aMessage, aRequestId, /* shouldNotify */ true); sendMessage(aNumber, aMessage, aRequestId, /* shouldNotify */ true);
} }
@WrapForJNI(stubName = "GetMessageWrapper") @WrapForJNI(calledFrom = "gecko")
public static void getMessage(int aMessageId, int aRequestId) { public static void getMessage(int aMessageId, int aRequestId) {
if (!SmsManager.isEnabled()) { if (!SmsManager.isEnabled()) {
return; return;
@@ -2114,7 +2114,7 @@ public class GeckoAppShell
SmsManager.getInstance().getMessage(aMessageId, aRequestId); SmsManager.getInstance().getMessage(aMessageId, aRequestId);
} }
@WrapForJNI(stubName = "DeleteMessageWrapper") @WrapForJNI(calledFrom = "gecko")
public static void deleteMessage(int aMessageId, int aRequestId) { public static void deleteMessage(int aMessageId, int aRequestId) {
if (!SmsManager.isEnabled()) { if (!SmsManager.isEnabled()) {
return; return;
@@ -2123,7 +2123,7 @@ public class GeckoAppShell
SmsManager.getInstance().deleteMessage(aMessageId, aRequestId); SmsManager.getInstance().deleteMessage(aMessageId, aRequestId);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void markMessageRead(int aMessageId, boolean aValue, boolean aSendReadReport, int aRequestId) { public static void markMessageRead(int aMessageId, boolean aValue, boolean aSendReadReport, int aRequestId) {
if (!SmsManager.isEnabled()) { if (!SmsManager.isEnabled()) {
return; return;
@@ -2132,7 +2132,7 @@ public class GeckoAppShell
SmsManager.getInstance().markMessageRead(aMessageId, aValue, aSendReadReport, aRequestId); SmsManager.getInstance().markMessageRead(aMessageId, aValue, aSendReadReport, aRequestId);
} }
@WrapForJNI(stubName = "CreateMessageCursorWrapper") @WrapForJNI(calledFrom = "gecko")
public static void createMessageCursor(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, boolean aHasThreadId, long aThreadId, boolean aReverse, int aRequestId) { public static void createMessageCursor(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, boolean aHasThreadId, long aThreadId, boolean aReverse, int aRequestId) {
if (!SmsManager.isEnabled()) { if (!SmsManager.isEnabled()) {
return; return;
@@ -2141,7 +2141,7 @@ public class GeckoAppShell
SmsManager.getInstance().createMessageCursor(aStartDate, aEndDate, aNumbers, aNumbersCount, aDelivery, aHasRead, aRead, aHasThreadId, aThreadId, aReverse, aRequestId); SmsManager.getInstance().createMessageCursor(aStartDate, aEndDate, aNumbers, aNumbersCount, aDelivery, aHasRead, aRead, aHasThreadId, aThreadId, aReverse, aRequestId);
} }
@WrapForJNI(stubName = "GetNextMessageWrapper") @WrapForJNI(calledFrom = "gecko")
public static void getNextMessage(int aRequestId) { public static void getNextMessage(int aRequestId) {
if (!SmsManager.isEnabled()) { if (!SmsManager.isEnabled()) {
return; return;
@@ -2150,7 +2150,7 @@ public class GeckoAppShell
SmsManager.getInstance().getNextMessage(aRequestId); SmsManager.getInstance().getNextMessage(aRequestId);
} }
@WrapForJNI(stubName = "CreateThreadCursorWrapper") @WrapForJNI(calledFrom = "gecko")
public static void createThreadCursor(int aRequestId) { public static void createThreadCursor(int aRequestId) {
Log.i("GeckoAppShell", "CreateThreadCursorWrapper!"); Log.i("GeckoAppShell", "CreateThreadCursorWrapper!");
@@ -2161,7 +2161,7 @@ public class GeckoAppShell
SmsManager.getInstance().createThreadCursor(aRequestId); SmsManager.getInstance().createThreadCursor(aRequestId);
} }
@WrapForJNI(stubName = "GetNextThreadWrapper") @WrapForJNI(calledFrom = "gecko")
public static void getNextThread(int aRequestId) { public static void getNextThread(int aRequestId) {
if (!SmsManager.isEnabled()) { if (!SmsManager.isEnabled()) {
return; return;
@@ -2171,7 +2171,7 @@ public class GeckoAppShell
} }
/* Called by JNI from AndroidBridge, and by reflection from tests/BaseTest.java.in */ /* Called by JNI from AndroidBridge, and by reflection from tests/BaseTest.java.in */
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
@RobocopTarget @RobocopTarget
public static boolean isTablet() { public static boolean isTablet() {
return HardwareUtils.isTablet(); return HardwareUtils.isTablet();
@@ -2192,12 +2192,12 @@ public class GeckoAppShell
sImeWasEnabledOnLastResize = imeIsEnabled; sImeWasEnabledOnLastResize = imeIsEnabled;
} }
@WrapForJNI(stubName = "GetCurrentNetworkInformationWrapper") @WrapForJNI(calledFrom = "gecko")
public static double[] getCurrentNetworkInformation() { public static double[] getCurrentNetworkInformation() {
return GeckoNetworkManager.getInstance().getCurrentInformation(); return GeckoNetworkManager.getInstance().getCurrentInformation();
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void enableNetworkNotifications() { public static void enableNetworkNotifications() {
ThreadUtils.postToUiThread(new Runnable() { ThreadUtils.postToUiThread(new Runnable() {
@Override @Override
@@ -2207,7 +2207,7 @@ public class GeckoAppShell
}); });
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void disableNetworkNotifications() { public static void disableNetworkNotifications() {
ThreadUtils.postToUiThread(new Runnable() { ThreadUtils.postToUiThread(new Runnable() {
@Override @Override
@@ -2217,43 +2217,43 @@ public class GeckoAppShell
}); });
} }
@WrapForJNI(stubName = "GetScreenOrientationWrapper") @WrapForJNI(calledFrom = "gecko")
public static short getScreenOrientation() { public static short getScreenOrientation() {
return GeckoScreenOrientation.getInstance().getScreenOrientation().value; return GeckoScreenOrientation.getInstance().getScreenOrientation().value;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static int getScreenAngle() { public static int getScreenAngle() {
return GeckoScreenOrientation.getInstance().getAngle(); return GeckoScreenOrientation.getInstance().getAngle();
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void enableScreenOrientationNotifications() { public static void enableScreenOrientationNotifications() {
GeckoScreenOrientation.getInstance().enableNotifications(); GeckoScreenOrientation.getInstance().enableNotifications();
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void disableScreenOrientationNotifications() { public static void disableScreenOrientationNotifications() {
GeckoScreenOrientation.getInstance().disableNotifications(); GeckoScreenOrientation.getInstance().disableNotifications();
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void lockScreenOrientation(int aOrientation) { public static void lockScreenOrientation(int aOrientation) {
GeckoScreenOrientation.getInstance().lock(aOrientation); GeckoScreenOrientation.getInstance().lock(aOrientation);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void unlockScreenOrientation() { public static void unlockScreenOrientation() {
GeckoScreenOrientation.getInstance().unlock(); GeckoScreenOrientation.getInstance().unlock();
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void notifyWakeLockChanged(String topic, String state) { public static void notifyWakeLockChanged(String topic, String state) {
if (getGeckoInterface() != null) if (getGeckoInterface() != null)
getGeckoInterface().notifyWakeLockChanged(topic, state); getGeckoInterface().notifyWakeLockChanged(topic, state);
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
public static void registerSurfaceTextureFrameListener(Object surfaceTexture, final int id) { public static void registerSurfaceTextureFrameListener(Object surfaceTexture, final int id) {
((SurfaceTexture)surfaceTexture).setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() { ((SurfaceTexture)surfaceTexture).setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() {
@Override @Override
@@ -2263,12 +2263,12 @@ public class GeckoAppShell
}); });
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
public static void unregisterSurfaceTextureFrameListener(Object surfaceTexture) { public static void unregisterSurfaceTextureFrameListener(Object surfaceTexture) {
((SurfaceTexture)surfaceTexture).setOnFrameAvailableListener(null); ((SurfaceTexture)surfaceTexture).setOnFrameAvailableListener(null);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static boolean unlockProfile() { public static boolean unlockProfile() {
// Try to kill any zombie Fennec's that might be running // Try to kill any zombie Fennec's that might be running
GeckoAppShell.killAnyZombies(); GeckoAppShell.killAnyZombies();
@@ -2282,7 +2282,7 @@ public class GeckoAppShell
return false; return false;
} }
@WrapForJNI(stubName = "GetProxyForURIWrapper") @WrapForJNI(calledFrom = "gecko")
public static String getProxyForURI(String spec, String scheme, String host, int port) { public static String getProxyForURI(String spec, String scheme, String host, int port) {
final ProxySelector ps = new ProxySelector(); final ProxySelector ps = new ProxySelector();
@@ -2301,7 +2301,7 @@ public class GeckoAppShell
return "DIRECT"; return "DIRECT";
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
static InputStream createInputStream(URLConnection connection) throws IOException { static InputStream createInputStream(URLConnection connection) throws IOException {
return connection.getInputStream(); return connection.getInputStream();
} }
@@ -2355,7 +2355,7 @@ public class GeckoAppShell
} }
} }
@WrapForJNI(allowMultithread = true, narrowChars = true) @WrapForJNI
static URLConnection getConnection(String url) { static URLConnection getConnection(String url) {
try { try {
String spec; String spec;
@@ -2393,7 +2393,7 @@ public class GeckoAppShell
return null; return null;
} }
@WrapForJNI(allowMultithread = true, narrowChars = true) @WrapForJNI
static String connectionGetMimeType(URLConnection connection) { static String connectionGetMimeType(URLConnection connection) {
return connection.getContentType(); return connection.getContentType();
} }
@@ -2404,7 +2404,7 @@ public class GeckoAppShell
* @param type The type of directory to return * @param type The type of directory to return
* @return Absolute path of the specified directory or null on failure * @return Absolute path of the specified directory or null on failure
*/ */
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
static String getExternalPublicDirectory(final String type) { static String getExternalPublicDirectory(final String type) {
final String state = Environment.getExternalStorageState(); final String state = Environment.getExternalStorageState();
if (!Environment.MEDIA_MOUNTED.equals(state) && if (!Environment.MEDIA_MOUNTED.equals(state) &&
@@ -2436,7 +2436,7 @@ public class GeckoAppShell
return Environment.getExternalStoragePublicDirectory(systemType).getAbsolutePath(); return Environment.getExternalStoragePublicDirectory(systemType).getAbsolutePath();
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
static int getMaxTouchPoints() { static int getMaxTouchPoints() {
PackageManager pm = getApplicationContext().getPackageManager(); PackageManager pm = getApplicationContext().getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND)) { if (pm.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND)) {
@@ -2459,7 +2459,7 @@ public class GeckoAppShell
sScreenSize = null; sScreenSize = null;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static synchronized Rect getScreenSize() { public static synchronized Rect getScreenSize() {
if (sScreenSize == null) { if (sScreenSize == null) {
final WindowManager wm = (WindowManager) final WindowManager wm = (WindowManager)

View File

@@ -94,7 +94,7 @@ final class GeckoEditable extends JNIObject
private static final int IME_RANGE_BACKCOLOR = 4; private static final int IME_RANGE_BACKCOLOR = 4;
private static final int IME_RANGE_LINECOLOR = 8; private static final int IME_RANGE_LINECOLOR = 8;
@WrapForJNI @WrapForJNI(dispatchTo = "proxy")
private native void onKeyEvent(int action, int keyCode, int scanCode, int metaState, private native void onKeyEvent(int action, int keyCode, int scanCode, int metaState,
long time, int unicodeChar, int baseUnicodeChar, long time, int unicodeChar, int baseUnicodeChar,
int domPrintableKeyValue, int repeatCount, int flags, int domPrintableKeyValue, int repeatCount, int flags,
@@ -126,25 +126,25 @@ final class GeckoEditable extends JNIObject
event.getFlags(), isSynthesizedImeKey, event); event.getFlags(), isSynthesizedImeKey, event);
} }
@WrapForJNI @WrapForJNI(dispatchTo = "proxy")
private native void onImeSynchronize(); private native void onImeSynchronize();
@WrapForJNI @WrapForJNI(dispatchTo = "proxy")
private native void onImeAcknowledgeFocus(); private native void onImeAcknowledgeFocus();
@WrapForJNI @WrapForJNI(dispatchTo = "proxy")
private native void onImeReplaceText(int start, int end, String text); private native void onImeReplaceText(int start, int end, String text);
@WrapForJNI @WrapForJNI(dispatchTo = "proxy")
private native void onImeAddCompositionRange(int start, int end, int rangeType, private native void onImeAddCompositionRange(int start, int end, int rangeType,
int rangeStyles, int rangeLineStyle, int rangeStyles, int rangeLineStyle,
boolean rangeBoldLine, int rangeForeColor, boolean rangeBoldLine, int rangeForeColor,
int rangeBackColor, int rangeLineColor); int rangeBackColor, int rangeLineColor);
@WrapForJNI @WrapForJNI(dispatchTo = "proxy")
private native void onImeUpdateComposition(int start, int end); private native void onImeUpdateComposition(int start, int end);
@WrapForJNI @WrapForJNI(dispatchTo = "proxy")
private native void onImeRequestCursorUpdates(int requestMode); private native void onImeRequestCursorUpdates(int requestMode);
/* An action that alters the Editable /* An action that alters the Editable
@@ -394,7 +394,7 @@ final class GeckoEditable extends JNIObject
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
GeckoEditable(final GeckoView v) { GeckoEditable(final GeckoView v) {
if (DEBUG) { if (DEBUG) {
// Called by nsWindow. // Called by nsWindow.
@@ -414,10 +414,10 @@ final class GeckoEditable extends JNIObject
onViewChange(v); onViewChange(v);
} }
@WrapForJNI @Override @WrapForJNI(dispatchTo = "proxy") @Override
protected native void disposeNative(); protected native void disposeNative();
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
/* package */ void onViewChange(final GeckoView v) { /* package */ void onViewChange(final GeckoView v) {
if (DEBUG) { if (DEBUG) {
// Called by nsWindow. // Called by nsWindow.
@@ -875,7 +875,7 @@ final class GeckoEditable extends JNIObject
} }
} }
@WrapForJNI @Override @WrapForJNI(calledFrom = "gecko") @Override
public void notifyIME(final int type) { public void notifyIME(final int type) {
if (DEBUG) { if (DEBUG) {
// GeckoEditableListener methods should all be called from the Gecko thread // GeckoEditableListener methods should all be called from the Gecko thread
@@ -953,7 +953,7 @@ final class GeckoEditable extends JNIObject
} }
} }
@WrapForJNI @Override @WrapForJNI(calledFrom = "gecko") @Override
public void notifyIMEContext(final int state, final String typeHint, public void notifyIMEContext(final int state, final String typeHint,
final String modeHint, final String actionHint) { final String modeHint, final String actionHint) {
if (DEBUG) { if (DEBUG) {
@@ -974,7 +974,7 @@ final class GeckoEditable extends JNIObject
}); });
} }
@WrapForJNI @Override @WrapForJNI(calledFrom = "gecko") @Override
public void onSelectionChange(int start, int end) { public void onSelectionChange(int start, int end) {
if (DEBUG) { if (DEBUG) {
// GeckoEditableListener methods should all be called from the Gecko thread // GeckoEditableListener methods should all be called from the Gecko thread
@@ -1018,7 +1018,7 @@ final class GeckoEditable extends JNIObject
TextUtils.regionMatches(mText, start, newText, 0, oldEnd - start); TextUtils.regionMatches(mText, start, newText, 0, oldEnd - start);
} }
@WrapForJNI @Override @WrapForJNI(calledFrom = "gecko") @Override
public void onTextChange(final CharSequence text, final int start, public void onTextChange(final CharSequence text, final int start,
final int unboundedOldEnd, final int unboundedNewEnd) { final int unboundedOldEnd, final int unboundedNewEnd) {
if (DEBUG) { if (DEBUG) {
@@ -1124,7 +1124,7 @@ final class GeckoEditable extends JNIObject
}); });
} }
@WrapForJNI @Override @WrapForJNI(calledFrom = "gecko") @Override
public void onDefaultKeyEvent(final KeyEvent event) { public void onDefaultKeyEvent(final KeyEvent event) {
if (DEBUG) { if (DEBUG) {
// GeckoEditableListener methods should all be called from the Gecko thread // GeckoEditableListener methods should all be called from the Gecko thread
@@ -1149,7 +1149,7 @@ final class GeckoEditable extends JNIObject
}); });
} }
@WrapForJNI @Override @WrapForJNI(calledFrom = "gecko") @Override
public void updateCompositionRects(final RectF[] aRects) { public void updateCompositionRects(final RectF[] aRects) {
if (DEBUG) { if (DEBUG) {
// GeckoEditableListener methods should all be called from the Gecko thread // GeckoEditableListener methods should all be called from the Gecko thread

View File

@@ -126,7 +126,7 @@ public class GeckoJavaSampler {
} }
@WrapForJNI(allowMultithread = true, stubName = "GetThreadNameJavaProfilingWrapper") @WrapForJNI
public synchronized static String getThreadName(int aThreadId) { public synchronized static String getThreadName(int aThreadId) {
if (aThreadId == 0 && sMainThread != null) { if (aThreadId == 0 && sMainThread != null) {
return sMainThread.getName(); return sMainThread.getName();
@@ -138,7 +138,7 @@ public class GeckoJavaSampler {
return sSamplingRunnable.getSample(aThreadId, aSampleId); return sSamplingRunnable.getSample(aThreadId, aSampleId);
} }
@WrapForJNI(allowMultithread = true, stubName = "GetSampleTimeJavaProfiling") @WrapForJNI
public synchronized static double getSampleTime(int aThreadId, int aSampleId) { public synchronized static double getSampleTime(int aThreadId, int aSampleId) {
Sample sample = getSample(aThreadId, aSampleId); Sample sample = getSample(aThreadId, aSampleId);
if (sample != null) { if (sample != null) {
@@ -152,7 +152,7 @@ public class GeckoJavaSampler {
return 0; return 0;
} }
@WrapForJNI(allowMultithread = true, stubName = "GetFrameNameJavaProfilingWrapper") @WrapForJNI
public synchronized static String getFrameName(int aThreadId, int aSampleId, int aFrameId) { public synchronized static String getFrameName(int aThreadId, int aSampleId, int aFrameId) {
Sample sample = getSample(aThreadId, aSampleId); Sample sample = getSample(aThreadId, aSampleId);
if (sample != null && aFrameId < sample.mFrames.length) { if (sample != null && aFrameId < sample.mFrames.length) {
@@ -165,7 +165,7 @@ public class GeckoJavaSampler {
return null; return null;
} }
@WrapForJNI(allowMultithread = true, stubName = "StartJavaProfiling") @WrapForJNI
public static void start(int aInterval, int aSamples) { public static void start(int aInterval, int aSamples) {
synchronized (GeckoJavaSampler.class) { synchronized (GeckoJavaSampler.class) {
if (sSamplingRunnable != null) { if (sSamplingRunnable != null) {
@@ -177,21 +177,21 @@ public class GeckoJavaSampler {
} }
} }
@WrapForJNI(allowMultithread = true, stubName = "PauseJavaProfiling") @WrapForJNI
public static void pause() { public static void pause() {
synchronized (GeckoJavaSampler.class) { synchronized (GeckoJavaSampler.class) {
sSamplingRunnable.mPauseSampler = true; sSamplingRunnable.mPauseSampler = true;
} }
} }
@WrapForJNI(allowMultithread = true, stubName = "UnpauseJavaProfiling") @WrapForJNI
public static void unpause() { public static void unpause() {
synchronized (GeckoJavaSampler.class) { synchronized (GeckoJavaSampler.class) {
sSamplingRunnable.mPauseSampler = false; sSamplingRunnable.mPauseSampler = false;
} }
} }
@WrapForJNI(allowMultithread = true, stubName = "StopJavaProfiling") @WrapForJNI
public static void stop() { public static void stop() {
synchronized (GeckoJavaSampler.class) { synchronized (GeckoJavaSampler.class) {
if (sSamplingThread == null) { if (sSamplingThread == null) {

View File

@@ -310,11 +310,11 @@ public class GeckoNetworkManager extends BroadcastReceiver implements NativeEven
Log.d(LOGTAG, "New network state: " + currentNetworkStatus + ", " + currentConnectionType + ", " + currentConnectionSubtype); Log.d(LOGTAG, "New network state: " + currentNetworkStatus + ", " + currentConnectionType + ", " + currentConnectionSubtype);
} }
@WrapForJNI @WrapForJNI(dispatchTo = "gecko")
private static native void onConnectionChanged(int type, String subType, private static native void onConnectionChanged(int type, String subType,
boolean isWifi, int DHCPGateway); boolean isWifi, int DHCPGateway);
@WrapForJNI @WrapForJNI(dispatchTo = "gecko")
private static native void onStatusChanged(String status); private static native void onStatusChanged(String status);
/** /**

View File

@@ -132,7 +132,7 @@ public class GeckoScreenOrientation {
return update(getScreenOrientation(aAndroidOrientation, getRotation())); return update(getScreenOrientation(aAndroidOrientation, getRotation()));
} }
@WrapForJNI @WrapForJNI(dispatchTo = "gecko")
private static native void onOrientationChange(short screenOrientation, short angle); private static native void onOrientationChange(short screenOrientation, short angle);
/* /*

View File

@@ -1213,32 +1213,32 @@ public class GeckoSmsManager
private static final long serialVersionUID = 158467542575633280L; private static final long serialVersionUID = 158467542575633280L;
} }
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
public static native void notifySmsReceived(int aId, String aSender, String aBody, int aMessageClass, long aSentTimestamp, long aTimestamp); public static native void notifySmsReceived(int aId, String aSender, String aBody, int aMessageClass, long aSentTimestamp, long aTimestamp);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifySmsSent(int aId, String aReceiver, String aBody, long aTimestamp, int aRequestId); private static native void notifySmsSent(int aId, String aReceiver, String aBody, long aTimestamp, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifySmsDelivery(int aId, int aDeliveryStatus, String aReceiver, String aBody, long aTimestamp); private static native void notifySmsDelivery(int aId, int aDeliveryStatus, String aReceiver, String aBody, long aTimestamp);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifySmsSendFailed(int aError, int aRequestId); private static native void notifySmsSendFailed(int aError, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifyGetSms(int aId, int aDeliveryStatus, String aReceiver, String aSender, String aBody, long aTimestamp, boolean aRead, int aRequestId); private static native void notifyGetSms(int aId, int aDeliveryStatus, String aReceiver, String aSender, String aBody, long aTimestamp, boolean aRead, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifyGetSmsFailed(int aError, int aRequestId); private static native void notifyGetSmsFailed(int aError, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifySmsDeleted(boolean aDeleted, int aRequestId); private static native void notifySmsDeleted(boolean aDeleted, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifySmsDeleteFailed(int aError, int aRequestId); private static native void notifySmsDeleteFailed(int aError, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifySmsMarkedAsRead(boolean aMarkedAsRead, int aRequestId); private static native void notifySmsMarkedAsRead(boolean aMarkedAsRead, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifySmsMarkAsReadFailed(int aError, int aRequestId); private static native void notifySmsMarkAsReadFailed(int aError, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifyCursorError(int aError, int aRequestId); private static native void notifyCursorError(int aError, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifyThreadCursorResult(long aId, String aLastMessageSubject, String aBody, long aUnreadCount, Object[] aParticipants, long aTimestamp, String aLastMessageType, int aRequestId); private static native void notifyThreadCursorResult(long aId, String aLastMessageSubject, String aBody, long aUnreadCount, Object[] aParticipants, long aTimestamp, String aLastMessageType, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifyMessageCursorResult(int aMessageId, int aDeliveryStatus, String aReceiver, String aSender, String aBody, long aTimestamp, long aThreadId, boolean aRead, int aRequestId); private static native void notifyMessageCursorResult(int aMessageId, int aDeliveryStatus, String aReceiver, String aSender, String aBody, long aTimestamp, long aThreadId, boolean aRead, int aRequestId);
@WrapForJNI @WrapForJNI(calledFrom = "ui", dispatchTo = "gecko")
private static native void notifyCursorDone(int aRequestId); private static native void notifyCursorDone(int aRequestId);
} }

View File

@@ -546,7 +546,7 @@ public class GeckoThread extends Thread {
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
private static boolean pumpMessageLoop(final Message msg) { private static boolean pumpMessageLoop(final Message msg) {
final Handler geckoHandler = ThreadUtils.sGeckoHandler; final Handler geckoHandler = ThreadUtils.sGeckoHandler;
@@ -608,7 +608,7 @@ public class GeckoThread extends Thread {
return sState.isBetween(minState, maxState); return sState.isBetween(minState, maxState);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
private static void setState(final State newState) { private static void setState(final State newState) {
ThreadUtils.assertOnGeckoThread(); ThreadUtils.assertOnGeckoThread();
synchronized (QUEUED_CALLS) { synchronized (QUEUED_CALLS) {
@@ -617,7 +617,7 @@ public class GeckoThread extends Thread {
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
private static boolean checkAndSetState(final State currentState, final State newState) { private static boolean checkAndSetState(final State currentState, final State newState) {
synchronized (QUEUED_CALLS) { synchronized (QUEUED_CALLS) {
if (sState == currentState) { if (sState == currentState) {
@@ -644,7 +644,7 @@ public class GeckoThread extends Thread {
@WrapForJNI @RobocopTarget @WrapForJNI @RobocopTarget
public static native void waitOnGecko(); public static native void waitOnGecko();
@WrapForJNI(stubName = "OnPause") @WrapForJNI(stubName = "OnPause", dispatchTo = "gecko")
private static native void nativeOnPause(); private static native void nativeOnPause();
public static void onPause() { public static void onPause() {
@@ -656,7 +656,7 @@ public class GeckoThread extends Thread {
} }
} }
@WrapForJNI(stubName = "OnResume") @WrapForJNI(stubName = "OnResume", dispatchTo = "gecko")
private static native void nativeOnResume(); private static native void nativeOnResume();
public static void onResume() { public static void onResume() {
@@ -668,7 +668,7 @@ public class GeckoThread extends Thread {
} }
} }
@WrapForJNI(stubName = "CreateServices") @WrapForJNI(stubName = "CreateServices", dispatchTo = "gecko")
private static native void nativeCreateServices(String category, String data); private static native void nativeCreateServices(String category, String data);
public static void createServices(final String category, final String data) { public static void createServices(final String category, final String data) {

View File

@@ -106,8 +106,11 @@ public class GeckoView extends LayerView
} }
} }
@WrapForJNI @WrapForJNI(dispatchTo = "proxy")
private static final class Window extends JNIObject { private static final class Window extends JNIObject {
@WrapForJNI(skip = true)
/* package */ Window() {}
static native void open(Window instance, GeckoView view, Compositor compositor, static native void open(Window instance, GeckoView view, Compositor compositor,
String chromeURI, String chromeURI,
int width, int height); int width, int height);

View File

@@ -48,15 +48,15 @@ public final class PrefsHelper {
@WrapForJNI @WrapForJNI
private static final int PREF_STRING = 3; private static final int PREF_STRING = 3;
@WrapForJNI(stubName = "GetPrefs") @WrapForJNI(stubName = "GetPrefs", dispatchTo = "gecko")
private static native void nativeGetPrefs(String[] prefNames, PrefHandler handler); private static native void nativeGetPrefs(String[] prefNames, PrefHandler handler);
@WrapForJNI(stubName = "SetPref") @WrapForJNI(stubName = "SetPref", dispatchTo = "gecko")
private static native void nativeSetPref(String prefName, boolean flush, int type, private static native void nativeSetPref(String prefName, boolean flush, int type,
boolean boolVal, int intVal, String strVal); boolean boolVal, int intVal, String strVal);
@WrapForJNI(stubName = "AddObserver") @WrapForJNI(stubName = "AddObserver", dispatchTo = "gecko")
private static native void nativeAddObserver(String[] prefNames, PrefHandler handler, private static native void nativeAddObserver(String[] prefNames, PrefHandler handler,
String[] prefsToObserve); String[] prefsToObserve);
@WrapForJNI(stubName = "RemoveObserver") @WrapForJNI(stubName = "RemoveObserver", dispatchTo = "gecko")
private static native void nativeRemoveObserver(String[] prefToUnobserve); private static native void nativeRemoveObserver(String[] prefToUnobserve);
@RobocopTarget @RobocopTarget
@@ -208,7 +208,7 @@ public final class PrefsHelper {
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
private static void callPrefHandler(final PrefHandler handler, int type, final String pref, private static void callPrefHandler(final PrefHandler handler, int type, final String pref,
boolean boolVal, int intVal, String strVal) { boolean boolVal, int intVal, String strVal) {
@@ -241,7 +241,7 @@ public final class PrefsHelper {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
private synchronized static void onPrefChange(final String pref, final int type, private synchronized static void onPrefChange(final String pref, final int type,
final boolean boolVal, final int intVal, final boolean boolVal, final int intVal,
final String strVal) { final String strVal) {

View File

@@ -19,16 +19,16 @@ import android.graphics.RectF;
* subsection of that with compositor scaling. * subsection of that with compositor scaling.
*/ */
public final class DisplayPortMetrics { public final class DisplayPortMetrics {
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public final float resolution; public final float resolution;
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
private final RectF mPosition; private final RectF mPosition;
public DisplayPortMetrics() { public DisplayPortMetrics() {
this(0, 0, 0, 0, 1); this(0, 0, 0, 0, 1);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public DisplayPortMetrics(float left, float top, float right, float bottom, float resolution) { public DisplayPortMetrics(float left, float top, float right, float bottom, float resolution) {
this.resolution = resolution; this.resolution = resolution;
mPosition = new RectF(left, top, right, bottom); mPosition = new RectF(left, top, right, bottom);

View File

@@ -156,7 +156,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
} }
/** Attaches to root layer so that Gecko appears. */ /** Attaches to root layer so that Gecko appears. */
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
private void onGeckoReady() { private void onGeckoReady() {
mGeckoIsReady = true; mGeckoIsReady = true;
@@ -427,7 +427,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
return mDisplayPort; return mDisplayPort;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
DisplayPortMetrics getDisplayPort(boolean pageSizeUpdate, boolean isBrowserContentDisplayed, int tabId, ImmutableViewportMetrics metrics) { DisplayPortMetrics getDisplayPort(boolean pageSizeUpdate, boolean isBrowserContentDisplayed, int tabId, ImmutableViewportMetrics metrics) {
Tabs tabs = Tabs.getInstance(); Tabs tabs = Tabs.getInstance();
if (isBrowserContentDisplayed && tabs.isSelectedTabId(tabId)) { if (isBrowserContentDisplayed && tabs.isSelectedTabId(tabId)) {
@@ -444,12 +444,12 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
void contentDocumentChanged() { void contentDocumentChanged() {
mContentDocumentIsDisplayed = false; mContentDocumentIsDisplayed = false;
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
boolean isContentDocumentDisplayed() { boolean isContentDocumentDisplayed() {
return mContentDocumentIsDisplayed; return mContentDocumentIsDisplayed;
} }
@@ -459,7 +459,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
// to abort the current update and continue with any subsequent ones. This // to abort the current update and continue with any subsequent ones. This
// is useful for slow-to-render pages when the display-port starts lagging // is useful for slow-to-render pages when the display-port starts lagging
// behind enough that continuing to draw it is wasted effort. // behind enough that continuing to draw it is wasted effort.
@WrapForJNI(allowMultithread = true) @WrapForJNI
public ProgressiveUpdateData progressiveUpdateCallback(boolean aHasPendingNewThebesContent, public ProgressiveUpdateData progressiveUpdateCallback(boolean aHasPendingNewThebesContent,
float x, float y, float width, float height, float x, float y, float width, float height,
float resolution, boolean lowPrecision) { float resolution, boolean lowPrecision) {
@@ -573,7 +573,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
* viewport information provided. setPageRect will never be invoked on the same frame that * viewport information provided. setPageRect will never be invoked on the same frame that
* this function is invoked on; and this function will always be called prior to syncViewportInfo. * this function is invoked on; and this function will always be called prior to syncViewportInfo.
*/ */
@WrapForJNI(allowMultithread = true) @WrapForJNI
public void setFirstPaintViewport(float offsetX, float offsetY, float zoom, public void setFirstPaintViewport(float offsetX, float offsetY, float zoom,
float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) { float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) {
synchronized (getLock()) { synchronized (getLock()) {
@@ -633,7 +633,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
* is invoked on a frame, then this function will not be. For any given frame, this * is invoked on a frame, then this function will not be. For any given frame, this
* function will be invoked before syncViewportInfo. * function will be invoked before syncViewportInfo.
*/ */
@WrapForJNI(allowMultithread = true) @WrapForJNI
public void setPageRect(float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) { public void setPageRect(float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) {
synchronized (getLock()) { synchronized (getLock()) {
RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom); RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
@@ -654,7 +654,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
* every time we're called. NOTE: we might be able to return a ImmutableViewportMetrics * every time we're called. NOTE: we might be able to return a ImmutableViewportMetrics
* which would avoid the copy into mCurrentViewTransform. * which would avoid the copy into mCurrentViewTransform.
*/ */
@WrapForJNI(allowMultithread = true) @WrapForJNI
public ViewTransform syncViewportInfo(int x, int y, int width, int height, float resolution, boolean layersUpdated, public ViewTransform syncViewportInfo(int x, int y, int width, int height, float resolution, boolean layersUpdated,
int paintSyncId) { int paintSyncId) {
// getViewportMetrics is thread safe so we don't need to synchronize. // getViewportMetrics is thread safe so we don't need to synchronize.
@@ -698,7 +698,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
return mCurrentViewTransform; return mCurrentViewTransform;
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
public ViewTransform syncFrameMetrics(float scrollX, float scrollY, float zoom, public ViewTransform syncFrameMetrics(float scrollX, float scrollY, float zoom,
float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom, float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom,
int dpX, int dpY, int dpWidth, int dpHeight, float paintedResolution, int dpX, int dpY, int dpWidth, int dpHeight, float paintedResolution,
@@ -913,7 +913,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public void synthesizeNativeTouchPoint(int pointerId, int eventType, int screenX, public void synthesizeNativeTouchPoint(int pointerId, int eventType, int screenX,
int screenY, double pressure, int orientation) int screenY, double pressure, int orientation)
{ {
@@ -924,13 +924,13 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
eventType, screenX, screenY, pressure, orientation); eventType, screenX, screenY, pressure, orientation);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public void synthesizeNativeMouseEvent(int eventType, int screenX, int screenY) { public void synthesizeNativeMouseEvent(int eventType, int screenX, int screenY) {
synthesizeNativePointer(InputDevice.SOURCE_MOUSE, PointerInfo.RESERVED_MOUSE_POINTER_ID, synthesizeNativePointer(InputDevice.SOURCE_MOUSE, PointerInfo.RESERVED_MOUSE_POINTER_ID,
eventType, screenX, screenY, 0, 0); eventType, screenX, screenY, 0, 0);
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
public LayerRenderer.Frame createFrame() { public LayerRenderer.Frame createFrame() {
// Create the shaders and textures if necessary. // Create the shaders and textures if necessary.
if (!mLayerRendererInitialized) { if (!mLayerRendererInitialized) {
@@ -949,12 +949,12 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
} }
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
public void activateProgram() { public void activateProgram() {
mLayerRenderer.activateDefaultProgram(); mLayerRenderer.activateDefaultProgram();
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
public void deactivateProgramAndRestoreState(boolean enableScissor, public void deactivateProgramAndRestoreState(boolean enableScissor,
int scissorX, int scissorY, int scissorW, int scissorH) int scissorX, int scissorY, int scissorW, int scissorH)
{ {

View File

@@ -51,7 +51,7 @@ public class ImmutableViewportMetrics {
/** This constructor is used by native code in AndroidJavaWrappers.cpp, be /** This constructor is used by native code in AndroidJavaWrappers.cpp, be
* careful when modifying the signature. * careful when modifying the signature.
*/ */
@WrapForJNI(allowMultithread = true) @WrapForJNI(calledFrom = "gecko")
public ImmutableViewportMetrics(float aPageRectLeft, float aPageRectTop, public ImmutableViewportMetrics(float aPageRectLeft, float aPageRectTop,
float aPageRectRight, float aPageRectBottom, float aCssPageRectLeft, float aPageRectRight, float aPageRectBottom, float aCssPageRectLeft,
float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom, float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,

View File

@@ -441,7 +441,7 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
} }
/** This function is invoked via JNI; be careful when modifying signature. */ /** This function is invoked via JNI; be careful when modifying signature. */
@WrapForJNI(allowMultithread = true) @WrapForJNI
public void beginDrawing() { public void beginDrawing() {
mFrameStartTime = System.nanoTime(); mFrameStartTime = System.nanoTime();
@@ -500,7 +500,7 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
} }
/** This function is invoked via JNI; be careful when modifying signature. */ /** This function is invoked via JNI; be careful when modifying signature. */
@WrapForJNI(allowMultithread = true) @WrapForJNI
public void drawBackground() { public void drawBackground() {
// Any GL state which is changed here must be restored in // Any GL state which is changed here must be restored in
// restoreState(...) // restoreState(...)
@@ -514,7 +514,7 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
clear(mBackgroundColor); clear(mBackgroundColor);
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
public void drawForeground() { public void drawForeground() {
// Any GL state which is changed here must be restored in // Any GL state which is changed here must be restored in
// restoreState(...) // restoreState(...)
@@ -577,7 +577,7 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
} }
/** This function is invoked via JNI; be careful when modifying signature. */ /** This function is invoked via JNI; be careful when modifying signature. */
@WrapForJNI(allowMultithread = true) @WrapForJNI
public void endDrawing() { public void endDrawing() {
// If a layer update requires further work, schedule another redraw // If a layer update requires further work, schedule another redraw
if (!mUpdated) if (!mUpdated)

View File

@@ -81,31 +81,38 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
private volatile boolean mCompositorCreated; private volatile boolean mCompositorCreated;
@WrapForJNI(allowMultithread = true)
protected class Compositor extends JNIObject { protected class Compositor extends JNIObject {
public Compositor() { public Compositor() {
} }
@WrapForJNI(calledFrom = "ui", dispatchTo = "proxy")
@Override protected native void disposeNative(); @Override protected native void disposeNative();
// Gecko thread sets its Java instances; does not block UI thread. // Gecko thread sets its Java instances; does not block UI thread.
@WrapForJNI(calledFrom = "any", dispatchTo = "proxy")
/* package */ native void attachToJava(GeckoLayerClient layerClient, /* package */ native void attachToJava(GeckoLayerClient layerClient,
NativePanZoomController npzc); NativePanZoomController npzc);
@WrapForJNI(calledFrom = "any", dispatchTo = "proxy")
/* package */ native void onSizeChanged(int windowWidth, int windowHeight, /* package */ native void onSizeChanged(int windowWidth, int windowHeight,
int screenWidth, int screenHeight); int screenWidth, int screenHeight);
// Gecko thread creates compositor; blocks UI thread. // Gecko thread creates compositor; blocks UI thread.
@WrapForJNI(calledFrom = "ui", dispatchTo = "proxy")
/* package */ native void createCompositor(int width, int height); /* package */ native void createCompositor(int width, int height);
// Gecko thread pauses compositor; blocks UI thread. // Gecko thread pauses compositor; blocks UI thread.
@WrapForJNI(calledFrom = "ui", dispatchTo = "current")
/* package */ native void syncPauseCompositor(); /* package */ native void syncPauseCompositor();
// UI thread resumes compositor and notifies Gecko thread; does not block UI thread. // UI thread resumes compositor and notifies Gecko thread; does not block UI thread.
@WrapForJNI(calledFrom = "ui", dispatchTo = "proxy")
/* package */ native void syncResumeResizeCompositor(int width, int height); /* package */ native void syncResumeResizeCompositor(int width, int height);
@WrapForJNI(calledFrom = "any", dispatchTo = "current")
/* package */ native void syncInvalidateAndScheduleComposite(); /* package */ native void syncInvalidateAndScheduleComposite();
@WrapForJNI
private synchronized Object getSurface() { private synchronized Object getSurface() {
if (LayerView.this.mServerSurfaceValid) { if (LayerView.this.mServerSurfaceValid) {
return LayerView.this.getSurface(); return LayerView.this.getSurface();
@@ -113,6 +120,7 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
return null; return null;
} }
@WrapForJNI(calledFrom = "gecko")
private void destroy() { private void destroy() {
// The nsWindow has been closed. First mark our compositor as destroyed. // The nsWindow has been closed. First mark our compositor as destroyed.
LayerView.this.mCompositorCreated = false; LayerView.this.mCompositorCreated = false;
@@ -674,9 +682,9 @@ public class LayerView extends ScrollView implements Tabs.OnTabsChangedListener
return null; return null;
} }
//This method is called on the Gecko main thread. // This method is called on the Gecko main thread.
@WrapForJNI(allowMultithread = true) @WrapForJNI(calledFrom = "gecko")
public static void updateZoomedView(ByteBuffer data) { private static void updateZoomedView(ByteBuffer data) {
LayerView layerView = GeckoAppShell.getLayerView(); LayerView layerView = GeckoAppShell.getLayerView();
if (layerView != null) { if (layerView != null) {
LayerRenderer layerRenderer = layerView.getRenderer(); LayerRenderer layerRenderer = layerView.getRenderer();

View File

@@ -34,24 +34,24 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
private long mLastDownTime; private long mLastDownTime;
private static final float MAX_SCROLL = 0.075f * GeckoAppShell.getDpi(); private static final float MAX_SCROLL = 0.075f * GeckoAppShell.getDpi();
@WrapForJNI @WrapForJNI(calledFrom = "ui")
private native boolean handleMotionEvent( private native boolean handleMotionEvent(
int action, int actionIndex, long time, int metaState, int action, int actionIndex, long time, int metaState,
int pointerId[], float x[], float y[], float orientation[], float pressure[], int pointerId[], float x[], float y[], float orientation[], float pressure[],
float toolMajor[], float toolMinor[]); float toolMajor[], float toolMinor[]);
@WrapForJNI @WrapForJNI(calledFrom = "ui")
private native boolean handleScrollEvent( private native boolean handleScrollEvent(
long time, int metaState, long time, int metaState,
float x, float y, float x, float y,
float hScroll, float vScroll); float hScroll, float vScroll);
@WrapForJNI @WrapForJNI(calledFrom = "ui")
private native boolean handleMouseEvent( private native boolean handleMouseEvent(
int action, long time, int metaState, int action, long time, int metaState,
float x, float y, int buttons); float x, float y, int buttons);
@WrapForJNI @WrapForJNI(calledFrom = "ui")
private native void handleMotionEventVelocity(long time, float ySpeed); private native void handleMotionEventVelocity(long time, float ySpeed);
private boolean handleMotionEvent(MotionEvent event) { private boolean handleMotionEvent(MotionEvent event) {
@@ -225,7 +225,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
// we just want to ignore this callback. // we just want to ignore this callback.
} }
@WrapForJNI(stubName = "AbortAnimation") @WrapForJNI(stubName = "AbortAnimation", calledFrom = "ui")
private native void nativeAbortAnimation(); private native void nativeAbortAnimation();
@Override // PanZoomController @Override // PanZoomController
@@ -243,7 +243,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
return true; return true;
} }
@Override @WrapForJNI(allowMultithread = true) // PanZoomController @Override @WrapForJNI(calledFrom = "ui") // PanZoomController
public void destroy() { public void destroy() {
if (mDestroyed || !mTarget.isGeckoReady()) { if (mDestroyed || !mTarget.isGeckoReady()) {
return; return;
@@ -252,7 +252,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
disposeNative(); disposeNative();
} }
@Override @WrapForJNI // JNIObject @Override @WrapForJNI(calledFrom = "ui") // JNIObject
protected native void disposeNative(); protected native void disposeNative();
@Override @Override
@@ -266,7 +266,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
return 0; return 0;
} }
@WrapForJNI(allowMultithread = true, stubName = "RequestContentRepaintWrapper") @WrapForJNI(calledFrom = "ui")
private void requestContentRepaint(float x, float y, float width, float height, float resolution) { private void requestContentRepaint(float x, float y, float width, float height, float resolution) {
mTarget.forceRedraw(new DisplayPortMetrics(x, y, x + width, y + height, resolution)); mTarget.forceRedraw(new DisplayPortMetrics(x, y, x + width, y + height, resolution));
} }
@@ -276,7 +276,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
mOverscroll = handler; mOverscroll = handler;
} }
@WrapForJNI(stubName = "SetIsLongpressEnabled") @WrapForJNI(stubName = "SetIsLongpressEnabled") // Called from test thread.
private native void nativeSetIsLongpressEnabled(boolean isLongpressEnabled); private native void nativeSetIsLongpressEnabled(boolean isLongpressEnabled);
@Override // PanZoomController @Override // PanZoomController
@@ -286,7 +286,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
} }
} }
@WrapForJNI(stubName = "AdjustScrollForSurfaceShift") @WrapForJNI(calledFrom = "ui")
private native void adjustScrollForSurfaceShift(float aX, float aY); private native void adjustScrollForSurfaceShift(float aX, float aY);
@Override // PanZoomController @Override // PanZoomController
@@ -295,7 +295,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
return aMetrics.offsetViewportByAndClamp(aShift.x, aShift.y); return aMetrics.offsetViewportByAndClamp(aShift.x, aShift.y);
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
private void updateOverscrollVelocity(final float x, final float y) { private void updateOverscrollVelocity(final float x, final float y) {
if (mOverscroll != null) { if (mOverscroll != null) {
if (ThreadUtils.isOnUiThread() == true) { if (ThreadUtils.isOnUiThread() == true) {
@@ -314,7 +314,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
} }
} }
@WrapForJNI(allowMultithread = true) @WrapForJNI
private void updateOverscrollOffset(final float x, final float y) { private void updateOverscrollOffset(final float x, final float y) {
if (mOverscroll != null) { if (mOverscroll != null) {
if (ThreadUtils.isOnUiThread() == true) { if (ThreadUtils.isOnUiThread() == true) {
@@ -332,7 +332,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
} }
} }
@WrapForJNI @WrapForJNI(calledFrom = "ui")
private void setScrollingRootContent(final boolean isRootContent) { private void setScrollingRootContent(final boolean isRootContent) {
mTarget.setScrollingRootContent(isRootContent); mTarget.setScrollingRootContent(isRootContent);
} }
@@ -341,7 +341,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
* Active SelectionCaretDrag requires DynamicToolbarAnimator to be pinned * Active SelectionCaretDrag requires DynamicToolbarAnimator to be pinned
* to avoid unwanted scroll interactions. * to avoid unwanted scroll interactions.
*/ */
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
private void onSelectionDragState(boolean state) { private void onSelectionDragState(boolean state) {
mView.getDynamicToolbarAnimator().setPinned(state, PinReason.CARET_DRAG); mView.getDynamicToolbarAnimator().setPinned(state, PinReason.CARET_DRAG);
} }

View File

@@ -15,7 +15,7 @@ import org.mozilla.gecko.annotation.WrapForJNI;
* This class is vastly copied from {@link android.widget.OverScroller} but decouples the time * This class is vastly copied from {@link android.widget.OverScroller} but decouples the time
* from the app time so it can be specified manually. * from the app time so it can be specified manually.
*/ */
@WrapForJNI(allowMultithread = true, catchException = true) @WrapForJNI(exceptionMode = "nsresult")
public class StackScroller { public class StackScroller {
private int mMode; private int mMode;

View File

@@ -97,7 +97,7 @@ public class Restrictions {
return getConfiguration(context).canLoadUrl(url); return getConfiguration(context).canLoadUrl(url);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static boolean isUserRestricted() { public static boolean isUserRestricted() {
return isUserRestricted(GeckoAppShell.getApplicationContext()); return isUserRestricted(GeckoAppShell.getApplicationContext());
} }
@@ -110,7 +110,7 @@ public class Restrictions {
return getConfiguration(context).isAllowed(restrictable); return getConfiguration(context).isAllowed(restrictable);
} }
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static boolean isAllowed(int action, String url) { public static boolean isAllowed(int action, String url) {
final Restrictable restrictable; final Restrictable restrictable;
try { try {

View File

@@ -20,7 +20,7 @@ package org.mozilla.gecko.sqlite;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import org.mozilla.gecko.annotation.WrapForJNI; import org.mozilla.gecko.annotation.JNITarget;
import org.mozilla.gecko.AppConstants; import org.mozilla.gecko.AppConstants;
import android.database.AbstractCursor; import android.database.AbstractCursor;
@@ -56,7 +56,7 @@ public class MatrixBlobCursor extends AbstractCursor {
* determines column ordering elsewhere in this cursor * determines column ordering elsewhere in this cursor
* @param initialCapacity in rows * @param initialCapacity in rows
*/ */
@WrapForJNI @JNITarget
public MatrixBlobCursor(String[] columnNames, int initialCapacity) { public MatrixBlobCursor(String[] columnNames, int initialCapacity) {
this.columnNames = columnNames; this.columnNames = columnNames;
this.columnCount = columnNames.length; this.columnCount = columnNames.length;
@@ -77,7 +77,7 @@ public class MatrixBlobCursor extends AbstractCursor {
* @param columnNames names of the columns, the ordering of which * @param columnNames names of the columns, the ordering of which
* determines column ordering elsewhere in this cursor * determines column ordering elsewhere in this cursor
*/ */
@WrapForJNI @JNITarget
public MatrixBlobCursor(String[] columnNames) { public MatrixBlobCursor(String[] columnNames) {
this(columnNames, 16); this(columnNames, 16);
} }
@@ -132,7 +132,7 @@ public class MatrixBlobCursor extends AbstractCursor {
* @param columnValues in the same order as the the column names specified * @param columnValues in the same order as the the column names specified
* at cursor construction time * at cursor construction time
*/ */
@WrapForJNI @JNITarget
public void addRow(Object[] columnValues) { public void addRow(Object[] columnValues) {
if (columnValues.length != columnCount) { if (columnValues.length != columnCount) {
throw new IllegalArgumentException("columnNames.length = " throw new IllegalArgumentException("columnNames.length = "
@@ -154,7 +154,7 @@ public class MatrixBlobCursor extends AbstractCursor {
* @param columnValues in the same order as the the column names specified * @param columnValues in the same order as the the column names specified
* at cursor construction time * at cursor construction time
*/ */
@WrapForJNI @JNITarget
public void addRow(Iterable<?> columnValues) { public void addRow(Iterable<?> columnValues) {
final int start = rowCount * columnCount; final int start = rowCount * columnCount;
@@ -188,7 +188,7 @@ public class MatrixBlobCursor extends AbstractCursor {
} }
/** Optimization for {@link ArrayList}. */ /** Optimization for {@link ArrayList}. */
@WrapForJNI @JNITarget
private void addRow(ArrayList<?> columnValues, int start) { private void addRow(ArrayList<?> columnValues, int start) {
final int size = columnValues.size(); final int size = columnValues.size();
if (size != columnCount) { if (size != columnCount) {

View File

@@ -5,9 +5,9 @@
package org.mozilla.gecko.sqlite; package org.mozilla.gecko.sqlite;
import org.mozilla.gecko.annotation.WrapForJNI; import org.mozilla.gecko.annotation.JNITarget;
@WrapForJNI @JNITarget
public class SQLiteBridgeException extends RuntimeException { public class SQLiteBridgeException extends RuntimeException {
static final long serialVersionUID = 1L; static final long serialVersionUID = 1L;

View File

@@ -32,7 +32,7 @@ public final class Clipboard {
mContext = c.getApplicationContext(); mContext = c.getApplicationContext();
} }
@WrapForJNI(stubName = "GetClipboardTextWrapper") @WrapForJNI(calledFrom = "gecko")
public static String getText() { public static String getText() {
// If we're on the UI thread or the background thread, we have a looper on the thread // If we're on the UI thread or the background thread, we have a looper on the thread
// and can just call this directly. For any other threads, post the call to the // and can just call this directly. For any other threads, post the call to the
@@ -59,7 +59,7 @@ public final class Clipboard {
} }
} }
@WrapForJNI(stubName = "SetClipboardText") @WrapForJNI(calledFrom = "gecko")
public static void setText(final CharSequence text) { public static void setText(final CharSequence text) {
ThreadUtils.postToBackgroundThread(new Runnable() { ThreadUtils.postToBackgroundThread(new Runnable() {
@Override @Override
@@ -90,7 +90,7 @@ public final class Clipboard {
/** /**
* @return true if the clipboard is nonempty, false otherwise. * @return true if the clipboard is nonempty, false otherwise.
*/ */
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static boolean hasText() { public static boolean hasText() {
if (Versions.feature11Plus) { if (Versions.feature11Plus) {
android.content.ClipboardManager cm = (android.content.ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE); android.content.ClipboardManager cm = (android.content.ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
@@ -105,7 +105,7 @@ public final class Clipboard {
/** /**
* Deletes all text from the clipboard. * Deletes all text from the clipboard.
*/ */
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public static void clearText() { public static void clearText() {
setText(null); setText(null);
} }

View File

@@ -36,7 +36,7 @@ public final class HardwareCodecCapabilityUtils {
COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m COLOR_QCOM_FORMATYUV420PackedSemiPlanar32m
}; };
@WrapForJNI(allowMultithread = true, stubName = "FindDecoderCodecInfoForMimeType") @WrapForJNI
public static boolean findDecoderCodecInfoForMimeType(String aMimeType) { public static boolean findDecoderCodecInfoForMimeType(String aMimeType) {
for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) { for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i); MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);

View File

@@ -15,7 +15,7 @@ import org.mozilla.gecko.annotation.WrapForJNI;
* thread, call {@link #clone()} to make a copy, and use the copy on the other thread. * thread, call {@link #clone()} to make a copy, and use the copy on the other thread.
* When a copy is first used, it becomes attached to the thread using it. * When a copy is first used, it becomes attached to the thread using it.
*/ */
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public final class NativeJSContainer extends NativeJSObject public final class NativeJSContainer extends NativeJSObject
{ {
private NativeJSContainer() { private NativeJSContainer() {

View File

@@ -15,7 +15,7 @@ import android.os.Bundle;
* NativeJSObject is a wrapper around the SpiderMonkey JSAPI to make it possible to * NativeJSObject is a wrapper around the SpiderMonkey JSAPI to make it possible to
* access Javascript objects in Java. * access Javascript objects in Java.
*/ */
@WrapForJNI @WrapForJNI(calledFrom = "gecko")
public class NativeJSObject extends JNIObject public class NativeJSObject extends JNIObject
{ {
@SuppressWarnings("serial") @SuppressWarnings("serial")

View File

@@ -113,12 +113,6 @@ public class testEventDispatcher extends JavascriptBridgeTest
getJS().syncCall("send_message_for_response", NATIVE_RESPONSE_EVENT, "error"); getJS().syncCall("send_message_for_response", NATIVE_RESPONSE_EVENT, "error");
getJS().syncCall("send_test_message", NATIVE_EXCEPTION_EVENT); getJS().syncCall("send_test_message", NATIVE_EXCEPTION_EVENT);
fAssertNotSame("Should have saved a message", null, savedMessage);
try {
savedMessage.toString();
fFail("Using NativeJSContainer should throw after disposal");
} catch (final NullPointerException e) {
}
getJS().syncCall("send_test_message", UI_EVENT); getJS().syncCall("send_test_message", UI_EVENT);
waitForAsyncEvent(); waitForAsyncEvent();
@@ -260,6 +254,9 @@ public class testEventDispatcher extends JavascriptBridgeTest
fFail("Response type should be valid: " + response); fFail("Response type should be valid: " + response);
} }
// Save this message for post-disposal check.
savedMessage = message;
} else if (NATIVE_EXCEPTION_EVENT.equals(event)) { } else if (NATIVE_EXCEPTION_EVENT.equals(event)) {
// Make sure we throw the right exceptions. // Make sure we throw the right exceptions.
try { try {
@@ -280,8 +277,12 @@ public class testEventDispatcher extends JavascriptBridgeTest
} catch (final NativeJSObject.InvalidPropertyException e) { } catch (final NativeJSObject.InvalidPropertyException e) {
} }
// Save this message for post-disposal check. fAssertNotSame("Should have saved a message", null, savedMessage);
savedMessage = message; try {
savedMessage.toString();
fFail("Using NativeJSContainer should throw after disposal");
} catch (final NullPointerException e) {
}
// Save this test for last; make sure EventDispatcher catches InvalidPropertyException. // Save this test for last; make sure EventDispatcher catches InvalidPropertyException.
message.getString("nonexistent_string"); message.getString("nonexistent_string");

View File

@@ -58,6 +58,6 @@ nsAndroidNetworkLinkService::GetLinkType(uint32_t *aLinkType)
return NS_OK; return NS_OK;
} }
*aLinkType = java::GeckoAppShell::NetworkLinkType(); *aLinkType = java::GeckoAppShell::GetNetworkLinkType();
return NS_OK; return NS_OK;
} }

View File

@@ -485,7 +485,7 @@ void BuildJavaThreadJSObject(SpliceableJSONWriter& aWriter)
firstRun = false; firstRun = false;
double sampleTime = double sampleTime =
java::GeckoJavaSampler::GetSampleTimeJavaProfiling(0, sampleId); java::GeckoJavaSampler::GetSampleTime(0, sampleId);
aWriter.StartObjectElement(); aWriter.StartObjectElement();
aWriter.DoubleProperty("time", sampleTime); aWriter.DoubleProperty("time", sampleTime);
@@ -562,7 +562,7 @@ void GeckoSampler::StreamJSON(SpliceableJSONWriter& aWriter, double aSinceTime)
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK) #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
if (ProfileJava()) { if (ProfileJava()) {
java::GeckoJavaSampler::PauseJavaProfiling(); java::GeckoJavaSampler::Pause();
aWriter.Start(); aWriter.Start();
{ {
@@ -570,7 +570,7 @@ void GeckoSampler::StreamJSON(SpliceableJSONWriter& aWriter, double aSinceTime)
} }
aWriter.End(); aWriter.End();
java::GeckoJavaSampler::UnpauseJavaProfiling(); java::GeckoJavaSampler::Unpause();
} }
#endif #endif
#endif #endif

View File

@@ -825,7 +825,7 @@ void mozilla_sampler_start(int aProfileEntries, double aInterval,
if (javaInterval < 10) { if (javaInterval < 10) {
aInterval = 10; aInterval = 10;
} }
java::GeckoJavaSampler::StartJavaProfiling(javaInterval, 1000); java::GeckoJavaSampler::Start(javaInterval, 1000);
} }
#endif #endif

View File

@@ -341,7 +341,7 @@ AndroidBridge::GetHandlersForMimeType(const nsAString& aMimeType,
{ {
ALOG_BRIDGE("AndroidBridge::GetHandlersForMimeType"); ALOG_BRIDGE("AndroidBridge::GetHandlersForMimeType");
auto arr = GeckoAppShell::GetHandlersForMimeTypeWrapper(aMimeType, aAction); auto arr = GeckoAppShell::GetHandlersForMimeType(aMimeType, aAction);
if (!arr) if (!arr)
return false; return false;
@@ -386,7 +386,7 @@ AndroidBridge::GetHandlersForURL(const nsAString& aURL,
{ {
ALOG_BRIDGE("AndroidBridge::GetHandlersForURL"); ALOG_BRIDGE("AndroidBridge::GetHandlersForURL");
auto arr = GeckoAppShell::GetHandlersForURLWrapper(aURL, aAction); auto arr = GeckoAppShell::GetHandlersForURL(aURL, aAction);
if (!arr) if (!arr)
return false; return false;
@@ -406,7 +406,7 @@ AndroidBridge::GetMimeTypeFromExtensions(const nsACString& aFileExt, nsCString&
{ {
ALOG_BRIDGE("AndroidBridge::GetMimeTypeFromExtensions"); ALOG_BRIDGE("AndroidBridge::GetMimeTypeFromExtensions");
auto jstrType = GeckoAppShell::GetMimeTypeFromExtensionsWrapper(aFileExt); auto jstrType = GeckoAppShell::GetMimeTypeFromExtensions(aFileExt);
if (jstrType) { if (jstrType) {
aMimeType = jstrType->ToCString(); aMimeType = jstrType->ToCString();
@@ -418,7 +418,7 @@ AndroidBridge::GetExtensionFromMimeType(const nsACString& aMimeType, nsACString&
{ {
ALOG_BRIDGE("AndroidBridge::GetExtensionFromMimeType"); ALOG_BRIDGE("AndroidBridge::GetExtensionFromMimeType");
auto jstrExt = GeckoAppShell::GetExtensionFromMimeTypeWrapper(aMimeType); auto jstrExt = GeckoAppShell::GetExtensionFromMimeType(aMimeType);
if (jstrExt) { if (jstrExt) {
aFileExt = jstrExt->ToCString(); aFileExt = jstrExt->ToCString();
@@ -430,7 +430,7 @@ AndroidBridge::GetClipboardText(nsAString& aText)
{ {
ALOG_BRIDGE("AndroidBridge::GetClipboardText"); ALOG_BRIDGE("AndroidBridge::GetClipboardText");
auto text = Clipboard::GetClipboardTextWrapper(); auto text = Clipboard::GetText();
if (text) { if (text) {
aText = text->ToString(); aText = text->ToString();
@@ -447,7 +447,7 @@ AndroidBridge::GetDPI()
const int DEFAULT_DPI = 160; const int DEFAULT_DPI = 160;
sDPI = GeckoAppShell::GetDpiWrapper(); sDPI = GeckoAppShell::GetDpi();
if (!sDPI) { if (!sDPI) {
return DEFAULT_DPI; return DEFAULT_DPI;
} }
@@ -467,7 +467,7 @@ AndroidBridge::GetScreenDepth()
const int DEFAULT_DEPTH = 16; const int DEFAULT_DEPTH = 16;
if (jni::IsAvailable()) { if (jni::IsAvailable()) {
sDepth = GeckoAppShell::GetScreenDepthWrapper(); sDepth = GeckoAppShell::GetScreenDepth();
} }
if (!sDepth) if (!sDepth)
return DEFAULT_DEPTH; return DEFAULT_DEPTH;
@@ -493,7 +493,7 @@ AndroidBridge::Vibrate(const nsTArray<uint32_t>& aPattern)
ALOG_BRIDGE(" invalid vibration duration < 0"); ALOG_BRIDGE(" invalid vibration duration < 0");
return; return;
} }
GeckoAppShell::Vibrate1(d); GeckoAppShell::Vibrate(d);
return; return;
} }
@@ -522,7 +522,7 @@ AndroidBridge::Vibrate(const nsTArray<uint32_t>& aPattern)
} }
env->ReleaseLongArrayElements(array, elts, 0); env->ReleaseLongArrayElements(array, elts, 0);
GeckoAppShell::VibrateA(LongArray::Ref::From(array), -1 /* don't repeat */); GeckoAppShell::Vibrate(LongArray::Ref::From(array), -1 /* don't repeat */);
} }
void void
@@ -533,7 +533,7 @@ AndroidBridge::GetSystemColors(AndroidSystemColors *aColors)
if (!aColors) if (!aColors)
return; return;
auto arr = GeckoAppShell::GetSystemColoursWrapper(); auto arr = GeckoAppShell::GetSystemColors();
if (!arr) if (!arr)
return; return;
@@ -566,8 +566,7 @@ AndroidBridge::GetIconForExtension(const nsACString& aFileExt, uint32_t aIconSiz
if (!aBuf) if (!aBuf)
return; return;
auto arr = GeckoAppShell::GetIconForExtensionWrapper auto arr = GeckoAppShell::GetIconForExtension(NS_ConvertUTF8toUTF16(aFileExt), aIconSize);
(NS_ConvertUTF8toUTF16(aFileExt), aIconSize);
NS_ASSERTION(arr != nullptr, "AndroidBridge::GetIconForExtension: Returned pixels array is null!"); NS_ASSERTION(arr != nullptr, "AndroidBridge::GetIconForExtension: Returned pixels array is null!");
if (!arr) if (!arr)
@@ -729,7 +728,7 @@ namespace mozilla {
bool bool
AndroidBridge::InitCamera(const nsCString& contentType, uint32_t camera, uint32_t *width, uint32_t *height, uint32_t *fps) AndroidBridge::InitCamera(const nsCString& contentType, uint32_t camera, uint32_t *width, uint32_t *height, uint32_t *fps)
{ {
auto arr = GeckoAppShell::InitCameraWrapper auto arr = GeckoAppShell::InitCamera
(NS_ConvertUTF8toUTF16(contentType), (int32_t) camera, (int32_t) *width, (int32_t) *height); (NS_ConvertUTF8toUTF16(contentType), (int32_t) camera, (int32_t) *width, (int32_t) *height);
if (!arr) if (!arr)
@@ -756,7 +755,7 @@ AndroidBridge::GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInf
// To prevent calling too many methods through JNI, the Java method returns // To prevent calling too many methods through JNI, the Java method returns
// an array of double even if we actually want a double and a boolean. // an array of double even if we actually want a double and a boolean.
auto arr = GeckoAppShell::GetCurrentBatteryInformationWrapper(); auto arr = GeckoAppShell::GetCurrentBatteryInformation();
JNIEnv* const env = arr.Env(); JNIEnv* const env = arr.Env();
if (!arr || env->GetArrayLength(arr.Get()) != 3) { if (!arr || env->GetArrayLength(arr.Get()) != 3) {
@@ -778,7 +777,7 @@ AndroidBridge::HandleGeckoMessage(JSContext* cx, JS::HandleObject object)
ALOG_BRIDGE("%s", __PRETTY_FUNCTION__); ALOG_BRIDGE("%s", __PRETTY_FUNCTION__);
auto message = widget::CreateNativeJSContainer(cx, object); auto message = widget::CreateNativeJSContainer(cx, object);
GeckoAppShell::HandleGeckoMessageWrapper(message); GeckoAppShell::HandleGeckoMessage(message);
} }
nsresult nsresult
@@ -833,7 +832,7 @@ AndroidBridge::SendMessage(const nsAString& aNumber,
if (!QueueSmsRequest(aRequest, &requestId)) if (!QueueSmsRequest(aRequest, &requestId))
return; return;
GeckoAppShell::SendMessageWrapper(aNumber, aMessage, requestId); GeckoAppShell::SendMessage(aNumber, aMessage, requestId);
} }
void void
@@ -845,7 +844,7 @@ AndroidBridge::GetMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequest
if (!QueueSmsRequest(aRequest, &requestId)) if (!QueueSmsRequest(aRequest, &requestId))
return; return;
GeckoAppShell::GetMessageWrapper(aMessageId, requestId); GeckoAppShell::GetMessage(aMessageId, requestId);
} }
void void
@@ -857,7 +856,7 @@ AndroidBridge::DeleteMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequ
if (!QueueSmsRequest(aRequest, &requestId)) if (!QueueSmsRequest(aRequest, &requestId))
return; return;
GeckoAppShell::DeleteMessageWrapper(aMessageId, requestId); GeckoAppShell::DeleteMessage(aMessageId, requestId);
} }
void void
@@ -884,7 +883,7 @@ NS_IMPL_ISUPPORTS0(MessageCursorContinueCallback)
NS_IMETHODIMP NS_IMETHODIMP
MessageCursorContinueCallback::HandleContinue() MessageCursorContinueCallback::HandleContinue()
{ {
GeckoAppShell::GetNextMessageWrapper(mRequestId); GeckoAppShell::GetNextMessage(mRequestId);
return NS_OK; return NS_OK;
} }
@@ -926,14 +925,14 @@ AndroidBridge::CreateMessageCursor(bool aHasStartDate,
int64_t startDate = aHasStartDate ? aStartDate : -1; int64_t startDate = aHasStartDate ? aStartDate : -1;
int64_t endDate = aHasEndDate ? aEndDate : -1; int64_t endDate = aHasEndDate ? aEndDate : -1;
GeckoAppShell::CreateMessageCursorWrapper(startDate, endDate, GeckoAppShell::CreateMessageCursor(startDate, endDate,
ObjectArray::Ref::From(numbers), ObjectArray::Ref::From(numbers),
aNumbersCount, aNumbersCount,
aDelivery, aDelivery,
aHasRead, aRead, aHasRead, aRead,
aHasThreadId, aThreadId, aHasThreadId, aThreadId,
aReverse, aReverse,
requestId); requestId);
nsCOMPtr<nsICursorContinueCallback> callback = nsCOMPtr<nsICursorContinueCallback> callback =
new MessageCursorContinueCallback(requestId); new MessageCursorContinueCallback(requestId);
@@ -945,7 +944,7 @@ NS_IMPL_ISUPPORTS0(ThreadCursorContinueCallback)
NS_IMETHODIMP NS_IMETHODIMP
ThreadCursorContinueCallback::HandleContinue() ThreadCursorContinueCallback::HandleContinue()
{ {
GeckoAppShell::GetNextThreadWrapper(mRequestId); GeckoAppShell::GetNextThread(mRequestId);
return NS_OK; return NS_OK;
} }
@@ -959,7 +958,7 @@ AndroidBridge::CreateThreadCursor(nsIMobileMessageCursorCallback* aRequest)
return nullptr; return nullptr;
} }
GeckoAppShell::CreateThreadCursorWrapper(requestId); GeckoAppShell::CreateThreadCursor(requestId);
nsCOMPtr<nsICursorContinueCallback> callback = nsCOMPtr<nsICursorContinueCallback> callback =
new ThreadCursorContinueCallback(requestId); new ThreadCursorContinueCallback(requestId);
@@ -1060,7 +1059,7 @@ AndroidBridge::GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInf
// To prevent calling too many methods through JNI, the Java method returns // To prevent calling too many methods through JNI, the Java method returns
// an array of double even if we actually want an integer, a boolean, and an integer. // an array of double even if we actually want an integer, a boolean, and an integer.
auto arr = GeckoAppShell::GetCurrentNetworkInformationWrapper(); auto arr = GeckoAppShell::GetCurrentNetworkInformation();
JNIEnv* const env = arr.Env(); JNIEnv* const env = arr.Env();
if (!arr || env->GetArrayLength(arr.Get()) != 3) { if (!arr || env->GetArrayLength(arr.Get()) != 3) {
@@ -1348,7 +1347,7 @@ AndroidBridge::GetScreenOrientation()
{ {
ALOG_BRIDGE("AndroidBridge::GetScreenOrientation"); ALOG_BRIDGE("AndroidBridge::GetScreenOrientation");
int16_t orientation = GeckoAppShell::GetScreenOrientationWrapper(); int16_t orientation = GeckoAppShell::GetScreenOrientation();
if (!orientation) if (!orientation)
return dom::eScreenOrientation_None; return dom::eScreenOrientation_None;
@@ -1379,7 +1378,7 @@ AndroidBridge::GetProxyForURI(const nsACString & aSpec,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
auto jstrRet = GeckoAppShell::GetProxyForURIWrapper(aSpec, aScheme, aHost, aPort); auto jstrRet = GeckoAppShell::GetProxyForURI(aSpec, aScheme, aHost, aPort);
if (!jstrRet) if (!jstrRet)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -1438,8 +1437,8 @@ AndroidBridge::AddPluginView(jobject view, const LayoutDeviceRect& rect, bool is
return; return;
CSSRect cssRect = rect / win->GetDefaultScale(); CSSRect cssRect = rect / win->GetDefaultScale();
GeckoAppShell::AddPluginViewWrapper(Object::Ref::From(view), cssRect.x, cssRect.y, GeckoAppShell::AddPluginView(Object::Ref::From(view), cssRect.x, cssRect.y,
cssRect.width, cssRect.height, isFullScreen); cssRect.width, cssRect.height, isFullScreen);
} }
extern "C" extern "C"
@@ -1450,7 +1449,7 @@ Java_org_mozilla_gecko_GeckoAppShell_allocateDirectBuffer(JNIEnv *env, jclass, j
bool bool
AndroidBridge::GetThreadNameJavaProfiling(uint32_t aThreadId, nsCString & aResult) AndroidBridge::GetThreadNameJavaProfiling(uint32_t aThreadId, nsCString & aResult)
{ {
auto jstrThreadName = GeckoJavaSampler::GetThreadNameJavaProfilingWrapper(aThreadId); auto jstrThreadName = GeckoJavaSampler::GetThreadName(aThreadId);
if (!jstrThreadName) if (!jstrThreadName)
return false; return false;
@@ -1463,7 +1462,7 @@ bool
AndroidBridge::GetFrameNameJavaProfiling(uint32_t aThreadId, uint32_t aSampleId, AndroidBridge::GetFrameNameJavaProfiling(uint32_t aThreadId, uint32_t aSampleId,
uint32_t aFrameId, nsCString & aResult) uint32_t aFrameId, nsCString & aResult)
{ {
auto jstrSampleName = GeckoJavaSampler::GetFrameNameJavaProfilingWrapper auto jstrSampleName = GeckoJavaSampler::GetFrameName
(aThreadId, aSampleId, aFrameId); (aThreadId, aSampleId, aFrameId);
if (!jstrSampleName) if (!jstrSampleName)

View File

@@ -43,7 +43,7 @@ nsClipboard::SetData(nsITransferable *aTransferable,
nsAutoString buffer; nsAutoString buffer;
supportsString->GetData(buffer); supportsString->GetData(buffer);
java::Clipboard::SetClipboardText(buffer); java::Clipboard::SetText(buffer);
return NS_OK; return NS_OK;
} }

View File

@@ -64,7 +64,7 @@ nsScreenAndroid::GetPixelDepth(int32_t *aPixelDepth)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
*aPixelDepth = java::GeckoAppShell::GetScreenDepthWrapper(); *aPixelDepth = java::GeckoAppShell::GetScreenDepth();
return NS_OK; return NS_OK;
} }