Title: [156282] trunk
Revision
156282
Author
[email protected]
Date
2013-09-23 12:02:44 -0700 (Mon, 23 Sep 2013)

Log Message

[Texmap] Reloading a webgl page doesn't work
https://bugs.webkit.org/show_bug.cgi?id=120593

Reviewed by Noam Rosenthal.

Source/WebCore:

Let GraphicsLayerTextureMapper know it needs to detach the platform layer when a GraphicsContext3D is destroyed.

Test: fast/canvas/webgl/webgl-reload-crash.html

* platform/graphics/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
* platform/graphics/texmap/GraphicsLayerTextureMapper.h:
* platform/graphics/texmap/TextureMapperPlatformLayer.h:

LayoutTests:

Add a new test case to check if a crash occurs while reloading a page which contains webgl.

* fast/canvas/webgl/webgl-reload-crash-expected.txt: Added.
* fast/canvas/webgl/webgl-reload-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (156281 => 156282)


--- trunk/LayoutTests/ChangeLog	2013-09-23 18:21:24 UTC (rev 156281)
+++ trunk/LayoutTests/ChangeLog	2013-09-23 19:02:44 UTC (rev 156282)
@@ -1,3 +1,15 @@
+2013-09-23  ChangSeok Oh  <[email protected]>
+
+        [Texmap] Reloading a webgl page doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=120593
+
+        Reviewed by Noam Rosenthal.
+
+        Add a new test case to check if a crash occurs while reloading a page which contains webgl.
+
+        * fast/canvas/webgl/webgl-reload-crash-expected.txt: Added.
+        * fast/canvas/webgl/webgl-reload-crash.html: Added.
+
 2013-09-23  Alexey Proskuryakov  <[email protected]>
 
         Audio object garbage collection is incorrect (media/audio-garbage-collect.html test is flaky)

Added: trunk/LayoutTests/fast/canvas/webgl/webgl-reload-crash-expected.txt (0 => 156282)


--- trunk/LayoutTests/fast/canvas/webgl/webgl-reload-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-reload-crash-expected.txt	2013-09-23 19:02:44 UTC (rev 156282)
@@ -0,0 +1,2 @@
+PASS. You didn't crash.
+

Added: trunk/LayoutTests/fast/canvas/webgl/webgl-reload-crash.html (0 => 156282)


--- trunk/LayoutTests/fast/canvas/webgl/webgl-reload-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-reload-crash.html	2013-09-23 19:02:44 UTC (rev 156282)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <script src="" </script>
+    <script>
+    function runTest()
+    {
+      if (sessionStorage.count == 10) {
+        delete sessionStorage.count;
+        if (window.testRunner)
+          testRunner.notifyDone();
+      } else {
+        var canvas = document.getElementById('webgl-canvas');
+        var gl = WebGLTestUtils.create3DContext(canvas);
+        gl.clearColor(1, 0, 0, 1);
+        gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+
+        canvas.width = canvas.clientWidth;
+        canvas.height = canvas.clientHeight;
+
+        if (!sessionStorage.count)
+          sessionStorage.count = 0;
+        sessionStorage.count++;
+
+        setTimeout(function() { location.reload(); }, 0);
+      }
+    }
+    if (window.testRunner) {
+      testRunner.dumpAsText();
+      testRunner.overridePreference("WebKitAcceleratedCompositingEnabled", "1");
+      testRunner.overridePreference("WebKitWebGLEnabled", "1");
+      testRunner.waitUntilDone();
+    }
+
+    window._onpageshow_ = runTest;
+    </script>
+  </head>
+  <body>
+    <div>PASS. You didn't crash.</div>
+    <canvas id="webgl-canvas" width="100px" height="100px"></canvas>
+  </body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (156281 => 156282)


--- trunk/Source/WebCore/ChangeLog	2013-09-23 18:21:24 UTC (rev 156281)
+++ trunk/Source/WebCore/ChangeLog	2013-09-23 19:02:44 UTC (rev 156282)
@@ -1,3 +1,19 @@
+2013-09-23  ChangSeok Oh  <[email protected]>
+
+        [Texmap] Reloading a webgl page doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=120593
+
+        Reviewed by Noam Rosenthal.
+
+        Let GraphicsLayerTextureMapper know it needs to detach the platform layer when a GraphicsContext3D is destroyed.
+
+        Test: fast/canvas/webgl/webgl-reload-crash.html
+
+        * platform/graphics/GraphicsContext3DPrivate.cpp:
+        (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
+        * platform/graphics/texmap/TextureMapperPlatformLayer.h:
+
 2013-09-23  Antti Koivisto  <[email protected]>
 
         Remove RenderObjectChildList

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp (156281 => 156282)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp	2013-09-23 18:21:24 UTC (rev 156281)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp	2013-09-23 19:02:44 UTC (rev 156282)
@@ -75,6 +75,8 @@
 
 GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
 {
+    if (client())
+        client()->platformLayerWillBeDestroyed();
 }
 
 bool GraphicsContext3DPrivate::makeContextCurrent()

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (156281 => 156282)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2013-09-23 18:21:24 UTC (rev 156281)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2013-09-23 19:02:44 UTC (rev 156282)
@@ -112,6 +112,7 @@
     void prepareBackingStoreIfNeeded();
     bool shouldHaveBackingStore() const;
 
+    virtual void platformLayerWillBeDestroyed() OVERRIDE { setContentsToMedia(0); }
     virtual void setPlatformLayerNeedsDisplay() OVERRIDE { setContentsNeedsDisplay(); }
 
     // This set of flags help us defer which properties of the layer have been

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h (156281 => 156282)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h	2013-09-23 18:21:24 UTC (rev 156281)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h	2013-09-23 19:02:44 UTC (rev 156282)
@@ -33,6 +33,7 @@
 public:
     class Client {
     public:
+        virtual void platformLayerWillBeDestroyed() = 0;
         virtual void setPlatformLayerNeedsDisplay() = 0;
     };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to