Rename DriverInitCrashDetection to DriverCrashGuard. (bug 1190281 part 2, r=mattwoodrow)
☠☠ backed out by 70c553b37c19 ☠ ☠
authorDavid Anderson <danderson@mozilla.com>
Tue, 11 Aug 2015 00:29:08 -0700
changeset 291477 e98a176b4e0b68ed6fd5fc0bd74208dc8fef525c
parent 291476 e7b3b23bcc8286d117bf07f78b2b7d91af610960
child 291478 cf98685302b69af5492477fa3e4434317b9db885
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1190281
milestone43.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
Rename DriverInitCrashDetection to DriverCrashGuard. (bug 1190281 part 2, r=mattwoodrow)
gfx/src/DriverCrashGuard.cpp
gfx/src/DriverCrashGuard.h
gfx/src/DriverInitCrashDetection.cpp
gfx/src/DriverInitCrashDetection.h
gfx/src/moz.build
gfx/thebes/gfxWindowsPlatform.cpp
rename from gfx/src/DriverInitCrashDetection.cpp
rename to gfx/src/DriverCrashGuard.cpp
--- a/gfx/src/DriverInitCrashDetection.cpp
+++ b/gfx/src/DriverCrashGuard.cpp
@@ -1,13 +1,13 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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"
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #endif
 #include "nsServiceManagerUtils.h"
 #include "nsString.h"
@@ -15,19 +15,19 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Services.h"
 #include "mozilla/gfx/Logging.h"
 
 namespace mozilla {
 namespace gfx {
 
-bool DriverInitCrashDetection::sEnvironmentHasBeenUpdated = false;
+bool DriverCrashGuard::sEnvironmentHasBeenUpdated = false;
 
-DriverInitCrashDetection::DriverInitCrashDetection()
+DriverCrashGuard::DriverCrashGuard()
  : mIsChromeProcess(XRE_GetProcessType() == GeckoProcessType_Default)
 {
   if (!mIsChromeProcess) {
     // We assume the parent process already performed crash detection for
     // graphics devices.
     return;
   }
 
@@ -51,17 +51,17 @@ DriverInitCrashDetection::DriverInitCras
     AllowDriverInitAttempt();
     sEnvironmentHasBeenUpdated = true;
     return;
   }
 
   RecordTelemetry(TelemetryState::Okay);
 }
 
-DriverInitCrashDetection::~DriverInitCrashDetection()
+DriverCrashGuard::~DriverCrashGuard()
 {
   if (mLockFile) {
     mLockFile->Remove(false);
   }
 
   if (gfxPrefs::DriverInitStatus() == int32_t(DriverInitStatus::Attempting)) {
     // If we attempted to initialize the driver, and got this far without
     // crashing, assume everything is okay.
@@ -71,36 +71,36 @@ DriverInitCrashDetection::~DriverInitCra
     // Remove the crash report annotation.
     CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
                                        NS_LITERAL_CSTRING(""));
 #endif
   }
 }
 
 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) {
     return false;
   }
   if (!NS_SUCCEEDED(mLockFile->AppendNative(NS_LITERAL_CSTRING("gfxinit.lock")))) {
     return false;
   }
   return true;
 }
 
 void
-DriverInitCrashDetection::AllowDriverInitAttempt()
+DriverCrashGuard::AllowDriverInitAttempt()
 {
   // Create a temporary tombstone/lockfile.
   FILE* fp;
   if (!NS_SUCCEEDED(mLockFile->OpenANSIFileDesc("w", &fp))) {
     return;
   }
   fclose(fp);
 
@@ -115,17 +115,17 @@ DriverInitCrashDetection::AllowDriverIni
 
 #ifdef MOZ_CRASHREPORTER
   CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
                                      NS_LITERAL_CSTRING("1"));
 #endif
 }
 
 bool
-DriverInitCrashDetection::RecoverFromDriverInitCrash()
+DriverCrashGuard::RecoverFromDriverInitCrash()
 {
   bool exists;
   if (mLockFile &&
       NS_SUCCEEDED(mLockFile->Exists(&exists)) &&
       exists)
   {
     // If we get here, we've just recovered from a crash. Disable acceleration
     // until the environment changes. Since we may have crashed before
@@ -142,17 +142,17 @@ DriverInitCrashDetection::RecoverFromDri
     // disabled acceleration.
     RecordTelemetry(TelemetryState::AccelerationDisabled);
     return true;
   }
   return false;
 }
 
 bool
-DriverInitCrashDetection::UpdateEnvironment()
+DriverCrashGuard::UpdateEnvironment()
 {
   mGfxInfo = services::GetGfxInfo();
 
   bool changed = false;
   if (mGfxInfo) {
     nsString value;
 
     // Driver properties.
@@ -180,59 +180,59 @@ DriverInitCrashDetection::UpdateEnvironm
 
   // Finally, mark as changed if the status has been reset by the user.
   changed |= (gfxPrefs::DriverInitStatus() == int32_t(DriverInitStatus::None));
 
   return changed;
 }
 
 bool
-DriverInitCrashDetection::FeatureEnabled(int aFeature)
+DriverCrashGuard::FeatureEnabled(int aFeature)
 {
   int32_t status;
   if (!NS_SUCCEEDED(mGfxInfo->GetFeatureStatus(aFeature, &status))) {
     return false;
   }
   return status == nsIGfxInfo::FEATURE_STATUS_OK;
 }
 
 bool
-DriverInitCrashDetection::CheckAndUpdateBoolPref(const char* aPrefName, bool aCurrentValue)
+DriverCrashGuard::CheckAndUpdateBoolPref(const char* aPrefName, bool aCurrentValue)
 {
   bool oldValue;
   if (NS_SUCCEEDED(Preferences::GetBool(aPrefName, &oldValue)) &&
       oldValue == aCurrentValue)
   {
     return false;
   }
   Preferences::SetBool(aPrefName, aCurrentValue);
   return true;
 }
 
 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) {
     return false;
   }
   Preferences::SetString(aPrefName, aCurrentValue);
   return true;
 }
 
 void
-DriverInitCrashDetection::FlushPreferences()
+DriverCrashGuard::FlushPreferences()
 {
   if (nsIPrefService* prefService = Preferences::GetService()) {
     prefService->SavePrefFile(nullptr);
   }
 }
 
 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.
   if (XRE_GetProcessType() != GeckoProcessType_Default) {
     return;
   }
 
   // Since we instantiate this class more than once, make sure we only record
rename from gfx/src/DriverInitCrashDetection.h
rename to gfx/src/DriverCrashGuard.h
--- a/gfx/src/DriverInitCrashDetection.h
+++ b/gfx/src/DriverCrashGuard.h
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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"
 #include "nsIGfxInfo.h"
 #include "nsIFile.h"
 
 namespace mozilla {
 namespace gfx {
@@ -23,21 +23,21 @@ enum class DriverInitStatus
 
   // Drivers were successfully initialized last run.
   Okay,
 
   // We crashed during driver initialization, and have restarted.
   Recovered
 };
 
-class DriverInitCrashDetection
+class DriverCrashGuard
 {
 public:
-  DriverInitCrashDetection();
-  ~DriverInitCrashDetection();
+  DriverCrashGuard();
+  ~DriverCrashGuard();
 
   bool DisableAcceleration() const;
 
   // These are the values reported to Telemetry (GRAPHICS_DRIVER_STARTUP_TEST).
   // Values should not change; add new values to the end.
   enum class TelemetryState {
     Okay = 0,
     EnvironmentChanged = 1,
@@ -64,10 +64,10 @@ private:
   bool mIsChromeProcess;
   nsCOMPtr<nsIGfxInfo> mGfxInfo;
   nsCOMPtr<nsIFile> mLockFile;
 };
 
 } // namespace gfx
 } // namespace mozilla
 
-#endif // gfx_src_DriverInitCrashDetection_h__
+#endif // gfx_src_DriverCrashGuard_h__
 
--- a/gfx/src/moz.build
+++ b/gfx/src/moz.build
@@ -9,17 +9,17 @@ XPIDL_SOURCES += [
     'nsIScriptableRegion.idl',
 ]
 
 XPIDL_MODULE = 'gfx'
 
 DEFINES['MOZ_APP_VERSION'] = '"%s"' % CONFIG['MOZ_APP_VERSION']
 
 EXPORTS += [
-    'DriverInitCrashDetection.h',
+    'DriverCrashGuard.h',
     'FilterSupport.h',
     'gfxCore.h',
     'gfxCrashReporterUtils.h',
     'gfxTelemetry.h',
     'nsBoundingMetrics.h',
     'nsColor.h',
     'nsColorNameList.h',
     'nsColorNames.h',
@@ -49,17 +49,17 @@ EXPORTS.mozilla.gfx += [
 
 if CONFIG['MOZ_X11']:
     EXPORTS.mozilla += ['X11Util.h']
     SOURCES += [
         'X11Util.cpp',
     ]
 
 UNIFIED_SOURCES += [
-    'DriverInitCrashDetection.cpp',
+    'DriverCrashGuard.cpp',
     'FilterSupport.cpp',
     'gfxCrashReporterUtils.cpp',
     'gfxTelemetry.cpp',
     'nsColor.cpp',
     'nsFont.cpp',
     'nsFontMetrics.cpp',
     'nsRect.cpp',
     'nsRegion.cpp',
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -68,17 +68,17 @@
 #include "nsIMemoryReporter.h"
 #include <winternl.h>
 #include "d3dkmtQueryStatistics.h"
 
 #include "SurfaceCache.h"
 #include "gfxPrefs.h"
 
 #include "VsyncSource.h"
-#include "DriverInitCrashDetection.h"
+#include "DriverCrashGuard.h"
 #include "mozilla/dom/ContentParent.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::layers;
 using namespace mozilla::widget;
 using namespace mozilla::image;
 
@@ -2178,17 +2178,17 @@ gfxWindowsPlatform::InitializeDevices()
   mAcceleration = CheckAccelerationSupport();
   if (IsFeatureStatusFailure(mAcceleration)) {
     return;
   }
 
   // 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;
   }
 
   // If we're going to prefer D3D9, stop here. The rest of this function
   // attempts to use D3D11 features.
   if (gfxPrefs::LayersPreferD3D9()) {