Bug 1149864 - Do not attempt to create any D3D11 device when safemode is turned on. r=jrmuizel, a=sledru
authorBas Schouten <bschouten@mozilla.com>
Wed, 01 Apr 2015 19:45:58 +0200
changeset 258219 c4e7a4be6f63
parent 258218 cf2036567077
child 258220 d7bbef9132a4
push id4622
push userryanvm@gmail.com
push date2015-04-02 21:26 +0000
treeherdermozilla-beta@d7bbef9132a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, sledru
bugs1149864
milestone38.0
Bug 1149864 - Do not attempt to create any D3D11 device when safemode is turned on. r=jrmuizel, a=sledru
gfx/thebes/gfxWindowsPlatform.cpp
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1801,17 +1801,27 @@ gfxWindowsPlatform::InitD3D11Devices()
   // is not blacklisted for D3D11 layers. This will first attempt to create a
   // hardware accelerated device. If this creation fails or the hardware is
   // blacklisted, then this function will abort if WARP is disabled, causing us
   // to fallback to D3D9 or Basic layers. If WARP is not disabled it will use
   // a WARP device which should always be available on Windows 7 and higher.
 
   mD3D11DeviceInitialized = true;
 
-  MOZ_ASSERT(!mD3D11Device);
+  MOZ_ASSERT(!mD3D11Device); 
+
+  bool safeMode = false;
+  nsCOMPtr<nsIXULRuntime> xr = do_GetService("@mozilla.org/xre/runtime;1");
+  if (xr) {
+    xr->GetInSafeMode(&safeMode);
+  }
+
+  if (safeMode) {
+    return;
+  }
 
   bool useWARP = false;
   ScopedGfxFeatureReporter reporterWARP("D3D11-WARP", gfxPrefs::LayersD3D11ForceWARP());
 
   nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
   if (gfxInfo) {
     int32_t status;
     if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, &status))) {