From a0a4661570862735ad6c2c2fcbd1175eb8d7fe15 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Mon, 8 Apr 2013 15:06:28 -0700 Subject: [PATCH] Bug 859517: Move LayerManagerOGL::Initialize's helper-nsRunnable from function-scope to class-scope to fix build warning about ignored visibility attribute. r=BenWa --- gfx/layers/opengl/LayerManagerOGL.cpp | 20 +++++++++++--------- gfx/layers/opengl/LayerManagerOGL.h | 6 ++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gfx/layers/opengl/LayerManagerOGL.cpp b/gfx/layers/opengl/LayerManagerOGL.cpp index 3b4efa021a91..e0ed29f5bd30 100644 --- a/gfx/layers/opengl/LayerManagerOGL.cpp +++ b/gfx/layers/opengl/LayerManagerOGL.cpp @@ -486,6 +486,16 @@ LayerManagerOGL::AddPrograms(ShaderProgramType aType) } } +// Impl of a a helper-runnable's "Run" method, used in Initialize() +NS_IMETHODIMP +LayerManagerOGL::ReadDrawFPSPref::Run() +{ + // NOTE: This must match the code in Initialize()'s NS_IsMainThread check. + Preferences::AddBoolVarCache(&sDrawFPS, "layers.acceleration.draw-fps"); + Preferences::AddBoolVarCache(&sFrameCounter, "layers.acceleration.frame-counter"); + return NS_OK; +} + bool LayerManagerOGL::Initialize(nsRefPtr aContext, bool force) { @@ -667,19 +677,11 @@ LayerManagerOGL::Initialize(nsRefPtr aContext, bool force) } if (NS_IsMainThread()) { + // NOTE: This must match the code in ReadDrawFPSPref::Run(). Preferences::AddBoolVarCache(&sDrawFPS, "layers.acceleration.draw-fps"); Preferences::AddBoolVarCache(&sFrameCounter, "layers.acceleration.frame-counter"); } 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"); - Preferences::AddBoolVarCache(&sFrameCounter, "layers.acceleration.frame-counter"); - return NS_OK; - } - }; NS_DispatchToMainThread(new ReadDrawFPSPref()); } diff --git a/gfx/layers/opengl/LayerManagerOGL.h b/gfx/layers/opengl/LayerManagerOGL.h index 4bba11eca6dd..72bca17a1af0 100644 --- a/gfx/layers/opengl/LayerManagerOGL.h +++ b/gfx/layers/opengl/LayerManagerOGL.h @@ -371,6 +371,12 @@ private: */ bool mIsRenderingToEGLSurface; + /** Helper-class used by Initialize **/ + class ReadDrawFPSPref MOZ_FINAL : public nsRunnable { + public: + NS_IMETHOD Run() MOZ_OVERRIDE; + }; + /** Current root layer. */ LayerOGL *RootLayer() const;