Title: [93564] trunk/Source
Revision
93564
Author
[email protected]
Date
2011-08-22 17:14:13 -0700 (Mon, 22 Aug 2011)

Log Message

Make GraphicsContext3D::isResourceSafe a function and, on Chromium, determine its value lazily
https://bugs.webkit.org/show_bug.cgi?id=66708

Reviewed by Kenneth Russell.

Source/WebCore:

* platform/graphics/GraphicsContext3D.cpp:
(WebCore::GraphicsContext3D::texImage2DResourceSafe):
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/gtk/GraphicsContext3DGtk.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/mac/GraphicsContext3DMac.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::isResourceSafe):
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):

Source/WebKit/chromium:

* src/GraphicsContext3DChromium.cpp:
(WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
(WebCore::GraphicsContext3DInternal::isResourceSafe):
(WebCore::GraphicsContext3D::create):
(WebCore::GraphicsContext3D::isResourceSafe):
* src/GraphicsContext3DInternal.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93563 => 93564)


--- trunk/Source/WebCore/ChangeLog	2011-08-23 00:05:10 UTC (rev 93563)
+++ trunk/Source/WebCore/ChangeLog	2011-08-23 00:14:13 UTC (rev 93564)
@@ -1,3 +1,22 @@
+2011-08-22  Nat Duca  <[email protected]>
+
+        Make GraphicsContext3D::isResourceSafe a function and, on Chromium, determine its value lazily
+        https://bugs.webkit.org/show_bug.cgi?id=66708
+
+        Reviewed by Kenneth Russell.
+
+        * platform/graphics/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3D::texImage2DResourceSafe):
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/gtk/GraphicsContext3DGtk.cpp:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        * platform/graphics/mac/GraphicsContext3DMac.mm:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::isResourceSafe):
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+
 2011-08-22  Adam Barth  <[email protected]>
 
         HTMLSourceTracker crashes when network packets break poorly

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp (93563 => 93564)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp	2011-08-23 00:05:10 UTC (rev 93563)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp	2011-08-23 00:14:13 UTC (rev 93564)
@@ -66,7 +66,7 @@
 {
     ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8);
     OwnArrayPtr<unsigned char> zero;
-    if (!m_isResourceSafe && width > 0 && height > 0) {
+    if (!isResourceSafe() && width > 0 && height > 0) {
         unsigned int size;
         GC3Denum error = computeImageSizeInBytes(format, type, width, height, unpackAlignment, &size, 0);
         if (error != GraphicsContext3D::NO_ERROR) {

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (93563 => 93564)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2011-08-23 00:05:10 UTC (rev 93563)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2011-08-23 00:14:13 UTC (rev 93564)
@@ -905,7 +905,7 @@
 #endif
 
     int m_currentWidth, m_currentHeight;
-    bool m_isResourceSafe;
+    bool isResourceSafe();
 
 #if PLATFORM(MAC)
     CGLContextObj m_contextObj;

Modified: trunk/Source/WebCore/platform/graphics/gtk/GraphicsContext3DGtk.cpp (93563 => 93564)


--- trunk/Source/WebCore/platform/graphics/gtk/GraphicsContext3DGtk.cpp	2011-08-23 00:05:10 UTC (rev 93563)
+++ trunk/Source/WebCore/platform/graphics/gtk/GraphicsContext3DGtk.cpp	2011-08-23 00:14:13 UTC (rev 93564)
@@ -55,7 +55,6 @@
 GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow*, bool)
     : m_currentWidth(0)
     , m_currentHeight(0)
-    , m_isResourceSafe(false)
     , m_attrs(attributes)
     , m_texture(0)
     , m_fbo(0)

Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm (93563 => 93564)


--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm	2011-08-23 00:05:10 UTC (rev 93563)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm	2011-08-23 00:14:13 UTC (rev 93564)
@@ -90,7 +90,6 @@
 GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool)
     : m_currentWidth(0)
     , m_currentHeight(0)
-    , m_isResourceSafe(false)
     , m_contextObj(0)
     , m_attrs(attrs)
     , m_texture(0)

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp (93563 => 93564)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2011-08-23 00:05:10 UTC (rev 93563)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2011-08-23 00:14:13 UTC (rev 93564)
@@ -122,6 +122,11 @@
         ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO);
 }
 
