Bug 822115 - nglayout.debug.widget_update_flashing pref cache is not thread safe. r=mattwoodrow

This commit is contained in:
Oleg Romashin 2012-12-16 11:25:04 -08:00
parent f440c12fc5
commit 09597e2391
3 changed files with 7 additions and 10 deletions

View File

@ -629,16 +629,7 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
void
BasicLayerManager::FlashWidgetUpdateArea(gfxContext *aContext)
{
static bool sWidgetFlashingEnabled;
static bool sWidgetFlashingPrefCached = false;
if (!sWidgetFlashingPrefCached) {
sWidgetFlashingPrefCached = true;
mozilla::Preferences::AddBoolVarCache(&sWidgetFlashingEnabled,
"nglayout.debug.widget_update_flashing");
}
if (sWidgetFlashingEnabled) {
if (gfxPlatform::GetPlatform()->WidgetUpdateFlashing()) {
float r = float(rand()) / RAND_MAX;
float g = float(rand()) / RAND_MAX;
float b = float(rand()) / RAND_MAX;

View File

@ -340,6 +340,9 @@ gfxPlatform::Init()
gPlatform->mWorkAroundDriverBugs = Preferences::GetBool("gfx.work-around-driver-bugs", true);
mozilla::Preferences::AddBoolVarCache(&gPlatform->mWidgetUpdateFlashing,
"nglayout.debug.widget_update_flashing");
mozilla::gl::GLContext::PlatformStartup();
#ifdef MOZ_WIDGET_ANDROID

View File

@ -493,6 +493,8 @@ public:
virtual int GetScreenDepth() const;
bool WidgetUpdateFlashing() const { return mWidgetUpdateFlashing; }
protected:
gfxPlatform();
virtual ~gfxPlatform();
@ -586,6 +588,7 @@ private:
bool mWorkAroundDriverBugs;
mozilla::RefPtr<mozilla::gfx::DrawEventRecorder> mRecorder;
bool mWidgetUpdateFlashing;
};
#endif /* GFX_PLATFORM_H */