From f9eaee1ae04971dd9b076c8a5446c2df68e0e003 Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Mon, 5 Mar 2012 14:02:22 -0500 Subject: [PATCH] Bug 717958 - Always read FPS pref on the main thread with OMTC. r=ajuma --- gfx/layers/opengl/LayerManagerOGL.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gfx/layers/opengl/LayerManagerOGL.cpp b/gfx/layers/opengl/LayerManagerOGL.cpp index 6cf649e0252..31bd86054b1 100644 --- a/gfx/layers/opengl/LayerManagerOGL.cpp +++ b/gfx/layers/opengl/LayerManagerOGL.cpp @@ -367,7 +367,20 @@ LayerManagerOGL::Initialize(nsRefPtr aContext, bool force) 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;