Title: [111708] trunk/Source
Revision
111708
Author
e...@google.com
Date
2012-03-22 08:37:30 -0700 (Thu, 22 Mar 2012)

Log Message

[chromium] Fix scrollbar layers holding onto invalid textures after lost context
https://bugs.webkit.org/show_bug.cgi?id=81841

Reviewed by James Robinson.

Source/WebCore:

Unit test: CCLayerTreeHostImplTest.scrollbarLayerLostContext

* platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp:
(WebCore::CCScrollbarLayerImpl::willDraw):

Source/WebKit/chromium:

* tests/CCLayerTreeHostImplTest.cpp:
(WebKitTests::TEST_F):
(WebKitTests):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111707 => 111708)


--- trunk/Source/WebCore/ChangeLog	2012-03-22 15:36:10 UTC (rev 111707)
+++ trunk/Source/WebCore/ChangeLog	2012-03-22 15:37:30 UTC (rev 111708)
@@ -1,3 +1,15 @@
+2012-03-22  Adrienne Walker  <e...@google.com>
+
+        [chromium] Fix scrollbar layers holding onto invalid textures after lost context
+        https://bugs.webkit.org/show_bug.cgi?id=81841
+
+        Reviewed by James Robinson.
+
+        Unit test: CCLayerTreeHostImplTest.scrollbarLayerLostContext
+
+        * platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp:
+        (WebCore::CCScrollbarLayerImpl::willDraw):
+
 2012-03-22  Philippe Normand  <pnorm...@igalia.com>
 
         [GTK] ASSERT bug in WebAudio (AudioFileReader)

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp (111707 => 111708)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp	2012-03-22 15:36:10 UTC (rev 111707)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp	2012-03-22 15:37:30 UTC (rev 111708)
@@ -58,6 +58,10 @@
     if (!m_texture)
         m_texture = ManagedTexture::create(layerRenderer->renderSurfaceTextureManager());
 
+    // The context could have been lost since the last frame and the old texture
+    // manager may no longer be valid.
+    m_texture->setTextureManager(layerRenderer->renderSurfaceTextureManager());
+
     IntSize textureSize = contentBounds();
     if (!m_texture->reserve(textureSize, GraphicsContext3D::RGBA))
         return;

Modified: trunk/Source/WebKit/chromium/ChangeLog (111707 => 111708)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-22 15:36:10 UTC (rev 111707)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-22 15:37:30 UTC (rev 111708)
@@ -1,3 +1,14 @@
+2012-03-22  Adrienne Walker  <e...@google.com>
+
+        [chromium] Fix scrollbar layers holding onto invalid textures after lost context
+        https://bugs.webkit.org/show_bug.cgi?id=81841
+
+        Reviewed by James Robinson.
+
+        * tests/CCLayerTreeHostImplTest.cpp:
+        (WebKitTests::TEST_F):
+        (WebKitTests):
+
 2012-03-22  Dana Jansens  <dan...@chromium.org>
 
         [chromium] Early out in a new prepareToDraw() step if checkerboarding an accelerated animation in order to skip the frame

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (111707 => 111708)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp	2012-03-22 15:36:10 UTC (rev 111707)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp	2012-03-22 15:37:30 UTC (rev 111708)
@@ -25,12 +25,14 @@
 #include "config.h"
 
 #include "cc/CCLayerTreeHostImpl.h"
+#include "cc/CCQuadCuller.h"
 
 #include "CCAnimationTestCommon.h"
 #include "FakeWebGraphicsContext3D.h"
 #include "GraphicsContext3DPrivate.h"
 #include "LayerRendererChromium.h"
 #include "cc/CCLayerImpl.h"
+#include "cc/CCScrollbarLayerImpl.h"
 #include "cc/CCSingleThreadProxy.h"
 #include "cc/CCTileDrawQuad.h"
 #include <gtest/gtest.h>
@@ -1084,4 +1086,27 @@
     m_hostImpl->finishAllRendering();
 }
 
+TEST_F(CCLayerTreeHostImplTest, scrollbarLayerLostContext)
+{
+    m_hostImpl->initializeLayerRenderer(createContext());
+    m_hostImpl->setViewportSize(IntSize(10, 10));
+
+    m_hostImpl->setRootLayer(CCScrollbarLayerImpl::create(0));
+    CCScrollbarLayerImpl* scrollbar = static_cast<CCScrollbarLayerImpl*>(m_hostImpl->rootLayer());
+    scrollbar->setBounds(IntSize(1, 1));
+    scrollbar->setContentBounds(IntSize(1, 1));
+    scrollbar->setDrawsContent(true);
+
+    for (int i = 0; i < 2; ++i) {
+        CCLayerTreeHostImpl::FrameData frame;
+        EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
+        ASSERT(frame.renderPasses.size() == 1);
+        CCRenderPass* renderPass = frame.renderPasses[0].get();
+        // Scrollbar layer should always generate quads, even after lost context
+        EXPECT_GT(renderPass->quadList().size(), 0u);
+
+        m_hostImpl->initializeLayerRenderer(createContext());
+    }
+}
+
 } // namespace
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to