Remove static vars from DriverInitCrashDetection. (bug 1183910 part 1, r=mattwoodrow)

This commit is contained in:
David Anderson 2015-08-11 00:29:08 -07:00
parent 6e1b40b6cd
commit eaaece49fc
2 changed files with 9 additions and 15 deletions

View File

@ -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;
}

View File

@ -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: