Title: [98185] trunk/Source
Revision
98185
Author
nd...@chromium.org
Date
2011-10-21 20:15:41 -0700 (Fri, 21 Oct 2011)

Log Message

[chromium] Make setVisibility extension- and thread-correct
https://bugs.webkit.org/show_bug.cgi?id=70635

Reviewed by Kenneth Russell.

Source/WebCore:

* platform/graphics/chromium/Extensions3DChromium.h:
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::initialize):
(WebCore::LayerRendererChromium::setVisible):
* platform/graphics/chromium/LayerRendererChromium.h:
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(WebCore::LayerRendererCapabilities::LayerRendererCapabilities):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::setVisible):

Source/WebKit/chromium:

* public/WebGraphicsContext3D.h:
(WebKit::WebGraphicsContext3D::setVisibilityCHROMIUM):
* src/Extensions3DChromium.cpp:
(WebCore::Extensions3DChromium::setVisibilityCHROMIUM):
* src/GraphicsContext3DChromium.cpp:
* src/GraphicsContext3DPrivate.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::setVisibilityState):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98184 => 98185)


--- trunk/Source/WebCore/ChangeLog	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebCore/ChangeLog	2011-10-22 03:15:41 UTC (rev 98185)
@@ -1,3 +1,20 @@
+2011-10-21  Nat Duca  <nd...@chromium.org>
+
+        [chromium] Make setVisibility extension- and thread-correct
+        https://bugs.webkit.org/show_bug.cgi?id=70635
+
+        Reviewed by Kenneth Russell.
+
+        * platform/graphics/chromium/Extensions3DChromium.h:
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::initialize):
+        (WebCore::LayerRendererChromium::setVisible):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (WebCore::LayerRendererCapabilities::LayerRendererCapabilities):
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+        (WebCore::CCLayerTreeHostImpl::setVisible):
+
 2011-10-21  Beth Dakin  <bda...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=70647

Modified: trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h (98184 => 98185)


--- trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h	2011-10-22 03:15:41 UTC (rev 98185)
@@ -70,6 +70,9 @@
     void* mapTexSubImage2DCHROMIUM(unsigned target, int level, int xoffset, int yoffset, int width, int height, unsigned format, unsigned type, unsigned access);
     void unmapTexSubImage2DCHROMIUM(const void*);
 
+    // GL_CHROMIUM_set_visibility
+    void setVisibilityCHROMIUM(bool);
+
     // GL_CHROMIUM_swapbuffers_complete_callback
     class SwapBuffersCompleteCallbackCHROMIUM {
     public:

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (98184 => 98185)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-10-22 03:15:41 UTC (rev 98185)
@@ -201,6 +201,10 @@
     if (extensions->supports("GL_EXT_texture_format_BGRA8888"))
         extensions->ensureEnabled("GL_EXT_texture_format_BGRA8888");
 
+    m_capabilities.usingSetVisibility = extensions->supports("GL_CHROMIUM_set_visibility");
+    if (m_capabilities.usingSetVisibility)
+        extensions->ensureEnabled("GL_CHROMIUM_set_visibility");
+
     GLC(m_context.get(), m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_capabilities.maxTextureSize));
     m_capabilities.bestTextureFormat = PlatformColor::bestTextureFormat(m_context.get());
 
@@ -248,6 +252,16 @@
         LOG_ERROR("GL command failed: File: %s\n\tLine %d\n\tcommand: %s, error %x\n", file, line, command, static_cast<int>(error));
 }
 
+void LayerRendererChromium::setVisible(bool visible)
+{
+    if (!visible)
+        releaseRenderSurfaceTextures();
+    if (m_capabilities.usingSetVisibility) {
+        Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(m_context->getExtensions());
+        extensions3DChromium->setVisibilityCHROMIUM(visible);
+    }
+}
+
 void LayerRendererChromium::releaseRenderSurfaceTextures()
 {
     m_renderSurfaceTextureManager->evictAndDeleteAllTextures(m_renderSurfaceTextureAllocator.get());

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h (98184 => 98185)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2011-10-22 03:15:41 UTC (rev 98185)
@@ -145,7 +145,7 @@
 
     bool isContextLost();
 
-    void releaseRenderSurfaceTextures();
+    void setVisible(bool);
 
     GC3Denum bestTextureFormat();
 
@@ -170,6 +170,8 @@
 
     void setDrawViewportRect(const IntRect&, bool flipY);
 
+    void releaseRenderSurfaceTextures();
+
     bool useRenderSurface(CCRenderSurface*);
 
     bool makeContextCurrent();

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (98184 => 98185)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2011-10-22 03:15:41 UTC (rev 98185)
@@ -83,12 +83,14 @@
         : bestTextureFormat(0)
         , usingMapSub(false)
         , usingAcceleratedPainting(false)
+        , usingSetVisibility(false)
         , usingSwapCompleteCallback(false)
         , maxTextureSize(0) { }
 
     GC3Denum bestTextureFormat;
     bool usingMapSub;
     bool usingAcceleratedPainting;
+    bool usingSetVisibility;
     bool usingSwapCompleteCallback;
     int maxTextureSize;
 };

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (98184 => 98185)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2011-10-22 03:15:41 UTC (rev 98185)
@@ -128,8 +128,8 @@
 
 void CCLayerTreeHostImpl::setVisible(bool visible)
 {
-    if (m_layerRenderer && !visible)
-        m_layerRenderer->releaseRenderSurfaceTextures();
+    if (m_layerRenderer)
+        m_layerRenderer->setVisible(visible);
 }
 
 bool CCLayerTreeHostImpl::initializeLayerRenderer(PassRefPtr<GraphicsContext3D> context)

