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
--- 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);