Bug 1188590: Don't sync dispatch if we're already on main. r=snorp, a=abillings
authorByron Campen [:bwc] <docfaraday@gmail.com>
Tue, 28 Jul 2015 16:56:34 -0500
changeset 281581 67ee052e79c980efedbba9d8ff4d12b2e2ceedfa
parent 281580 b567800c8964fce52f9bd60c28b223662d4e1c2a
child 281582 c9822fda68ff0212b8ec811c4f4f524268274751
push id3894
push usermconley@mozilla.com
push dateThu, 30 Jul 2015 00:27:47 +0000
reviewerssnorp, abillings
bugs1188590
milestone42.0a1
Bug 1188590: Don't sync dispatch if we're already on main. r=snorp, a=abillings
widget/android/AndroidJNIWrapper.cpp
--- a/widget/android/AndroidJNIWrapper.cpp
+++ b/widget/android/AndroidJNIWrapper.cpp
@@ -50,16 +50,20 @@ extern "C" {
 
     // return the newly create global reference
     return globalRef;
   }
 
   __attribute__ ((visibility("default")))
   jclass
   jsjni_GetGlobalClassRef(const char *className) {
+    if (NS_IsMainThread()) {
+      return __jsjni_GetGlobalClassRef(className);
+    }
+
     nsCOMPtr<nsIThread> mainThread;
     mozilla::DebugOnly<nsresult> rv = NS_GetMainThread(getter_AddRefs(mainThread));
     MOZ_ASSERT(NS_SUCCEEDED(rv));
 
     jclass foundClass;
     nsCOMPtr<nsIRunnable> runnable_ref(new GetGlobalClassRefRunnable(className,
                                                                      &foundClass));
     mainThread->Dispatch(runnable_ref, NS_DISPATCH_SYNC);