Modified: trunk/Source/WebKit/chromium/ChangeLog (98184 => 98185)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-10-22 03:15:41 UTC (rev 98185)
@@ -1,3 +1,19 @@
+2011-10-21  Nat Duca  <nd...@chromium.org>
+
+        [chromium] Make setVisibility extension- and thread-correct
+        https://bugs.webkit.org/show_bug.cgi?id=70635
+
+        Reviewed by Kenneth Russell.
+
+        * public/WebGraphicsContext3D.h:
+        (WebKit::WebGraphicsContext3D::setVisibilityCHROMIUM):
+        * src/Extensions3DChromium.cpp:
+        (WebCore::Extensions3DChromium::setVisibilityCHROMIUM):
+        * src/GraphicsContext3DChromium.cpp:
+        * src/GraphicsContext3DPrivate.h:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::setVisibilityState):
+
 2011-10-21  Adam Barth  <aba...@webkit.org>
 
         Introduce Event::hasInterface to make uses of interfaceName more readable

Modified: trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h (98184 => 98185)


--- trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebKit/chromium/public/WebGraphicsContext3D.h	2011-10-22 03:15:41 UTC (rev 98185)
@@ -140,8 +140,8 @@
     // Resizes the region into which this WebGraphicsContext3D is drawing.
     virtual void reshape(int width, int height) = 0;
 
-    // Changes the visibility of the region
-    virtual void setVisibility(bool visible) = 0;
+    // GL_CHROMIUM_setVisibility - Changes the visibility of the backbuffer
+    virtual void setVisibilityCHROMIUM(bool visible) { }
 
     // Query whether it is built on top of compliant GLES2 implementation.
     virtual bool isGLES2Compliant() = 0;

Modified: trunk/Source/WebKit/chromium/src/Extensions3DChromium.cpp (98184 => 98185)


--- trunk/Source/WebKit/chromium/src/Extensions3DChromium.cpp	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebKit/chromium/src/Extensions3DChromium.cpp	2011-10-22 03:15:41 UTC (rev 98185)
@@ -97,6 +97,11 @@
     m_private->unmapTexSubImage2DCHROMIUM(data);
 }
 
+void Extensions3DChromium::setVisibilityCHROMIUM(bool visibility)
+{
+    m_private->setVisibilityCHROMIUM(visibility);
+}
+
 Platform3DObject Extensions3DChromium::createVertexArrayOES()
 {
     return 0;

Modified: trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp (98184 => 98185)


--- trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp	2011-10-22 03:15:41 UTC (rev 98185)
@@ -881,6 +881,8 @@
 DELEGATE_TO_IMPL_9R(mapTexSubImage2DCHROMIUM, GC3Denum, GC3Dint, GC3Dint, GC3Dint, GC3Dsizei, GC3Dsizei, GC3Denum, GC3Denum, GC3Denum, void*)
 DELEGATE_TO_IMPL_1(unmapTexSubImage2DCHROMIUM, const void*)
 
+DELEGATE_TO_IMPL_1(setVisibilityCHROMIUM, bool);
+
 DELEGATE_TO_IMPL_10(blitFramebufferCHROMIUM, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dint, GC3Dbitfield, GC3Denum)
 DELEGATE_TO_IMPL_5(renderbufferStorageMultisampleCHROMIUM, GC3Denum, GC3Dsizei, GC3Denum, GC3Dsizei, GC3Dsizei)
 

Modified: trunk/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h (98184 => 98185)


--- trunk/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h	2011-10-22 03:15:41 UTC (rev 98185)
@@ -290,6 +290,9 @@
     void* mapTexSubImage2DCHROMIUM(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, GC3Denum access);
     void unmapTexSubImage2DCHROMIUM(const void*);
 
+    // GL_CHROMIUM_set_visibility
+    void setVisibilityCHROMIUM(bool);
+
     // GL_CHROMIUM_framebuffer_multisample
     void blitFramebufferCHROMIUM(GC3Dint srcX0, GC3Dint srcY0, GC3Dint srcX1, GC3Dint srcY1, GC3Dint dstX0, GC3Dint dstY0, GC3Dint dstX1, GC3Dint dstY1, GC3Dbitfield mask, GC3Denum filter);
     void renderbufferStorageMultisampleCHROMIUM(GC3Denum target, GC3Dsizei samples, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height);

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (98184 => 98185)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-10-22 03:15:41 UTC (rev 98185)
@@ -2811,7 +2811,6 @@
         if (!visible)
             m_nonCompositedContentHost->protectVisibleTileTextures();
         m_layerTreeHost->setVisible(visible);
-        graphicsContext3D()->setVisibility(visible);
     }
 #endif
 }

Modified: trunk/Source/WebKit/chromium/tests/MockWebGraphicsContext3D.h (98184 => 98185)


--- trunk/Source/WebKit/chromium/tests/MockWebGraphicsContext3D.h	2011-10-22 02:51:33 UTC (rev 98184)
+++ trunk/Source/WebKit/chromium/tests/MockWebGraphicsContext3D.h	2011-10-22 03:15:41 UTC (rev 98185)
@@ -43,8 +43,6 @@
 
     virtual void reshape(int width, int height) { }
 
-    virtual void setVisibility(bool visible) { }
-
     virtual bool isGLES2Compliant() { return false; }
 
     virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize, WebGLId framebuffer, int width, int height) { return false; }
@@ -62,6 +60,8 @@
     virtual void* mapTexSubImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, WGC3Denum access) { return 0; }
     virtual void unmapTexSubImage2DCHROMIUM(const void*) { }
 
+    virtual void setVisibilityCHROMIUM(bool visible) { }
+
     virtual WebString getRequestableExtensionsCHROMIUM() { return WebString(); }
     virtual void requestExtensionCHROMIUM(const char*) { }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to