diff --git a/gfx/src/DriverInitCrashDetection.cpp b/gfx/src/DriverCrashGuard.cpp similarity index 86% rename from gfx/src/DriverInitCrashDetection.cpp rename to gfx/src/DriverCrashGuard.cpp index 02de67a7df9..65c046c6497 100644 --- a/gfx/src/DriverInitCrashDetection.cpp +++ b/gfx/src/DriverCrashGuard.cpp @@ -2,7 +2,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "DriverInitCrashDetection.h" +#include "DriverCrashGuard.h" #include "gfxPrefs.h" #include "nsAppDirectoryServiceDefs.h" #include "nsDirectoryServiceUtils.h" @@ -20,9 +20,9 @@ namespace mozilla { namespace gfx { -bool DriverInitCrashDetection::sEnvironmentHasBeenUpdated = false; +bool DriverCrashGuard::sEnvironmentHasBeenUpdated = false; -DriverInitCrashDetection::DriverInitCrashDetection() +DriverCrashGuard::DriverCrashGuard() : mIsChromeProcess(XRE_GetProcessType() == GeckoProcessType_Default) { if (!mIsChromeProcess) { @@ -56,7 +56,7 @@ DriverInitCrashDetection::DriverInitCrashDetection() RecordTelemetry(TelemetryState::Okay); } -DriverInitCrashDetection::~DriverInitCrashDetection() +DriverCrashGuard::~DriverCrashGuard() { if (mLockFile) { mLockFile->Remove(false); @@ -76,13 +76,13 @@ DriverInitCrashDetection::~DriverInitCrashDetection() } bool -DriverInitCrashDetection::DisableAcceleration() const +DriverCrashGuard::DisableAcceleration() const { return gfxPrefs::DriverInitStatus() == int32_t(DriverInitStatus::Recovered); } bool -DriverInitCrashDetection::InitLockFilePath() +DriverCrashGuard::InitLockFilePath() { NS_GetSpecialDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR, getter_AddRefs(mLockFile)); if (!mLockFile) { @@ -95,7 +95,7 @@ DriverInitCrashDetection::InitLockFilePath() } void -DriverInitCrashDetection::AllowDriverInitAttempt() +DriverCrashGuard::AllowDriverInitAttempt() { // Create a temporary tombstone/lockfile. FILE* fp; @@ -120,7 +120,7 @@ DriverInitCrashDetection::AllowDriverInitAttempt() } bool -DriverInitCrashDetection::RecoverFromDriverInitCrash() +DriverCrashGuard::RecoverFromDriverInitCrash() { bool exists; if (mLockFile && @@ -147,7 +147,7 @@ DriverInitCrashDetection::RecoverFromDriverInitCrash() } bool -DriverInitCrashDetection::UpdateEnvironment() +DriverCrashGuard::UpdateEnvironment() { mGfxInfo = services::GetGfxInfo(); @@ -185,7 +185,7 @@ DriverInitCrashDetection::UpdateEnvironment() } bool -DriverInitCrashDetection::FeatureEnabled(int aFeature) +DriverCrashGuard::FeatureEnabled(int aFeature) { int32_t status; if (!NS_SUCCEEDED(mGfxInfo->GetFeatureStatus(aFeature, &status))) { @@ -195,7 +195,7 @@ DriverInitCrashDetection::FeatureEnabled(int aFeature) } bool -DriverInitCrashDetection::CheckAndUpdateBoolPref(const char* aPrefName, bool aCurrentValue) +DriverCrashGuard::CheckAndUpdateBoolPref(const char* aPrefName, bool aCurrentValue) { bool oldValue; if (NS_SUCCEEDED(Preferences::GetBool(aPrefName, &oldValue)) && @@ -208,7 +208,7 @@ DriverInitCrashDetection::CheckAndUpdateBoolPref(const char* aPrefName, bool aCu } bool -DriverInitCrashDetection::CheckAndUpdatePref(const char* aPrefName, const nsAString& aCurrentValue) +DriverCrashGuard::CheckAndUpdatePref(const char* aPrefName, const nsAString& aCurrentValue) { nsAdoptingString oldValue = Preferences::GetString(aPrefName); if (oldValue == aCurrentValue) { @@ -219,7 +219,7 @@ DriverInitCrashDetection::CheckAndUpdatePref(const char* aPrefName, const nsAStr } void -DriverInitCrashDetection::FlushPreferences() +DriverCrashGuard::FlushPreferences() { if (nsIPrefService* prefService = Preferences::GetService()) { prefService->SavePrefFile(nullptr); @@ -227,7 +227,7 @@ DriverInitCrashDetection::FlushPreferences() } void -DriverInitCrashDetection::RecordTelemetry(TelemetryState aState) +DriverCrashGuard::RecordTelemetry(TelemetryState aState) { // Since we run this in each child process, we only want the initial results // from the chrome process. diff --git a/gfx/src/DriverInitCrashDetection.h b/gfx/src/DriverCrashGuard.h similarity index 84% rename from gfx/src/DriverInitCrashDetection.h rename to gfx/src/DriverCrashGuard.h index 0484f9e7bf5..5d3cbed1fdf 100644 --- a/gfx/src/DriverInitCrashDetection.h +++ b/gfx/src/DriverCrashGuard.h @@ -2,8 +2,8 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef gfx_src_DriverInitCrashDetection_h__ -#define gfx_src_DriverInitCrashDetection_h__ +#ifndef gfx_src_DriverCrashGuard_h__ +#define gfx_src_DriverCrashGuard_h__ #include "gfxCore.h" #include "nsCOMPtr.h" @@ -28,11 +28,11 @@ enum class DriverInitStatus Recovered }; -class DriverInitCrashDetection +class DriverCrashGuard { public: - DriverInitCrashDetection(); - ~DriverInitCrashDetection(); + DriverCrashGuard(); + ~DriverCrashGuard(); bool DisableAcceleration() const; @@ -69,5 +69,5 @@ private: } // namespace gfx } // namespace mozilla -#endif // gfx_src_DriverInitCrashDetection_h__ +#endif // gfx_src_DriverCrashGuard_h__ diff --git a/gfx/src/moz.build b/gfx/src/moz.build index 3d26b88016c..dcff3779075 100644 --- a/gfx/src/moz.build +++ b/gfx/src/moz.build @@ -14,7 +14,7 @@ XPIDL_MODULE = 'gfx' DEFINES['MOZ_APP_VERSION'] = '"%s"' % CONFIG['MOZ_APP_VERSION'] EXPORTS += [ - 'DriverInitCrashDetection.h', + 'DriverCrashGuard.h', 'FilterSupport.h', 'gfxCore.h', 'gfxCrashReporterUtils.h', @@ -54,7 +54,7 @@ if CONFIG['MOZ_X11']: ] UNIFIED_SOURCES += [ - 'DriverInitCrashDetection.cpp', + 'DriverCrashGuard.cpp', 'FilterSupport.cpp', 'gfxCrashReporterUtils.cpp', 'gfxTelemetry.cpp', diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index ddd22661372..c321b0ec3eb 100755 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -73,7 +73,7 @@ #include "gfxPrefs.h" #include "VsyncSource.h" -#include "DriverInitCrashDetection.h" +#include "DriverCrashGuard.h" #include "mozilla/dom/ContentParent.h" using namespace mozilla; @@ -2183,7 +2183,7 @@ gfxWindowsPlatform::InitializeDevices() // If we previously crashed initializing devices, bail out now. This is // effectively a parent-process only check, since the content process // cannot create a lock file. - DriverInitCrashDetection detectCrashes; + DriverCrashGuard detectCrashes; if (detectCrashes.DisableAcceleration()) { mAcceleration = FeatureStatus::Blocked; return;