bug 893968 - LaunchState locking isn't actually locking anything useful r=kats
authorBrad Lassey <blassey@mozilla.com>
Mon, 15 Jul 2013 15:36:00 -0400
changeset 138564 e4e605d990f465b0ebcf1993070e0f400346836a
parent 138563 a28ade3d4bdc1256cd52d399df9926e9dba7ca9a
child 138565 348b2ba27515f7918f0602868b7e7fd4c7371d25
push idunknown
push userunknown
push dateunknown
reviewerskats
bugs893968
milestone25.0a1
bug 893968 - LaunchState locking isn't actually locking anything useful r=kats
mobile/android/base/GeckoThread.java
--- a/mobile/android/base/GeckoThread.java
+++ b/mobile/android/base/GeckoThread.java
@@ -115,42 +115,44 @@ public class GeckoThread extends Thread 
         String type = getTypeFromAction(mIntent.getAction());
         mIntent = null;
 
         // and then fire us up
         Log.i(LOGTAG, "RunGecko - args = " + args);
         GeckoAppShell.runGecko(path, args, mUri, type);
     }
 
+    private static Object sLock = new Object();
+
     @Override
     public void handleMessage(String event, JSONObject message) {
         if ("Gecko:Ready".equals(event)) {
             GeckoAppShell.getEventDispatcher().unregisterEventListener(event, this);
             setLaunchState(LaunchState.GeckoRunning);
             GeckoAppShell.sendPendingEventsToGecko();
         }
     }
 
     public static boolean checkLaunchState(LaunchState checkState) {
-        synchronized (sLaunchState) {
+        synchronized (sLock) {
             return sLaunchState == checkState;
         }
     }
 
     static void setLaunchState(LaunchState setState) {
-        synchronized (sLaunchState) {
+        synchronized (sLock) {
             sLaunchState = setState;
         }
     }
 
     /**
      * Set the launch state to <code>setState</code> and return true if the current launch
      * state is <code>checkState</code>; otherwise do nothing and return false.
      */
     static boolean checkAndSetLaunchState(LaunchState checkState, LaunchState setState) {
-        synchronized (sLaunchState) {
+        synchronized (sLock) {
             if (sLaunchState != checkState)
                 return false;
             sLaunchState = setState;
             return true;
         }
     }
 }