Title: [138542] trunk/Source/WebCore
Revision
138542
Author
[email protected]
Date
2012-12-28 09:45:18 -0800 (Fri, 28 Dec 2012)

Log Message

[chromium] DrawingBuffer initialization loop breaks if completely out of memory
https://bugs.webkit.org/show_bug.cgi?id=105732

Patch by Brandon Jones <[email protected]> on 2012-12-28
Reviewed by Kenneth Russell.

When DrawingBuffer allocation fails because s_currentResourceUsePixels is maxed out
it now forces WebGLRenderingContext creation to fail gracefully.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::create): On Chromium, check for failure to allocate a DrawingBuffer

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138541 => 138542)


--- trunk/Source/WebCore/ChangeLog	2012-12-28 17:02:29 UTC (rev 138541)
+++ trunk/Source/WebCore/ChangeLog	2012-12-28 17:45:18 UTC (rev 138542)
@@ -1,3 +1,16 @@
+2012-12-28  Brandon Jones  <[email protected]>
+
+        [chromium] DrawingBuffer initialization loop breaks if completely out of memory
+        https://bugs.webkit.org/show_bug.cgi?id=105732
+
+        Reviewed by Kenneth Russell.
+
+        When DrawingBuffer allocation fails because s_currentResourceUsePixels is maxed out
+        it now forces WebGLRenderingContext creation to fail gracefully.
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::create): On Chromium, check for failure to allocate a DrawingBuffer
+
 2012-12-28  Dan Bernstein  <[email protected]>
 
         Slightly clean up WebCore's Base.xcconfig

Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (138541 => 138542)


--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2012-12-28 17:02:29 UTC (rev 138541)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp	2012-12-28 17:45:18 UTC (rev 138542)
@@ -438,7 +438,16 @@
     if (extensions->supports("GL_EXT_debug_marker"))
         extensions->pushGroupMarkerEXT("WebGLRenderingContext");
 
-    return adoptPtr(new WebGLRenderingContext(canvas, context, attributes));
+    OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRenderingContext(canvas, context, attributes));
+
+#if PLATFORM(CHROMIUM)
+    if (!renderingContext->m_drawingBuffer) {
+        canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context."));
+        return nullptr;
+    }
+#endif
+
+    return renderingContext.release();
 }
 
 WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, PassRefPtr<GraphicsContext3D> context,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to