+bool GraphicsContext3D::isResourceSafe()
+{
+    return false;
+}
+
 #if !PLATFORM(QT)
 void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context)
 {

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp (93563 => 93564)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2011-08-23 00:05:10 UTC (rev 93563)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2011-08-23 00:14:13 UTC (rev 93564)
@@ -293,7 +293,6 @@
 GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool)
     : m_currentWidth(0)
     , m_currentHeight(0)
-    , m_isResourceSafe(false)
     , m_attrs(attrs)
     , m_texture(0)
     , m_compositorTexture(0)

Modified: trunk/Source/WebKit/chromium/ChangeLog (93563 => 93564)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-08-23 00:05:10 UTC (rev 93563)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-08-23 00:14:13 UTC (rev 93564)
@@ -1,3 +1,17 @@
+2011-08-22  Nat Duca  <[email protected]>
+
+        Make GraphicsContext3D::isResourceSafe a function and, on Chromium, determine its value lazily
+        https://bugs.webkit.org/show_bug.cgi?id=66708
+
+        Reviewed by Kenneth Russell.
+
+        * src/GraphicsContext3DChromium.cpp:
+        (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
+        (WebCore::GraphicsContext3DInternal::isResourceSafe):
+        (WebCore::GraphicsContext3D::create):
+        (WebCore::GraphicsContext3D::isResourceSafe):
+        * src/GraphicsContext3DInternal.h:
+
 2011-08-22  Adam Klein  <[email protected]>
 
         [chromium] Remove deprecated and unused bits of WebIDB* headers

Modified: trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp (93563 => 93564)


--- trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp	2011-08-23 00:05:10 UTC (rev 93563)
+++ trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp	2011-08-23 00:14:13 UTC (rev 93564)
@@ -87,6 +87,7 @@
     : m_webViewImpl(0)
     , m_initializedAvailableExtensions(false)
     , m_layerComposited(false)
+    , m_resourceSafety(ResourceSafetyUnknown)
 #if USE(SKIA)
     , m_grContext(0)
 #elif USE(CG)
@@ -758,6 +759,13 @@
     return m_extensions.get();
 }
 
+bool GraphicsContext3DInternal::isResourceSafe()
+{
+    if (m_resourceSafety == ResourceSafetyUnknown)
+        m_resourceSafety = getExtensions()->isEnabled("GL_CHROMIUM_resource_safe") ? ResourceSafe : ResourceUnsafe;
+    return m_resourceSafety == ResourceSafe;
+}
+
 namespace {
 
 void splitStringHelper(const String& str, HashSet<String>& set)
@@ -972,7 +980,6 @@
     }
     RefPtr<GraphicsContext3D> result = adoptRef(new GraphicsContext3D(attrs, hostWindow, renderStyle == RenderDirectlyToHostWindow));
     result->m_internal = internal.release();
-    result->m_isResourceSafe = result->getExtensions()->isEnabled("GL_CHROMIUM_resource_safe");
     return result.release();
 }
 
@@ -1003,6 +1010,11 @@
     return m_internal->getInternalFramebufferSize();
 }
 
+bool GraphicsContext3D::isResourceSafe()
+{
+    return m_internal->isResourceSafe();
+}
+
 #if USE(ACCELERATED_COMPOSITING)
 PlatformLayer* GraphicsContext3D::platformLayer() const
 {

Modified: trunk/Source/WebKit/chromium/src/GraphicsContext3DInternal.h (93563 => 93564)


--- trunk/Source/WebKit/chromium/src/GraphicsContext3DInternal.h	2011-08-23 00:05:10 UTC (rev 93563)
+++ trunk/Source/WebKit/chromium/src/GraphicsContext3DInternal.h	2011-08-23 00:14:13 UTC (rev 93564)
@@ -75,6 +75,7 @@
 
     void reshape(int width, int height);
     IntSize getInternalFramebufferSize() const;
+    bool isResourceSafe();
 
     void markContextChanged();
     bool layerComposited() const;
@@ -298,6 +299,14 @@
     HashSet<String> m_enabledExtensions;
     HashSet<String> m_requestableExtensions;
     bool m_layerComposited;
+
+    enum ResourceSafety {
+        ResourceSafetyUnknown,
+        ResourceSafe,
+        ResourceUnsafe
+    };
+    ResourceSafety m_resourceSafety;
+
 #if USE(ACCELERATED_COMPOSITING)
     RefPtr<WebGLLayerChromium> m_compositingLayer;
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to