Bug 863777 - Add native stack JNI method definitions; r=kats
authorJim Chen <nchen@mozilla.com>
Fri, 14 Jun 2013 12:42:10 -0400
changeset 146580 6ef6c1d22b82c422a52d09b42b0e769b057bbeb2
parent 146579 d3a99408f071ddfb37e0ee0656e2dbb0cfe521a7
child 146581 ad833531c7f534bfdce29f965926ba2847d83582
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs863777
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 863777 - Add native stack JNI method definitions; r=kats
mobile/android/base/ANRReporter.java
mobile/android/base/Makefile.in
mozglue/android/jni-stubs.inc
widget/android/AndroidJNI.cpp
--- a/mobile/android/base/ANRReporter.java
+++ b/mobile/android/base/ANRReporter.java
@@ -57,16 +57,20 @@ public final class ANRReporter extends B
     private static final String TRACES_CHARSET = "us-ascii";
     private static final String PING_CHARSET = "us-ascii";
 
     private static final ANRReporter sInstance = new ANRReporter();
     private static int sRegisteredCount;
     private Handler mHandler;
     private volatile boolean mPendingANR;
 
+    private static native boolean requestNativeStack();
+    private static native String getNativeStack();
+    private static native void releaseNativeStack();
+
     public static void register(Context context) {
         if (sRegisteredCount++ != 0) {
             // Already registered
             return;
         }
         sInstance.start(context);
     }
 
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -1213,16 +1213,17 @@ endif
 jars:
 	@echo "MKDIR jars"
 	$(NSINSTALL) -D jars
 
 CLASSES_WITH_JNI= \
     org.mozilla.gecko.GeckoAppShell \
     org.mozilla.gecko.GeckoJavaSampler \
     org.mozilla.gecko.gfx.NativePanZoomController \
+    org.mozilla.gecko.ANRReporter \
     $(NULL)
 
 ifdef MOZ_WEBSMS_BACKEND
 # Note: if you are building with MOZ_WEBSMS_BACKEND turned on, then
 # you will get a build error because the generated jni-stubs.inc will
 # be different than the one checked in (i.e. it will have the sms-related
 # JNI stubs as well). Just copy the generated file to mozglue/android/
 # like the error message says and rebuild. All should be well after that.
--- a/mozglue/android/jni-stubs.inc
+++ b/mozglue/android/jni-stubs.inc
@@ -564,8 +564,65 @@ Java_org_mozilla_gecko_gfx_NativePanZoom
     return f_Java_org_mozilla_gecko_gfx_NativePanZoomController_getOverScrollMode(arg0, arg1);
 }
 #endif
 
 #ifdef JNI_BINDINGS
   xul_dlsym("Java_org_mozilla_gecko_gfx_NativePanZoomController_getOverScrollMode", &f_Java_org_mozilla_gecko_gfx_NativePanZoomController_getOverScrollMode);
 #endif
 
+#ifdef JNI_STUBS
+
+typedef jboolean (*Java_org_mozilla_gecko_ANRReporter_requestNativeStack_t)(JNIEnv *, jclass);
+static Java_org_mozilla_gecko_ANRReporter_requestNativeStack_t f_Java_org_mozilla_gecko_ANRReporter_requestNativeStack;
+extern "C" NS_EXPORT jboolean JNICALL
+Java_org_mozilla_gecko_ANRReporter_requestNativeStack(JNIEnv * arg0, jclass arg1) {
+    if (!f_Java_org_mozilla_gecko_ANRReporter_requestNativeStack) {
+        arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
+                       "JNI Function called before it was loaded");
+        return false;
+    }
+    return f_Java_org_mozilla_gecko_ANRReporter_requestNativeStack(arg0, arg1);
+}
+#endif
+
+#ifdef JNI_BINDINGS
+  xul_dlsym("Java_org_mozilla_gecko_ANRReporter_requestNativeStack", &f_Java_org_mozilla_gecko_ANRReporter_requestNativeStack);
+#endif
+
+#ifdef JNI_STUBS
+
+typedef jstring (*Java_org_mozilla_gecko_ANRReporter_getNativeStack_t)(JNIEnv *, jclass);
+static Java_org_mozilla_gecko_ANRReporter_getNativeStack_t f_Java_org_mozilla_gecko_ANRReporter_getNativeStack;
+extern "C" NS_EXPORT jstring JNICALL
+Java_org_mozilla_gecko_ANRReporter_getNativeStack(JNIEnv * arg0, jclass arg1) {
+    if (!f_Java_org_mozilla_gecko_ANRReporter_getNativeStack) {
+        arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
+                       "JNI Function called before it was loaded");
+        return NULL;
+    }
+    return f_Java_org_mozilla_gecko_ANRReporter_getNativeStack(arg0, arg1);
+}
+#endif
+
+#ifdef JNI_BINDINGS
+  xul_dlsym("Java_org_mozilla_gecko_ANRReporter_getNativeStack", &f_Java_org_mozilla_gecko_ANRReporter_getNativeStack);
+#endif
+
+#ifdef JNI_STUBS
+
+typedef void (*Java_org_mozilla_gecko_ANRReporter_releaseNativeStack_t)(JNIEnv *, jclass);
+static Java_org_mozilla_gecko_ANRReporter_releaseNativeStack_t f_Java_org_mozilla_gecko_ANRReporter_releaseNativeStack;
+extern "C" NS_EXPORT void JNICALL
+Java_org_mozilla_gecko_ANRReporter_releaseNativeStack(JNIEnv * arg0, jclass arg1) {
+    if (!f_Java_org_mozilla_gecko_ANRReporter_releaseNativeStack) {
+        arg0->ThrowNew(arg0->FindClass("java/lang/UnsupportedOperationException"),
+                       "JNI Function called before it was loaded");
+        return ;
+    }
+     f_Java_org_mozilla_gecko_ANRReporter_releaseNativeStack(arg0, arg1);
+}
+#endif
+
+#ifdef JNI_BINDINGS
+  xul_dlsym("Java_org_mozilla_gecko_ANRReporter_releaseNativeStack", &f_Java_org_mozilla_gecko_ANRReporter_releaseNativeStack);
+#endif
+
--- a/widget/android/AndroidJNI.cpp
+++ b/widget/android/AndroidJNI.cpp
@@ -971,9 +971,27 @@ Java_org_mozilla_gecko_gfx_NativePanZoom
 
 NS_EXPORT jint JNICALL
 Java_org_mozilla_gecko_gfx_NativePanZoomController_getOverScrollMode(JNIEnv* env, jobject instance)
 {
     // FIXME implement this
     return 0;
 }
 
+NS_EXPORT jboolean JNICALL
+Java_org_mozilla_gecko_ANRReporter_requestNativeStack(JNIEnv*, jclass)
+{
+    return JNI_FALSE;
 }
+
+NS_EXPORT jstring JNICALL
+Java_org_mozilla_gecko_ANRReporter_getNativeStack(JNIEnv* jenv, jclass)
+{
+    return NULL;
+}
+
+NS_EXPORT void JNICALL
+Java_org_mozilla_gecko_ANRReporter_releaseNativeStack(JNIEnv* jenv, jclass)
+{
+    return;
+}
+
+}