Bug 859517: Move LayerManagerOGL::Initialize's helper-nsRunnable from function-scope to class-scope to fix build warning about ignored visibility attribute. r=BenWa
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 08 Apr 2013 15:06:28 -0700
changeset 128066 1b86d1d851def3e223bdefb8aa46d76f92a9dc7f
parent 128065 53268e47c77948a22c46aa6801faf977edc94ad5
child 128067 9bda607c832db0a3086e028c75a8b2d758e93800
push id24520
push useremorley@mozilla.com
push dateTue, 09 Apr 2013 09:06:14 +0000
treeherdermozilla-central@d09a5a5666ba [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa
bugs859517
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
gfx/layers/opengl/LayerManagerOGL.h
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -481,16 +481,26 @@ LayerManagerOGL::AddPrograms(ShaderProgr
       mPrograms[aType].mVariations[maskType] = new ShaderProgramOGL(this->gl(),
         ProgramProfileOGL::GetProfileFor(aType, static_cast<MaskType>(maskType)));
     } else {
       mPrograms[aType].mVariations[maskType] = nullptr;
     }
   }
 }
 
+// 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<GLContext> aContext, bool force)
 {
   ScopedGfxFeatureReporter reporter("GL Layers", force);
 
   // Do not allow double initialization
   NS_ABORT_IF_FALSE(mGLContext == nullptr, "Don't reinitialize layer managers");
 
@@ -662,29 +672,21 @@ LayerManagerOGL::Initialize(nsRefPtr<GLC
     if (mFBOTextureTarget == LOCAL_GL_TEXTURE_2D)
       msg += NS_LITERAL_STRING("TEXTURE_2D");
     else
       msg += NS_LITERAL_STRING("TEXTURE_RECTANGLE");
     console->LogStringMessage(msg.get());
   }
 
   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());
   }
 
   mComposer2D = mWidget->GetComposer2D();
 
   reporter.SetSuccessful();
   return true;
 }
--- a/gfx/layers/opengl/LayerManagerOGL.h
+++ b/gfx/layers/opengl/LayerManagerOGL.h
@@ -366,16 +366,22 @@ private:
 
   /**
    * When rendering to an EGL surface (e.g. on Android), we rely on being told
    * about size changes (via SetSurfaceSize) rather than pulling this information
    * from the widget, since the widget's information can lag behind.
    */
   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;
 
   /**
    * Render the current layer tree to the active target.
    */
   void Render();