Bug 717958 - Always read FPS pref on the main thread with OMTC. r=ajuma
authorBenoit Girard <b56girard@gmail.com>
Mon, 05 Mar 2012 14:02:22 -0500
changeset 88288 32fcf3259a470c25bf9eeea7b8142ba1faaaa201
parent 88287 9fcb60770cc8b22ba56c7a7b0e6c574dba9d35a8
child 88289 f11d66ebdc74febb6b6606bbfafd6c4707dca305
push id22189
push usermbrubeck@mozilla.com
push dateTue, 06 Mar 2012 18:59:28 +0000
treeherdermozilla-central@0d5047118038 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersajuma
bugs717958
milestone13.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 717958 - Always read FPS pref on the main thread with OMTC. r=ajuma
gfx/layers/opengl/LayerManagerOGL.cpp
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -362,17 +362,30 @@ LayerManagerOGL::Initialize(nsRefPtr<GLC
     msg += NS_LITERAL_STRING("\nFBO Texture Target: ");
     if (mFBOTextureTarget == LOCAL_GL_TEXTURE_2D)
       msg += NS_LITERAL_STRING("TEXTURE_2D");
     else
       msg += NS_LITERAL_STRING("TEXTURE_RECTANGLE");
     console->LogStringMessage(msg.get());
   }
 
-  Preferences::AddBoolVarCache(&sDrawFPS, "layers.acceleration.draw-fps");
+  if (NS_IsMainThread()) {
+    Preferences::AddBoolVarCache(&sDrawFPS, "layers.acceleration.draw-fps");
+  } else {
+    // We have to dispatch an event to the main thread to read the pref.
+    class ReadDrawFPSPref : public nsRunnable {
+    public:
+      NS_IMETHOD Run()
+      {
+        Preferences::AddBoolVarCache(&sDrawFPS, "layers.acceleration.draw-fps");
+        return NS_OK;
+      }
+    };
+    NS_DispatchToMainThread(new ReadDrawFPSPref());
+  }
 
   reporter.SetSuccessful();
   return true;
 }
 
 void
 LayerManagerOGL::SetClippingRegion(const nsIntRegion& aClippingRegion)
 {