Chromium Code Reviews| Index: Source/core/html/canvas/WebGLRenderingContext.cpp |
| diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp |
| index 3f8e375d3e7e675fdaae90f88bce60d3dcb53f31..7e5abcc928f12510e7d3f82cba0f95523dfe5174 100644 |
| --- a/Source/core/html/canvas/WebGLRenderingContext.cpp |
| +++ b/Source/core/html/canvas/WebGLRenderingContext.cpp |
| @@ -61,6 +61,8 @@ |
| namespace blink { |
| +static bool contextShouldFail = false; |
|
Ken Russell (switch to Gerrit)
2014/11/10 19:55:28
Please name this something like shouldFailContextC
sivag
2014/11/11 12:55:15
Done.
|
| + |
| PassOwnPtrWillBeRawPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs) |
| { |
| Document& document = canvas->document(); |
| @@ -87,7 +89,7 @@ PassOwnPtrWillBeRawPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTML |
| blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(document.topDocument().url().string(), settings, 1); |
| blink::WebGLInfo glInfo; |
| OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::current()->createOffscreenGraphicsContext3D(attributes, 0, &glInfo)); |
| - if (!context) { |
| + if (!context || contextShouldFail) { |
|
Ken Russell (switch to Gerrit)
2014/11/10 19:55:28
This code path must set the "should fail" flag bac
sivag
2014/11/11 12:55:14
Done.
|
| String statusMessage("Could not create a WebGL context for VendorInfo = "); |
| statusMessage.append(glInfo.vendorInfo); |
| statusMessage.append(", RendererInfo = "); |
| @@ -182,4 +184,9 @@ void WebGLRenderingContext::trace(Visitor* visitor) |
| WebGLRenderingContextBase::trace(visitor); |
| } |
| +void WebGLRenderingContext::forceNextWebGLContextCreationToFail(bool failContext) |
|
Ken Russell (switch to Gerrit)
2014/11/10 19:55:28
Per comments on the Chromium side CL, this shouldn
sivag
2014/11/11 12:55:15
Done.
|
| +{ |
| + contextShouldFail = failContext; |
| +} |
| + |
| } // namespace blink |