From eaaece49fce9367529257b4cc6b7138cdb3a5aa0 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 11 Aug 2015 00:29:08 -0700 Subject: [PATCH] Remove static vars from DriverInitCrashDetection. (bug 1183910 part 1, r=mattwoodrow) --- gfx/src/DriverInitCrashDetection.cpp | 19 ++++++++----------- gfx/src/DriverInitCrashDetection.h | 5 +---- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/gfx/src/DriverInitCrashDetection.cpp b/gfx/src/DriverInitCrashDetection.cpp index b75ff6f6722..02de67a7df9 100644 --- a/gfx/src/DriverInitCrashDetection.cpp +++ b/gfx/src/DriverInitCrashDetection.cpp @@ -20,21 +20,14 @@ namespace mozilla { namespace gfx { -bool DriverInitCrashDetection::sDisableAcceleration = false; bool DriverInitCrashDetection::sEnvironmentHasBeenUpdated = false; DriverInitCrashDetection::DriverInitCrashDetection() : mIsChromeProcess(XRE_GetProcessType() == GeckoProcessType_Default) { - if (sDisableAcceleration) { - // We already disabled acceleration earlier. - return; - } - if (!mIsChromeProcess) { - // In child processes we only need to check the pref state set by the - // parent process. - sDisableAcceleration = (gfxPrefs::DriverInitStatus() == int32_t(DriverInitStatus::Recovered)); + // We assume the parent process already performed crash detection for + // graphics devices. return; } @@ -47,7 +40,6 @@ DriverInitCrashDetection::DriverInitCrashDetection() // This is the first time we're checking for a crash recovery, so print // a message and disable acceleration for anyone who asks for it. gfxCriticalError(CriticalLog::DefaultOptions(false)) << "Recovered from graphics driver startup crash; acceleration disabled."; - sDisableAcceleration = true; return; } @@ -83,6 +75,12 @@ DriverInitCrashDetection::~DriverInitCrashDetection() } } +bool +DriverInitCrashDetection::DisableAcceleration() const +{ + return gfxPrefs::DriverInitStatus() == int32_t(DriverInitStatus::Recovered); +} + bool DriverInitCrashDetection::InitLockFilePath() { @@ -183,7 +181,6 @@ DriverInitCrashDetection::UpdateEnvironment() // Finally, mark as changed if the status has been reset by the user. changed |= (gfxPrefs::DriverInitStatus() == int32_t(DriverInitStatus::None)); - mGfxInfo = nullptr; return changed; } diff --git a/gfx/src/DriverInitCrashDetection.h b/gfx/src/DriverInitCrashDetection.h index dab79c9f7c7..0484f9e7bf5 100644 --- a/gfx/src/DriverInitCrashDetection.h +++ b/gfx/src/DriverInitCrashDetection.h @@ -34,9 +34,7 @@ public: DriverInitCrashDetection(); ~DriverInitCrashDetection(); - bool DisableAcceleration() const { - return sDisableAcceleration; - } + bool DisableAcceleration() const; // These are the values reported to Telemetry (GRAPHICS_DRIVER_STARTUP_TEST). // Values should not change; add new values to the end. @@ -60,7 +58,6 @@ private: void RecordTelemetry(TelemetryState aState); private: - static bool sDisableAcceleration; static bool sEnvironmentHasBeenUpdated; private: