From 09597e239131046e8de53779b19b4fb9be906be1 Mon Sep 17 00:00:00 2001 From: Oleg Romashin Date: Sun, 16 Dec 2012 11:25:04 -0800 Subject: [PATCH] Bug 822115 - nglayout.debug.widget_update_flashing pref cache is not thread safe. r=mattwoodrow --- gfx/layers/basic/BasicLayerManager.cpp | 11 +---------- gfx/thebes/gfxPlatform.cpp | 3 +++ gfx/thebes/gfxPlatform.h | 3 +++ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index 290af04d2d40..ca13ba773e60 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -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; diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 952053e3e6a3..2f5c52e02a75 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -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 diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index 6db40f796939..99badcf7b4dd 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -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 mRecorder; + bool mWidgetUpdateFlashing; }; #endif /* GFX_PLATFORM_H */