Bug 1271478 - r?jmuizel - Clean up failIfMajorPerfCaveat code. draft
authorJeff Gilbert <jdashg@gmail.com>
Fri, 08 Apr 2016 15:01:42 -0700
changeset 365990 990ff8132f3b255c1f4994116f1a94d8b514f86b
parent 358327 77cead2cd20300623eea2416bc9bce4d5021df09
child 365991 37c71056817a63e31deb6eaf6d28f20cf60b38c7
push id17876
push userjgilbert@mozilla.com
push dateWed, 11 May 2016 19:35:30 +0000
reviewersjmuizel
bugs1271478
milestone49.0a1
Bug 1271478 - r?jmuizel - Clean up failIfMajorPerfCaveat code. From ecccc21b18dd31549d546f1450ebfa29e9b8335e Mon Sep 17 00:00:00 2001 --- dom/canvas/WebGLContext.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) MozReview-Commit-ID: 6YaruXVlrc6
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -838,24 +838,25 @@ WebGLContext::SetDimensions(int32_t sign
     // TODO: When we have software webgl support we should use that instead.
     disabled |= gfxPlatform::InSafeMode();
 
     if (disabled) {
         GenerateWarning("WebGL creation is disabled, and so disallowed here.");
         return NS_ERROR_FAILURE;
     }
 
-    nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
-    bool failIfMajorPerformanceCaveat =
-                    !gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat() &&
-                    !HasAcceleratedLayers(gfxInfo);
-    if (failIfMajorPerformanceCaveat) {
-        dom::Nullable<dom::WebGLContextAttributes> contextAttributes;
-        this->GetContextAttributes(contextAttributes);
-        if (contextAttributes.Value().mFailIfMajorPerformanceCaveat) {
+    bool failIfPerfCaveat = mOptions.failIfMajorPerformanceCaveat;
+    if (gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat())
+        failIfPerfCaveat = false;
+
+    if (failIfPerfCaveat) {
+        nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
+        if (!HasAcceleratedLayers(gfxInfo)) {
+            GenerateWarning("failIfMajorPerformanceCaveat: Compositor is not"
+                            " hardware-accelerated.");
             return NS_ERROR_FAILURE;
         }
     }
 
     // Alright, now let's start trying.
     bool forceEnabled = gfxPrefs::WebGLForceEnabled();
     ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);