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 286906 67ee052e79c980efedbba9d8ff4d12b2e2ceedfa
parent 286905 b567800c8964fce52f9bd60c28b223662d4e1c2a
child 286907 c9822fda68ff0212b8ec811c4f4f524268274751
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, abillings
bugs1188590
milestone42.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 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);