Associate URLs with GraphicsContext3D instances created for WebGL
authorkbr@google.com <kbr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Dec 2012 02:49:07 +0000 (02:49 +0000)
committerkbr@google.com <kbr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Dec 2012 02:49:07 +0000 (02:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=103793

Reviewed by Adam Barth.

Source/Platform:

* Platform.gyp/Platform.gyp:
    Allow WebURL.h to be included directly or indirectly from Platform.h.
* chromium/public/WebGraphicsContext3D.h:
(Attributes):
    Add top document's URL to context creation attributes.

Source/WebCore:

Pass down the URL of the topmost frame's document creating the
WebGL context to the platform layer through
GraphicsContext3D::Attributes.

Not feasible to write a layout test for this change; has no
user-visible effect. Tested manually with failure injection in
Chromium port.

* html/canvas/WebGLRenderingContext.cpp:
(WebCore):
(WebCore::WebGLRenderingContext::create):
    Pass top document's URL in context creation attributes.
* platform/chromium/support/GraphicsContext3DChromium.cpp:
(WebCore::GraphicsContext3D::create):
    Pass URL through WebKit API.
* platform/graphics/GraphicsContext3D.h:
(Attributes):
    Add top document's URL to context creation attributes.

Source/WebKit/chromium:

* WebKit.gyp:
    Allow WebURL.h to be included directly or indirectly from Platform.h.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136609 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/Platform/ChangeLog
Source/Platform/Platform.gyp/Platform.gyp
Source/Platform/chromium/public/WebGraphicsContext3D.h
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/WebGLRenderingContext.cpp
Source/WebCore/platform/chromium/support/GraphicsContext3DChromium.cpp
Source/WebCore/platform/graphics/GraphicsContext3D.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp

index d06c331..0210d7b 100644 (file)
@@ -1,3 +1,16 @@
+2012-12-04  Kenneth Russell  <kbr@google.com>
+
+        Associate URLs with GraphicsContext3D instances created for WebGL
+        https://bugs.webkit.org/show_bug.cgi?id=103793
+
+        Reviewed by Adam Barth.
+
+        * Platform.gyp/Platform.gyp:
+            Allow WebURL.h to be included directly or indirectly from Platform.h.
+        * chromium/public/WebGraphicsContext3D.h:
+        (Attributes):
+            Add top document's URL to context creation attributes.
+
 2012-12-04  Glenn Hartmann  <hartmanng@chromium.org>
 
         Gut WebRenderingStats since we no longer use its member variables.
index c8f1f1f..834b2a2 100644 (file)
@@ -40,6 +40,7 @@
             'dependencies': [
                 '../../WTF/WTF.gyp/WTF.gyp:wtf',
                 '<(DEPTH)/skia/skia.gyp:skia',
+                '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl',
             ],
             'include_dirs': [
                 '../chromium',
@@ -76,6 +77,9 @@
                     '<(output_dir)'
                 ],
             },
+            'export_dependent_settings': [
+                '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl',
+            ],
             'conditions': [
                 ['inside_chromium_build==1', {
                     'conditions': [
index 8f311cc..b96c1ac 100644 (file)
@@ -36,6 +36,7 @@
 #include "WebGraphicsMemoryStats.h"
 #include "WebNonCopyable.h"
 #include "WebString.h"
+#include "WebURL.h"
 
 #define USE_WGC3D_TYPES
 
@@ -109,6 +110,7 @@ public:
         bool shareResources;
         bool preferDiscreteGPU;
         bool noAutomaticFlushes;
+        WebURL topDocumentURL;
     };
 
     class WebGraphicsContextLostCallback {
index e5fc803..f4da6e5 100644 (file)
@@ -1,3 +1,29 @@
+2012-12-04  Kenneth Russell  <kbr@google.com>
+
+        Associate URLs with GraphicsContext3D instances created for WebGL
+        https://bugs.webkit.org/show_bug.cgi?id=103793
+
+        Reviewed by Adam Barth.
+
+        Pass down the URL of the topmost frame's document creating the
+        WebGL context to the platform layer through
+        GraphicsContext3D::Attributes.
+
+        Not feasible to write a layout test for this change; has no
+        user-visible effect. Tested manually with failure injection in
+        Chromium port.
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore):
+        (WebCore::WebGLRenderingContext::create):
+            Pass top document's URL in context creation attributes.
+        * platform/chromium/support/GraphicsContext3DChromium.cpp:
+        (WebCore::GraphicsContext3D::create):
+            Pass URL through WebKit API.
+        * platform/graphics/GraphicsContext3D.h:
+        (Attributes):
+            Add top document's URL to context creation attributes.
+
 2012-12-04  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: simplify reportMemoryUsage signature
index 5a8dc95..dbac448 100644 (file)
@@ -425,7 +425,7 @@ PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen
     attributes.shareResources = false;
 #endif
     attributes.preferDiscreteGPU = true;
-
+    attributes.topDocumentURL = document->topDocument()->url();
 
     RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attributes, hostWindow));
 
index f8e46d8..7ebedb4 100644 (file)
@@ -76,6 +76,7 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attri
     webAttributes.noExtensions = attrs.noExtensions;
     webAttributes.shareResources = attrs.shareResources;
     webAttributes.preferDiscreteGPU = attrs.preferDiscreteGPU;
+    webAttributes.topDocumentURL = attrs.topDocumentURL;
 
     OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::Platform::current()->createOffscreenGraphicsContext3D(webAttributes));
     if (!webContext)
index 95eea7a..994c073 100644 (file)
 #ifndef GraphicsContext3D_h
 #define GraphicsContext3D_h
 
+#include "GraphicsTypes3D.h"
 #include "Image.h"
 #include "IntRect.h"
-#include "GraphicsTypes3D.h"
+#include "KURL.h"
 #include "PlatformLayer.h"
 #include <wtf/HashMap.h>
 #include <wtf/ListHashSet.h>
@@ -459,6 +460,7 @@ public:
         bool noExtensions;
         bool shareResources;
         bool preferDiscreteGPU;
+        KURL topDocumentURL;
     };
 
     enum RenderStyle {
index e1317d1..3110ef3 100644 (file)
@@ -1,3 +1,13 @@
+2012-12-04  Kenneth Russell  <kbr@google.com>
+
+        Associate URLs with GraphicsContext3D instances created for WebGL
+        https://bugs.webkit.org/show_bug.cgi?id=103793
+
+        Reviewed by Adam Barth.
+
+        * WebKit.gyp:
+            Allow WebURL.h to be included directly or indirectly from Platform.h.
+
 2012-12-04  Adam Barth  <abarth@webkit.org>
 
         [V8] Cleanup style in V8DOMWrapper
index cb153ea..77acebe 100644 (file)
             'type': 'static_library',
             'dependencies': [
                 '../../WTF/WTF.gyp/WTF.gyp:wtf',
+                '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl',
             ],
             'defines': [
                 'WEBKIT_IMPLEMENTATION=1',