Bug 717958 - Always read FPS pref on the main thread with OMTC. r=ajuma

This commit is contained in:
Benoit Girard 2012-03-05 14:02:22 -05:00
parent 191929071f
commit f9eaee1ae0

View File

@ -367,7 +367,20 @@ LayerManagerOGL::Initialize(nsRefPtr<GLContext> 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;