Bug 863043: Move CompositorOGL::Initialize's helper-nsRunnable from function-scope to class-scope to fix build warning about ignored visibility attribute. r=Bas

This commit is contained in:
Daniel Holbert 2013-04-17 15:34:26 -07:00
parent 80f5568437
commit ba839937c0
2 changed files with 17 additions and 9 deletions

View File

@ -311,6 +311,16 @@ CompositorOGL::CleanupResources()
mGLContext = nullptr;
}
// Impl of a a helper-runnable's "Run" method, used in Initialize()
NS_IMETHODIMP
CompositorOGL::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
CompositorOGL::Initialize()
{
@ -481,19 +491,11 @@ CompositorOGL::Initialize()
}
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());
}

View File

@ -141,6 +141,12 @@ private:
/** The size of the surface we are rendering to */
nsIntSize mSurfaceSize;
/** Helper-class used by Initialize **/
class ReadDrawFPSPref MOZ_FINAL : public nsRunnable {
public:
NS_IMETHOD Run() MOZ_OVERRIDE;
};
already_AddRefed<mozilla::gl::GLContext> CreateContext();
/** Shader Programs */