Bug 1014614 - Fix JNI wrapper for registering SurfaceTexture listener callbacks r=blassey a=lsblakk
authorJames Willcox <snorp@snorp.net>
Wed, 05 Nov 2014 10:17:50 -0600
changeset 225939 bef38c92bab9
parent 225938 6b03a2b8f2f4
child 225940 c82e88a99ca3
push id4076
push userjwillcox@mozilla.com
push date2014-11-05 21:30 +0000
treeherdermozilla-beta@5811de401315 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, lsblakk
bugs1014614
milestone34.0
Bug 1014614 - Fix JNI wrapper for registering SurfaceTexture listener callbacks r=blassey a=lsblakk --HG-- extra : rebase_source : 1d2db739691e455e9622381c2a730947701322b6
mobile/android/base/GeckoAppShell.java
widget/android/GeneratedJNIWrappers.cpp
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -2521,17 +2521,17 @@ public class GeckoAppShell
     }
 
     @WrapElementForJNI
     public static void notifyWakeLockChanged(String topic, String state) {
         if (getGeckoInterface() != null)
             getGeckoInterface().notifyWakeLockChanged(topic, state);
     }
 
-    @WrapElementForJNI
+    @WrapElementForJNI(allowMultithread = true)
     public static void registerSurfaceTextureFrameListener(Object surfaceTexture, final int id) {
         ((SurfaceTexture)surfaceTexture).setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() {
             @Override
             public void onFrameAvailable(SurfaceTexture surfaceTexture) {
                 GeckoAppShell.onSurfaceTextureFrameAvailable(surfaceTexture, id);
             }
         });
     }
--- a/widget/android/GeneratedJNIWrappers.cpp
+++ b/widget/android/GeneratedJNIWrappers.cpp
@@ -1113,17 +1113,17 @@ bool GeckoAppShell::PumpMessageLoop() {
 
     bool temp = env->CallStaticBooleanMethod(mGeckoAppShellClass, jPumpMessageLoop);
     AndroidBridge::HandleUncaughtException(env);
     env->PopLocalFrame(nullptr);
     return temp;
 }
 
 void GeckoAppShell::RegisterSurfaceTextureFrameListener(jobject a0, int32_t a1) {
-    JNIEnv *env = AndroidBridge::GetJNIEnv();
+    JNIEnv *env = GetJNIForThread();
     if (env->PushLocalFrame(1) != 0) {
         AndroidBridge::HandleUncaughtException(env);
         MOZ_CRASH("Exception should have caused crash.");
     }
 
     env->CallStaticVoidMethod(mGeckoAppShellClass, jRegisterSurfaceTextureFrameListener, a0, a1);
     AndroidBridge::HandleUncaughtException(env);
     env->PopLocalFrame(nullptr);