Unreviewed, rolling out r120982.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2012 06:11:44 +0000 (06:11 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2012 06:11:44 +0000 (06:11 +0000)
http://trac.webkit.org/changeset/120982
https://bugs.webkit.org/show_bug.cgi?id=89740

[chromium] ASSERTION FAILED:
m_allocatedTextureIds.contains(textureId) (Requested by ukai
on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-06-21

Source/WebCore:

* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererGpuMemoryAllocationChangedCallbackAdapter::onGpuMemoryAllocationChangedOnImpl):
(WebCore::LayerRendererChromium::LayerRendererChromium):
(WebCore::LayerRendererChromium::initialize):
(WebCore::LayerRendererChromium::setVisible):
(WebCore::LayerRendererChromium::swapBuffers):
(WebCore::LayerRendererChromium::getFramebufferPixels):
* platform/graphics/chromium/LayerRendererChromium.h:
(WebCore):
(LayerRendererChromium):
* platform/graphics/chromium/TextureManager.cpp:
* platform/graphics/chromium/TextureManager.h:
(TextureAllocator):
(TextureManager):
* platform/graphics/chromium/TrackingTextureAllocator.cpp:
(WebCore::TrackingTextureAllocator::createTexture):
(WebCore::TrackingTextureAllocator::deleteTexture):
* platform/graphics/chromium/TrackingTextureAllocator.h:
(TrackingTextureAllocator):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::CCLayerTreeHost):
(WebCore::CCLayerTreeHost::initializeLayerRenderer):
(WebCore::CCLayerTreeHost::finishCommitOnImplThread):
(WebCore::CCLayerTreeHost::setNeedsForcedCommit):
(WebCore):
(WebCore::CCLayerTreeHost::setVisible):
(WebCore::CCLayerTreeHost::setContentsMemoryAllocationLimitBytes):
(WebCore::CCLayerTreeHost::updateLayers):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(CCLayerTreeHost):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::commitComplete):
(WebCore::CCLayerTreeHostImpl::canDraw):
(WebCore::CCLayerTreeHostImpl::context):
(WebCore::CCLayerTreeHostImpl::setContentsMemoryAllocationLimitBytes):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
(CCLayerTreeHostImplClient):
(WebCore::CCLayerTreeHostImpl::sourceFrameCanBeDrawn):
(WebCore::CCLayerTreeHostImpl::setSourceFrameCanBeDrawn):
(CCLayerTreeHostImpl):
* platform/graphics/chromium/cc/CCProxy.h:
(CCProxy):
* platform/graphics/chromium/cc/CCRenderer.h:
(CCRendererClient):
* platform/graphics/chromium/cc/CCScheduler.cpp:
(WebCore::CCScheduler::beginFrameComplete):
(WebCore::CCScheduler::didSwapBuffersComplete):
(WebCore::CCScheduler::didLoseContext):
(WebCore::CCScheduler::didRecreateContext):
(WebCore::CCScheduler::vsyncTick):
* platform/graphics/chromium/cc/CCScheduler.h:
(CCScheduler):
* platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp:
* platform/graphics/chromium/cc/CCSchedulerStateMachine.h:
* platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
(WebCore::CCSingleThreadProxy::setNeedsForcedCommit):
(WebCore):
(WebCore::CCSingleThreadProxy::stop):
(WebCore::CCSingleThreadProxy::postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread):
(WebCore::CCSingleThreadProxy::commitAndComposite):
* platform/graphics/chromium/cc/CCSingleThreadProxy.h:
(CCSingleThreadProxy):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::CCThreadProxy):
(WebCore::CCThreadProxy::compositeAndReadback):
(WebCore::CCThreadProxy::setNeedsForcedCommit):
(WebCore):
(WebCore::CCThreadProxy::postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread):
(WebCore::CCThreadProxy::scheduledActionBeginFrame):
(WebCore::CCThreadProxy::beginFrame):
(WebCore::CCThreadProxy::scheduledActionDrawAndSwapInternal):
(WebCore::CCThreadProxy::setContentsMemoryAllocationLimitBytes):
(WebCore::CCThreadProxy::layerTreeHostClosedOnImplThread):
* platform/graphics/chromium/cc/CCThreadProxy.h:
(CCThreadProxy):
(BeginFrameAndCommitState):
* platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
(WebCore::CCVideoLayerImpl::~CCVideoLayerImpl):
(WebCore::CCVideoLayerImpl::willDraw):
(WebCore::CCVideoLayerImpl::willDrawInternal):
(WebCore::CCVideoLayerImpl::FramePlane::allocateData):
(WebCore::CCVideoLayerImpl::FramePlane::freeData):
(WebCore::CCVideoLayerImpl::allocatePlaneData):
(WebCore::CCVideoLayerImpl::freePlaneData):
(WebCore::CCVideoLayerImpl::freeUnusedPlaneData):
(WebCore::CCVideoLayerImpl::didLoseContext):
* platform/graphics/chromium/cc/CCVideoLayerImpl.h:
(FramePlane):

Source/WebKit/chromium:

* tests/CCLayerTreeHostImplTest.cpp:
* tests/CCLayerTreeHostTest.cpp:
(CCLayerTreeHostTestVisibilityAndAllocationControlDrawing):
(WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing):
(WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::beginTest):
(WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::didCommitAndDrawFrame):
(WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::didCommit):
(WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::commitCompleteOnCCThread):
(WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::afterTest):
(WTF):
(WTF::CCLayerTreeHostTestLayerOcclusion::beginTest):
(WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest):
(WTF::CCLayerTreeHostTestManySurfaces::beginTest):
* tests/CCSchedulerStateMachineTest.cpp:
(WebCore::TEST):
* tests/CCTiledLayerTestCommon.h:
(WebKitTests::FakeTextureAllocator::createTexture):
(WebKitTests::FakeTextureAllocator::deleteTexture):
* tests/FakeWebGraphicsContext3D.h:
(WebKit::FakeWebGraphicsContext3D::createTexture):
(FakeWebGraphicsContext3D):
* tests/LayerRendererChromiumTest.cpp:
(TEST_F):
* tests/TiledLayerChromiumTest.cpp:

LayoutTests:

* platform/chromium/TestExpectations:

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

33 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
Source/WebCore/platform/graphics/chromium/TextureManager.cpp
Source/WebCore/platform/graphics/chromium/TextureManager.h
Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp
Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
Source/WebCore/platform/graphics/chromium/cc/CCProxy.h
Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h
Source/WebCore/platform/graphics/chromium/cc/CCScheduler.cpp
Source/WebCore/platform/graphics/chromium/cc/CCScheduler.h
Source/WebCore/platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp
Source/WebCore/platform/graphics/chromium/cc/CCSchedulerStateMachine.h
Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h
Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp
Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
Source/WebKit/chromium/tests/CCSchedulerStateMachineTest.cpp
Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h
Source/WebKit/chromium/tests/FakeWebGraphicsContext3D.h
Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp
Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp

index e055ca9..4760a72 100644 (file)
@@ -1,3 +1,15 @@
+2012-06-21  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r120982.
+        http://trac.webkit.org/changeset/120982
+        https://bugs.webkit.org/show_bug.cgi?id=89740
+
+        [chromium] ASSERTION FAILED:
+        m_allocatedTextureIds.contains(textureId) (Requested by ukai
+        on #webkit).
+
+        * platform/chromium/TestExpectations:
+
 2012-06-21  Ryosuke Niwa  <rniwa@webkit.org>
 
         LabelsNostList isn't updated properly after its owner node is adopted into a new document
index 42963bc..9d71ed6 100644 (file)
@@ -3528,9 +3528,6 @@ BUGWK85120 : fast/js/toString-number.html = TEXT
 
 BUGWK68744 : fast/block/float/float-not-removed-from-next-sibling4.html = IMAGE
 
-// Needs a new set of baselines due to generating less useless invalidations.
-BUGWK89045 : compositing/video-page-visibility.html = IMAGE
-
 BUGWK83076 SNOWLEOPARD RELEASE : compositing/geometry/outline-change.html = TIMEOUT PASS
 BUGWK83076 SNOWLEOPARD RELEASE : css3/selectors3/xml/css3-modsel-161.xml = TIMEOUT PASS
 BUGWK83076 SNOWLEOPARD RELEASE : css3/selectors3/xml/css3-modsel-166.xml = TIMEOUT PASS
index 0d656bf..6e93d81 100644 (file)
@@ -1,3 +1,103 @@
+2012-06-21  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r120982.
+        http://trac.webkit.org/changeset/120982
+        https://bugs.webkit.org/show_bug.cgi?id=89740
+
+        [chromium] ASSERTION FAILED:
+        m_allocatedTextureIds.contains(textureId) (Requested by ukai
+        on #webkit).
+
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererGpuMemoryAllocationChangedCallbackAdapter::onGpuMemoryAllocationChangedOnImpl):
+        (WebCore::LayerRendererChromium::LayerRendererChromium):
+        (WebCore::LayerRendererChromium::initialize):
+        (WebCore::LayerRendererChromium::setVisible):
+        (WebCore::LayerRendererChromium::swapBuffers):
+        (WebCore::LayerRendererChromium::getFramebufferPixels):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+        (WebCore):
+        (LayerRendererChromium):
+        * platform/graphics/chromium/TextureManager.cpp:
+        * platform/graphics/chromium/TextureManager.h:
+        (TextureAllocator):
+        (TextureManager):
+        * platform/graphics/chromium/TrackingTextureAllocator.cpp:
+        (WebCore::TrackingTextureAllocator::createTexture):
+        (WebCore::TrackingTextureAllocator::deleteTexture):
+        * platform/graphics/chromium/TrackingTextureAllocator.h:
+        (TrackingTextureAllocator):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::CCLayerTreeHost):
+        (WebCore::CCLayerTreeHost::initializeLayerRenderer):
+        (WebCore::CCLayerTreeHost::finishCommitOnImplThread):
+        (WebCore::CCLayerTreeHost::setNeedsForcedCommit):
+        (WebCore):
+        (WebCore::CCLayerTreeHost::setVisible):
+        (WebCore::CCLayerTreeHost::setContentsMemoryAllocationLimitBytes):
+        (WebCore::CCLayerTreeHost::updateLayers):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (CCLayerTreeHost):
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+        (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
+        (WebCore::CCLayerTreeHostImpl::commitComplete):
+        (WebCore::CCLayerTreeHostImpl::canDraw):
+        (WebCore::CCLayerTreeHostImpl::context):
+        (WebCore::CCLayerTreeHostImpl::setContentsMemoryAllocationLimitBytes):
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
+        (CCLayerTreeHostImplClient):
+        (WebCore::CCLayerTreeHostImpl::sourceFrameCanBeDrawn):
+        (WebCore::CCLayerTreeHostImpl::setSourceFrameCanBeDrawn):
+        (CCLayerTreeHostImpl):
+        * platform/graphics/chromium/cc/CCProxy.h:
+        (CCProxy):
+        * platform/graphics/chromium/cc/CCRenderer.h:
+        (CCRendererClient):
+        * platform/graphics/chromium/cc/CCScheduler.cpp:
+        (WebCore::CCScheduler::beginFrameComplete):
+        (WebCore::CCScheduler::didSwapBuffersComplete):
+        (WebCore::CCScheduler::didLoseContext):
+        (WebCore::CCScheduler::didRecreateContext):
+        (WebCore::CCScheduler::vsyncTick):
+        * platform/graphics/chromium/cc/CCScheduler.h:
+        (CCScheduler):
+        * platform/graphics/chromium/cc/CCSchedulerStateMachine.cpp:
+        * platform/graphics/chromium/cc/CCSchedulerStateMachine.h:
+        * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
+        (WebCore::CCSingleThreadProxy::setNeedsForcedCommit):
+        (WebCore):
+        (WebCore::CCSingleThreadProxy::stop):
+        (WebCore::CCSingleThreadProxy::postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread):
+        (WebCore::CCSingleThreadProxy::commitAndComposite):
+        * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
+        (CCSingleThreadProxy):
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::CCThreadProxy):
+        (WebCore::CCThreadProxy::compositeAndReadback):
+        (WebCore::CCThreadProxy::setNeedsForcedCommit):
+        (WebCore):
+        (WebCore::CCThreadProxy::postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread):
+        (WebCore::CCThreadProxy::scheduledActionBeginFrame):
+        (WebCore::CCThreadProxy::beginFrame):
+        (WebCore::CCThreadProxy::scheduledActionDrawAndSwapInternal):
+        (WebCore::CCThreadProxy::setContentsMemoryAllocationLimitBytes):
+        (WebCore::CCThreadProxy::layerTreeHostClosedOnImplThread):
+        * platform/graphics/chromium/cc/CCThreadProxy.h:
+        (CCThreadProxy):
+        (BeginFrameAndCommitState):
+        * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
+        (WebCore::CCVideoLayerImpl::~CCVideoLayerImpl):
+        (WebCore::CCVideoLayerImpl::willDraw):
+        (WebCore::CCVideoLayerImpl::willDrawInternal):
+        (WebCore::CCVideoLayerImpl::FramePlane::allocateData):
+        (WebCore::CCVideoLayerImpl::FramePlane::freeData):
+        (WebCore::CCVideoLayerImpl::allocatePlaneData):
+        (WebCore::CCVideoLayerImpl::freePlaneData):
+        (WebCore::CCVideoLayerImpl::freeUnusedPlaneData):
+        (WebCore::CCVideoLayerImpl::didLoseContext):
+        * platform/graphics/chromium/cc/CCVideoLayerImpl.h:
+        (FramePlane):
+
 2012-06-21  Kent Tamura  <tkent@chromium.org>
 
         Make FormControlState capable to store multiple values
index 595cae2..b6ca674 100644 (file)
@@ -35,6 +35,7 @@
 #include "LayerRendererChromium.h"
 
 #include "Extensions3D.h"
+#include "Extensions3DChromium.h"
 #include "FloatQuad.h"
 #include "GeometryBinding.h"
 #include "GrTexture.h"
@@ -218,7 +219,11 @@ private:
     void onGpuMemoryAllocationChangedOnImpl(Extensions3DChromium::GpuMemoryAllocationCHROMIUM allocation)
     {
         ASSERT(CCProxy::isImplThread());
-        m_layerRenderer->setGpuMemoryAllocation(allocation);
+        if (!allocation.suggestHaveBackbuffer)
+            m_layerRenderer->discardFramebuffer();
+        else
+            m_layerRenderer->ensureFramebuffer();
+        m_layerRenderer->m_client->setContentsMemoryAllocationLimitBytes(allocation.gpuResourceSizeInBytes);
     }
 
     LayerRendererChromium* m_layerRenderer;
@@ -246,7 +251,6 @@ LayerRendererChromium::LayerRendererChromium(CCRendererClient* client,
     , m_defaultRenderPass(0)
     , m_isViewportChanged(false)
     , m_isFramebufferDiscarded(false)
-    , m_visible(true)
     , m_textureUploaderSetting(textureUploaderSetting)
 {
     ASSERT(m_context.get());
@@ -330,7 +334,7 @@ bool LayerRendererChromium::initialize()
         Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(extensions);
         extensions3DChromium->setGpuMemoryAllocationChangedCallbackCHROMIUM(LayerRendererGpuMemoryAllocationChangedCallbackAdapter::create(this));
     } else {
-        m_client->setMemoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize()));
+        m_client->setContentsMemoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize()));
     }
 
     m_capabilities.usingDiscardFramebuffer = extensions->supports("GL_CHROMIUM_discard_framebuffer");
@@ -371,9 +375,8 @@ void LayerRendererChromium::debugGLCall(GraphicsContext3D* context, const char*
 
 void LayerRendererChromium::setVisible(bool visible)
 {
-    if (m_visible == visible)
-        return;
-    m_visible = visible;
+    if (!visible)
+        releaseRenderPassTextures();
 
     // TODO: Replace setVisibilityCHROMIUM with an extension to explicitly manage front/backbuffers
     // crbug.com/116049
@@ -1267,22 +1270,6 @@ void LayerRendererChromium::copyTextureToFramebuffer(int textureId, const IntSiz
                                     -1);
 }
 
-void LayerRendererChromium::setGpuMemoryAllocation(Extensions3DChromium::GpuMemoryAllocationCHROMIUM allocation)
-{
-    if (m_visible && !allocation.gpuResourceSizeInBytes)
-        return;
-
-    if (!allocation.suggestHaveBackbuffer && !m_visible)
-        discardFramebuffer();
-
-    if (!allocation.gpuResourceSizeInBytes) {
-        releaseRenderPassTextures();
-        m_client->releaseContentsTextures();
-        GLC(m_context, m_context->flush());
-    } else
-        m_client->setMemoryAllocationLimitBytes(allocation.gpuResourceSizeInBytes);
-}
-
 void LayerRendererChromium::finish()
 {
     TRACE_EVENT("LayerRendererChromium::finish", this, 0);
@@ -1291,8 +1278,12 @@ void LayerRendererChromium::finish()
 
 bool LayerRendererChromium::swapBuffers(const IntRect& subBuffer)
 {
-    ASSERT(m_visible);
-    ASSERT(!m_isFramebufferDiscarded);
+    // FIXME: Remove this once gpu process supports ignoring swap buffers command while framebuffer is discarded.
+    //        Alternatively (preferably?), protect all cc code so as not to attempt a swap after a framebuffer discard.
+    if (m_isFramebufferDiscarded) {
+        m_client->setFullRootLayerDamage();
+        return false;
+    }
 
     TRACE_EVENT("LayerRendererChromium::swapBuffers", this, 0);
     // We're done! Time to swapbuffers!
@@ -1396,14 +1387,6 @@ void LayerRendererChromium::getFramebufferPixels(void *pixels, const IntRect& re
         GLC(context, context->deleteFramebuffer(temporaryFBO));
         GLC(context, context->deleteTexture(temporaryTexture));
     }
-
-    if (!m_visible) {
-        TRACE_EVENT0("cc", "LayerRendererChromium::getFramebufferPixels dropping resources after readback");
-        discardFramebuffer();
-        releaseRenderPassTextures();
-        m_client->releaseContentsTextures();
-        GLC(m_context, m_context->flush());
-    }
 }
 
 bool LayerRendererChromium::getFramebufferTexture(ManagedTexture* texture, const IntRect& deviceRect)
index f7ccb65..e525d07 100644 (file)
@@ -34,7 +34,6 @@
 
 #if USE(ACCELERATED_COMPOSITING)
 
-#include "Extensions3DChromium.h"
 #include "TextureCopier.h"
 #include "TrackingTextureAllocator.h"
 #include "cc/CCRenderer.h"
@@ -54,6 +53,7 @@ class CCTileDrawQuad;
 class CCYUVVideoDrawQuad;
 class GeometryBinding;
 class GraphicsContext3D;
+class LayerRendererGpuMemoryAllocationChangedCallbackAdapter;
 class LayerRendererSwapBuffersCompleteCallbackAdapter;
 class ManagedTexture;
 class ScopedEnsureFramebufferAllocation;
@@ -111,9 +111,9 @@ public:
                           float width, float height, float opacity, const FloatQuad&,
                           int matrixLocation, int alphaLocation, int quadLocation);
     void copyTextureToFramebuffer(int textureId, const IntSize& bounds, const WebKit::WebTransformationMatrix& drawMatrix);
-    void setGpuMemoryAllocation(Extensions3DChromium::GpuMemoryAllocationCHROMIUM);
 
 protected:
+    friend class LayerRendererGpuMemoryAllocationChangedCallbackAdapter;
     void discardFramebuffer();
     void ensureFramebuffer();
     bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; }
@@ -258,7 +258,6 @@ private:
 
     bool m_isViewportChanged;
     bool m_isFramebufferDiscarded;
-    bool m_visible;
     TextureUploaderOption m_textureUploaderSetting;
 };
 
index d1f52fa..0a68840 100644 (file)
@@ -242,13 +242,6 @@ void TextureManager::deleteEvictedTextures(TextureAllocator* allocator)
     m_evictedTextures.clear();
 }
 
-void TextureManager::evictAndRemoveAllDeletedTextures()
-{
-    unprotectAllTextures();
-    reduceMemoryToLimit(0);
-    m_evictedTextures.clear();
-}
-
 void TextureManager::evictAndDeleteAllTextures(TextureAllocator* allocator)
 {
     unprotectAllTextures();
index 7ca14f4..3147635 100644 (file)
@@ -44,7 +44,6 @@ class TextureAllocator {
 public:
     virtual unsigned createTexture(const IntSize&, GC3Denum format) = 0;
     virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum) = 0;
-    virtual void deleteAllTextures() = 0;
 
 protected:
     virtual ~TextureAllocator() { }
@@ -89,7 +88,6 @@ public:
     unsigned allocateTexture(TextureAllocator*, TextureToken);
     void deleteEvictedTextures(TextureAllocator*);
 
-    void evictAndRemoveAllDeletedTextures();
     void evictAndDeleteAllTextures(TextureAllocator*);
 
     void reduceMemoryToLimit(size_t);
index 957711e..aa6c4ec 100644 (file)
@@ -89,7 +89,6 @@ unsigned TrackingTextureAllocator::createTexture(const IntSize& size, GC3Denum f
         extensions->texStorage2DEXT(GraphicsContext3D::TEXTURE_2D, 1, storageFormat, size.width(), size.height());
     } else
         GLC(m_context.get(), m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE));
-    m_allocatedTextureIds.add(textureId);
     return textureId;
 }
 
@@ -97,16 +96,6 @@ void TrackingTextureAllocator::deleteTexture(unsigned textureId, const IntSize&
 {
     m_currentMemoryUseBytes -= TextureManager::memoryUseBytes(size, format);
     GLC(m_context.get(), m_context->deleteTexture(textureId));
-    ASSERT(m_allocatedTextureIds.contains(textureId));
-    m_allocatedTextureIds.remove(textureId);
-}
-
-void TrackingTextureAllocator::deleteAllTextures()
-{
-    for (HashSet<unsigned>::const_iterator it = m_allocatedTextureIds.begin(); it != m_allocatedTextureIds.end(); ++it)
-        GLC(m_context.get(), m_context->deleteTexture(*it));
-    m_currentMemoryUseBytes = 0;
-    m_allocatedTextureIds.clear();
 }
 
 }
index 980b94e..a8a5492 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "GraphicsContext3D.h"
 #include "TextureManager.h"
-#include <wtf/HashSet.h>
 #include <wtf/PassRefPtr.h>
 
 namespace WebCore {
@@ -41,9 +40,8 @@ public:
     }
     virtual ~TrackingTextureAllocator();
 
-    virtual unsigned createTexture(const IntSize&, GC3Denum format) OVERRIDE;
-    virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum format) OVERRIDE;
-    virtual void deleteAllTextures() OVERRIDE;
+    virtual unsigned createTexture(const IntSize&, GC3Denum format);
+    virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum format);
 
     size_t currentMemoryUseBytes() const { return m_currentMemoryUseBytes; }
 
@@ -59,7 +57,6 @@ protected:
     size_t m_currentMemoryUseBytes;
     TextureUsageHint m_textureUsageHint;
     bool m_useTextureStorageExt;
-    HashSet<unsigned> m_allocatedTextureIds;
 };
 
 }
index 7d14cf5..bb6c064 100644 (file)
@@ -73,6 +73,7 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTre
     , m_needsAnimateLayers(false)
     , m_client(client)
     , m_frameNumber(0)
+    , m_frameIsForDisplay(false)
     , m_layerRendererInitialized(false)
     , m_contextLost(false)
     , m_numTimesRecreateShouldFail(0)
@@ -80,6 +81,8 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTre
     , m_settings(settings)
     , m_deviceScaleFactor(1)
     , m_visible(true)
+    , m_memoryAllocationBytes(0)
+    , m_memoryAllocationIsForDisplay(false)
     , m_pageScaleFactor(1)
     , m_minPageScaleFactor(1)
     , m_maxPageScaleFactor(1)
@@ -149,6 +152,11 @@ void CCLayerTreeHost::initializeLayerRenderer()
 
     m_contentsTextureManager = TextureManager::create(0, 0, m_proxy->layerRendererCapabilities().maxTextureSize);
 
+    // FIXME: This is the same as setContentsMemoryAllocationLimitBytes, but
+    // we're in the middle of a commit here and don't want to force another.
+    m_memoryAllocationBytes = TextureManager::highLimitBytes(deviceViewportSize());
+    m_memoryAllocationIsForDisplay = true;
+
     m_layerRendererInitialized = true;
 
     m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(), m_proxy->layerRendererCapabilities().maxTextureSize),
@@ -249,6 +257,8 @@ void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
     hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFactor, m_maxPageScaleFactor);
     hostImpl->setBackgroundColor(m_backgroundColor);
     hostImpl->setHasTransparentBackground(m_hasTransparentBackground);
+    hostImpl->setVisible(m_visible);
+    hostImpl->setSourceFrameCanBeDrawn(m_frameIsForDisplay);
 
     m_frameNumber++;
 }
@@ -319,6 +329,11 @@ void CCLayerTreeHost::setNeedsCommit()
     m_proxy->setNeedsCommit();
 }
 
+void CCLayerTreeHost::setNeedsForcedCommit()
+{
+    m_proxy->setNeedsForcedCommit();
+}
+
 void CCLayerTreeHost::setNeedsRedraw()
 {
     m_proxy->setNeedsRedraw();
@@ -384,15 +399,35 @@ void CCLayerTreeHost::setVisible(bool visible)
 {
     if (m_visible == visible)
         return;
+
     m_visible = visible;
-    m_proxy->setVisible(visible);
+
+    // FIXME: Remove this stuff, it is here just for the m20 merge.
+    if (!m_visible && m_layerRendererInitialized) {
+        if (m_proxy->layerRendererCapabilities().contextHasCachedFrontBuffer)
+            setContentsMemoryAllocationLimitBytes(0);
+        else
+            setContentsMemoryAllocationLimitBytes(m_contentsTextureManager->preferredMemoryLimitBytes());
+    }
+
+    setNeedsForcedCommit();
 }
 
-void CCLayerTreeHost::evictAllContentTextures()
+void CCLayerTreeHost::setContentsMemoryAllocationLimitBytes(size_t bytes)
 {
     ASSERT(CCProxy::isMainThread());
-    ASSERT(m_contentsTextureManager.get());
-    m_contentsTextureManager->evictAndRemoveAllDeletedTextures();
+    if (m_memoryAllocationBytes == bytes)
+        return;
+
+    m_memoryAllocationBytes = bytes;
+    m_memoryAllocationIsForDisplay = bytes;
+
+    // When not visible, force a commit so that we change our memory allocation
+    // and evict/delete any textures if we are being requested to.
+    if (!m_visible)
+        setNeedsForcedCommit();
+    else
+        setNeedsCommit();
 }
 
 void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec)
@@ -439,10 +474,19 @@ bool CCLayerTreeHost::initializeLayerRendererIfNeeded()
 }
 
 
-void CCLayerTreeHost::updateLayers(CCTextureUpdater& updater, size_t contentsMemoryLimitBytes)
+void CCLayerTreeHost::updateLayers(CCTextureUpdater& updater)
 {
     ASSERT(m_layerRendererInitialized);
-    ASSERT(contentsMemoryLimitBytes);
+    // The visible state and memory allocation are set independently and in
+    // arbitrary order, so do not change the memory allocation used for the
+    // current commit until both values match intentions.
+    // FIXME: These two states should be combined into a single action so we
+    // need a single commit to change visible state, and this can be removed.
+    bool memoryAllocationStateMatchesVisibility = m_visible == m_memoryAllocationIsForDisplay;
+    if (memoryAllocationStateMatchesVisibility) {
+        m_contentsTextureManager->setMemoryAllocationLimitBytes(m_memoryAllocationBytes);
+        m_frameIsForDisplay = m_memoryAllocationIsForDisplay;
+    }
 
     if (!rootLayer())
         return;
@@ -450,8 +494,6 @@ void CCLayerTreeHost::updateLayers(CCTextureUpdater& updater, size_t contentsMem
     if (viewportSize().isEmpty())
         return;
 
-    m_contentsTextureManager->setMemoryAllocationLimitBytes(contentsMemoryLimitBytes);
-
     updateLayers(rootLayer(), updater);
 }
 
index 6f6946e..58b7d2b 100644 (file)
@@ -171,7 +171,7 @@ public:
     virtual void acquireLayerTextures();
     // Returns false if we should abort this frame due to initialization failure.
     bool initializeLayerRendererIfNeeded();
-    void updateLayers(CCTextureUpdater&, size_t contentsMemoryLimitBytes);
+    void updateLayers(CCTextureUpdater&);
 
     CCLayerTreeHostClient* client() { return m_client; }
 
@@ -202,6 +202,7 @@ public:
     void setNeedsAnimate();
     // virtual for testing
     virtual void setNeedsCommit();
+    void setNeedsForcedCommit();
     void setNeedsRedraw();
     bool commitRequested() const;
 
@@ -227,12 +228,7 @@ public:
     void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
 
     TextureManager* contentsTextureManager() const;
-
-    // This will cause contents texture manager to evict all textures, but
-    // without deleting them. This happens after all content textures have
-    // already been deleted on impl, after getting a 0 allocation limit.
-    // Set during a commit, but before updateLayers.
-    void evictAllContentTextures();
+    void setContentsMemoryAllocationLimitBytes(size_t);
 
     bool visible() const { return m_visible; }
     void setVisible(bool);
@@ -285,6 +281,7 @@ private:
     CCLayerTreeHostClient* m_client;
 
     int m_frameNumber;
+    bool m_frameIsForDisplay;
 
     OwnPtr<CCProxy> m_proxy;
     bool m_layerRendererInitialized;
@@ -303,6 +300,9 @@ private:
 
     bool m_visible;
 
+    size_t m_memoryAllocationBytes;
+    bool m_memoryAllocationIsForDisplay;
+
     typedef HashMap<WebKit::WebGraphicsContext3D*, RefPtr<RateLimiter> > RateLimiterMap;
     RateLimiterMap m_rateLimiters;
 
index 9a11bd2..94141d6 100644 (file)
@@ -29,7 +29,6 @@
 #include "LayerRendererChromium.h"
 #include "TextStream.h"
 #include "TraceEvent.h"
-#include "TrackingTextureAllocator.h"
 #include "cc/CCActiveGestureAnimation.h"
 #include "cc/CCDamageTracker.h"
 #include "cc/CCDebugRectHistory.h"
@@ -121,8 +120,7 @@ CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CC
     , m_settings(settings)
     , m_deviceScaleFactor(1)
     , m_visible(true)
-    , m_contentsTexturesWerePurgedSinceLastCommit(false)
-    , m_memoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize()))
+    , m_sourceFrameCanBeDrawn(true)
     , m_headsUpDisplay(CCHeadsUpDisplay::create())
     , m_pageScale(1)
     , m_pageScaleDelta(1)
@@ -157,7 +155,6 @@ void CCLayerTreeHostImpl::commitComplete()
     // Recompute max scroll position; must be after layer content bounds are
     // updated.
     updateMaxScrollPosition();
-    m_contentsTexturesWerePurgedSinceLastCommit = false;
 }
 
 bool CCLayerTreeHostImpl::canDraw()
@@ -168,12 +165,12 @@ bool CCLayerTreeHostImpl::canDraw()
         return false;
     if (!m_layerRenderer)
         return false;
-    if (m_contentsTexturesWerePurgedSinceLastCommit)
+    if (!m_sourceFrameCanBeDrawn)
         return false;
     return true;
 }
 
-CCGraphicsContext* CCLayerTreeHostImpl::context() const
+CCGraphicsContext* CCLayerTreeHostImpl::context()
 {
     return m_context.get();
 }
@@ -470,20 +467,9 @@ bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame)
     return true;
 }
 
-void CCLayerTreeHostImpl::releaseContentsTextures()
+void CCLayerTreeHostImpl::setContentsMemoryAllocationLimitBytes(size_t bytes)
 {
-    contentsTextureAllocator()->deleteAllTextures();
-    m_contentsTexturesWerePurgedSinceLastCommit = true;
-}
-
-void CCLayerTreeHostImpl::setMemoryAllocationLimitBytes(size_t bytes)
-{
-    if (m_memoryAllocationLimitBytes == bytes)
-        return;
-    m_memoryAllocationLimitBytes = bytes;
-
-    ASSERT(bytes);
-    m_client->setNeedsCommitOnImplThread();
+    m_client->postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(bytes);
 }
 
 void CCLayerTreeHostImpl::drawLayers(const FrameData& frame)
index 939e42e..8279124 100644 (file)
@@ -57,6 +57,7 @@ public:
     virtual void setNeedsRedrawOnImplThread() = 0;
     virtual void setNeedsCommitOnImplThread() = 0;
     virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) = 0;
+    virtual void postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(size_t) = 0;
 };
 
 // CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state
@@ -108,12 +109,11 @@ public:
     virtual void didLoseContext() OVERRIDE;
     virtual void onSwapBuffersComplete() OVERRIDE;
     virtual void setFullRootLayerDamage() OVERRIDE;
-    virtual void releaseContentsTextures() OVERRIDE;
-    virtual void setMemoryAllocationLimitBytes(size_t) OVERRIDE;
+    virtual void setContentsMemoryAllocationLimitBytes(size_t) OVERRIDE;
 
     // Implementation
     bool canDraw();
-    CCGraphicsContext* context() const;
+    CCGraphicsContext* context();
 
     String layerTreeAsText() const;
     void setFontAtlas(PassOwnPtr<CCFontAtlas>);
@@ -146,8 +146,8 @@ public:
     int sourceFrameNumber() const { return m_sourceFrameNumber; }
     void setSourceFrameNumber(int frameNumber) { m_sourceFrameNumber = frameNumber; }
 
-    bool contentsTexturesWerePurgedSinceLastCommit() const { return m_contentsTexturesWerePurgedSinceLastCommit; }
-    size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; }
+    bool sourceFrameCanBeDrawn() const { return m_sourceFrameCanBeDrawn; }
+    void setSourceFrameCanBeDrawn(bool sourceFrameCanBeDrawn) { m_sourceFrameCanBeDrawn = sourceFrameCanBeDrawn; }
 
     const IntSize& viewportSize() const { return m_viewportSize; }
     void setViewportSize(const IntSize&);
@@ -235,8 +235,7 @@ private:
     IntSize m_deviceViewportSize;
     float m_deviceScaleFactor;
     bool m_visible;
-    bool m_contentsTexturesWerePurgedSinceLastCommit;
-    size_t m_memoryAllocationLimitBytes;
+    bool m_sourceFrameCanBeDrawn;
 
     OwnPtr<CCHeadsUpDisplay> m_headsUpDisplay;
 
index 1c2f9ca..fb2cbba 100644 (file)
@@ -70,8 +70,6 @@ public:
     // Indicates that the compositing surface associated with our context is ready to use.
     virtual void setSurfaceReady() = 0;
 
-    virtual void setVisible(bool) = 0;
-
     // Attempts to initialize the layer renderer. Returns false if the context isn't usable for compositing.
     virtual bool initializeLayerRenderer() = 0;
 
@@ -85,6 +83,7 @@ public:
 
     virtual void setNeedsAnimate() = 0;
     virtual void setNeedsCommit() = 0;
+    virtual void setNeedsForcedCommit() = 0;
     virtual void setNeedsRedraw() = 0;
 
     virtual void didAddAnimation() = 0;
index abad02b..b89089f 100644 (file)
@@ -49,8 +49,7 @@ public:
     virtual void didLoseContext() = 0;
     virtual void onSwapBuffersComplete() = 0;
     virtual void setFullRootLayerDamage() = 0;
-    virtual void releaseContentsTextures() = 0;
-    virtual void setMemoryAllocationLimitBytes(size_t) = 0;
+    virtual void setContentsMemoryAllocationLimitBytes(size_t) = 0;
 };
 
 class CCRenderer {
index d8355bd..84b8423 100644 (file)
@@ -88,18 +88,11 @@ void CCScheduler::setMainThreadNeedsLayerTextures()
 
 void CCScheduler::beginFrameComplete()
 {
-    TRACE_EVENT0("cc", "CCScheduler::beginFrameComplete");
+    TRACE_EVENT("CCScheduler::beginFrameComplete", this, 0);
     m_stateMachine.beginFrameComplete();
     processScheduledActions();
 }
 
-void CCScheduler::beginFrameAborted()
-{
-    TRACE_EVENT0("cc", "CCScheduler::beginFrameAborted");
-    m_stateMachine.beginFrameAborted();
-    processScheduledActions();
-}
-
 void CCScheduler::setMaxFramesPending(int maxFramesPending)
 {
     m_frameRateController->setMaxFramesPending(maxFramesPending);
@@ -107,13 +100,13 @@ void CCScheduler::setMaxFramesPending(int maxFramesPending)
 
 void CCScheduler::didSwapBuffersComplete()
 {
-    TRACE_EVENT0("cc", "CCScheduler::didSwapBuffersComplete");
+    TRACE_EVENT("CCScheduler::didSwapBuffersComplete", this, 0);
     m_frameRateController->didFinishFrame();
 }
 
 void CCScheduler::didLoseContext()
 {
-    TRACE_EVENT0("cc", "CCScheduler::didLoseContext");
+    TRACE_EVENT("CCScheduler::didLoseContext", this, 0);
     m_frameRateController->didAbortAllPendingFrames();
     m_stateMachine.didLoseContext();
     processScheduledActions();
@@ -121,7 +114,7 @@ void CCScheduler::didLoseContext()
 
 void CCScheduler::didRecreateContext()
 {
-    TRACE_EVENT0("cc", "CCScheduler::didRecreateContext");
+    TRACE_EVENT("CCScheduler::didRecreateContext", this, 0);
     m_stateMachine.didRecreateContext();
     processScheduledActions();
 }
@@ -132,7 +125,7 @@ void CCScheduler::vsyncTick()
         m_updateMoreResourcesPending = false;
         m_stateMachine.beginUpdateMoreResourcesComplete(m_client->hasMoreResourceUpdates());
     }
-    TRACE_EVENT0("cc", "CCScheduler::vsyncTick");
+    TRACE_EVENT("CCScheduler::vsyncTick", this, 0);
 
     m_stateMachine.didEnterVSync();
     processScheduledActions();
index 3e6f7aa..0e69716 100644 (file)
@@ -94,7 +94,6 @@ public:
     void setNeedsForcedRedraw();
 
     void beginFrameComplete();
-    void beginFrameAborted();
 
     void setMaxFramesPending(int);
     void didSwapBuffersComplete();
index 23ab9ae..928a6d6 100644 (file)
@@ -299,12 +299,6 @@ void CCSchedulerStateMachine::beginFrameComplete()
     m_commitState = COMMIT_STATE_UPDATING_RESOURCES;
 }
 
-void CCSchedulerStateMachine::beginFrameAborted()
-{
-    ASSERT(m_commitState == COMMIT_STATE_FRAME_IN_PROGRESS);
-    m_commitState = COMMIT_STATE_IDLE;
-}
-
 void CCSchedulerStateMachine::beginUpdateMoreResourcesComplete(bool morePending)
 {
     ASSERT(m_commitState == COMMIT_STATE_UPDATING_RESOURCES);
index fe1b180..a3a94c2 100644 (file)
@@ -120,10 +120,6 @@ public:
     // updating of compositor resources can begin.
     void beginFrameComplete();
 
-    // Call this only in response to receiving an ACTION_BEGIN_FRAME
-    // from nextState if the client rejects the beginFrame message.
-    void beginFrameAborted();
-
     // Call this only in response to receiving an ACTION_UPDATE_MORE_RESOURCES
     // from nextState. Indicates that the specific update request completed.
     void beginUpdateMoreResourcesComplete(bool morePending);
index f54ba77..14cdf1c 100644 (file)
@@ -153,12 +153,6 @@ void CCSingleThreadProxy::setSurfaceReady()
     // Scheduling is controlled by the embedder in the single thread case, so nothing to do.
 }
 
-void CCSingleThreadProxy::setVisible(bool visible)
-{
-    DebugScopedSetImplThread impl;
-    m_layerTreeHostImpl->setVisible(visible);
-}
-
 bool CCSingleThreadProxy::initializeLayerRenderer()
 {
     ASSERT(CCProxy::isMainThread());
@@ -264,6 +258,12 @@ void CCSingleThreadProxy::setNeedsCommit()
     m_layerTreeHost->scheduleComposite();
 }
 
+void CCSingleThreadProxy::setNeedsForcedCommit()
+{
+    // This proxy doesn't block commits when not visible so use a normal commit.
+    setNeedsCommit();
+}
+
 void CCSingleThreadProxy::setNeedsRedraw()
 {
     // FIXME: Once we move render_widget scheduling into this class, we can
@@ -290,8 +290,7 @@ void CCSingleThreadProxy::stop()
         DebugScopedSetMainThreadBlocked mainThreadBlocked;
         DebugScopedSetImplThread impl;
 
-        if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit())
-            m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
+        m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
         m_layerTreeHostImpl.clear();
     }
     m_layerTreeHost = 0;
@@ -311,6 +310,14 @@ void CCSingleThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr
     m_layerTreeHost->setAnimationEvents(events, wallClockTime);
 }
 
+void CCSingleThreadProxy::postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(size_t bytes)
+{
+    ASSERT(CCProxy::isImplThread());
+    DebugScopedSetMainThread main;
+    ASSERT(m_layerTreeHost);
+    m_layerTreeHost->setContentsMemoryAllocationLimitBytes(bytes);
+}
+
 // Called by the legacy scheduling path (e.g. where render_widget does the scheduling)
 void CCSingleThreadProxy::compositeImmediately()
 {
@@ -338,15 +345,11 @@ bool CCSingleThreadProxy::commitAndComposite()
 {
     ASSERT(CCProxy::isMainThread());
 
-
     if (!m_layerTreeHost->initializeLayerRendererIfNeeded())
         return false;
 
-    if (m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit())
-        m_layerTreeHost->evictAllContentTextures();
-
     CCTextureUpdater updater;
-    m_layerTreeHost->updateLayers(updater, m_layerTreeHostImpl->memoryAllocationLimitBytes());
+    m_layerTreeHost->updateLayers(updater);
 
     m_layerTreeHost->willCommit();
     doCommit(updater);
index 46cb302..93c128b 100644 (file)
@@ -49,7 +49,6 @@ public:
     virtual bool isStarted() const OVERRIDE;
     virtual bool initializeContext() OVERRIDE;
     virtual void setSurfaceReady() OVERRIDE;
-    virtual void setVisible(bool) OVERRIDE;
     virtual bool initializeLayerRenderer() OVERRIDE;
     virtual bool recreateContext() OVERRIDE;
     virtual int compositorIdentifier() const OVERRIDE { return m_compositorIdentifier; }
@@ -57,6 +56,7 @@ public:
     virtual void loseContext() OVERRIDE;
     virtual void setNeedsAnimate() OVERRIDE;
     virtual void setNeedsCommit() OVERRIDE;
+    virtual void setNeedsForcedCommit() OVERRIDE;
     virtual void setNeedsRedraw() OVERRIDE;
     virtual bool commitRequested() const OVERRIDE;
     virtual void didAddAnimation() OVERRIDE;
@@ -73,6 +73,7 @@ public:
     virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); }
     virtual void setNeedsCommitOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); }
     virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE;
+    virtual void postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(size_t) OVERRIDE;
 
     // Called by the legacy path where RenderWidget does the scheduling.
     void compositeImmediately();
index e2ecb9c..a9bfbc1 100644 (file)
@@ -80,7 +80,6 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost)
     , m_layerRendererInitialized(false)
     , m_started(false)
     , m_texturesAcquired(true)
-    , m_inCompositeAndReadback(false)
     , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread()))
     , m_beginFrameCompletionEventOnImplThread(0)
     , m_readbackRequestOnImplThread(0)
@@ -115,9 +114,7 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
     CCCompletionEvent beginFrameCompletion;
     CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceBeginFrameOnImplThread, AllowCrossThreadAccess(&beginFrameCompletion)));
     beginFrameCompletion.wait();
-    m_inCompositeAndReadback = true;
     beginFrame();
-    m_inCompositeAndReadback = false;
 
     // Perform a synchronous readback.
     ReadbackRequest request;
@@ -206,22 +203,6 @@ void CCThreadProxy::setSurfaceReadyOnImplThread()
     m_schedulerOnImplThread->setCanBeginFrame(true);
 }
 
-void CCThreadProxy::setVisible(bool visible)
-{
-    TRACE_EVENT0("cc", "CCThreadProxy::setVisible");
-    CCCompletionEvent completion;
-    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setVisibleOnImplThread, AllowCrossThreadAccess(&completion), visible));
-    completion.wait();
-}
-
-void CCThreadProxy::setVisibleOnImplThread(CCCompletionEvent* completion, bool visible)
-{
-    TRACE_EVENT0("cc", "CCThreadProxy::setVisibleOnImplThread");
-    m_layerTreeHostImpl->setVisible(visible);
-    m_schedulerOnImplThread->setVisible(visible);
-    completion->signal();
-}
-
 bool CCThreadProxy::initializeLayerRenderer()
 {
     TRACE_EVENT("CCThreadProxy::initializeLayerRenderer", this, 0);
@@ -319,6 +300,18 @@ void CCThreadProxy::setNeedsCommit()
     CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsCommitOnImplThread));
 }
 
+void CCThreadProxy::setNeedsForcedCommit()
+{
+    ASSERT(isMainThread());
+    if (m_forcedCommitRequested)
+        return;
+
+    TRACE_EVENT("CCThreadProxy::setNeedsForcedCommit", this, 0);
+    m_commitRequested = true;
+    m_forcedCommitRequested = true;
+    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsForcedCommitOnImplThread));
+}
+
 void CCThreadProxy::didLoseContextOnImplThread()
 {
     ASSERT(isImplThread());
@@ -356,6 +349,12 @@ void CCThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAni
     m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setAnimationEvents, events, wallClockTime));
 }
 
+void CCThreadProxy::postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(size_t bytes)
+{
+    ASSERT(isImplThread());
+    m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setContentsMemoryAllocationLimitBytes, bytes));
+}
+
 void CCThreadProxy::setNeedsRedraw()
 {
     ASSERT(isMainThread());
@@ -457,8 +456,6 @@ void CCThreadProxy::scheduledActionBeginFrame()
     m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
     m_currentTextureUpdaterOnImplThread = adoptPtr(new CCTextureUpdater);
     m_pendingBeginFrameRequest->updater = m_currentTextureUpdaterOnImplThread.get();
-    m_pendingBeginFrameRequest->contentsTexturesWereDeleted = m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit();
-    m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAllocationLimitBytes();
 
     m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame));
 
@@ -501,17 +498,9 @@ void CCThreadProxy::beginFrame()
     // Re-do the commit flow so that we don't send the scrollInfo on the BFAC message.
     m_layerTreeHost->applyScrollAndScale(*request->scrollInfo);
 
-    if (!m_inCompositeAndReadback && !m_layerTreeHost->visible()) {
-        m_commitRequested = false;
-        m_forcedCommitRequested = false;
-
-        TRACE_EVENT0("cc", "EarlyOut_NotVisible");
-        CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameAbortedOnImplThread));
-        return;
-    }
-
     m_layerTreeHost->willBeginFrame();
 
+    // FIXME: recreate the context if it was requested by the impl thread.
     m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime);
     m_layerTreeHost->layout();
 
@@ -524,10 +513,7 @@ void CCThreadProxy::beginFrame()
     if (!m_layerTreeHost->initializeLayerRendererIfNeeded())
         return;
 
-    if (request->contentsTexturesWereDeleted)
-        m_layerTreeHost->evictAllContentTextures();
-
-    m_layerTreeHost->updateLayers(*request->updater, request->memoryAllocationLimitBytes);
+    m_layerTreeHost->updateLayers(*request->updater);
 
     // Once single buffered layers are committed, they cannot be modified until
     // they are drawn by the impl thread.
@@ -575,16 +561,6 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
     m_schedulerOnImplThread->beginFrameComplete();
 }
 
-void CCThreadProxy::beginFrameAbortedOnImplThread()
-{
-    TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread");
-    ASSERT(isImplThread());
-    ASSERT(m_schedulerOnImplThread);
-    ASSERT(m_schedulerOnImplThread->commitPending());
-
-    m_schedulerOnImplThread->beginFrameAborted();
-}
-
 bool CCThreadProxy::hasMoreResourceUpdates() const
 {
     if (!m_currentTextureUpdaterOnImplThread)
@@ -685,7 +661,9 @@ CCScheduledActionDrawAndSwapResult CCThreadProxy::scheduledActionDrawAndSwapInte
         }
         m_readbackRequestOnImplThread->completion.signal();
         m_readbackRequestOnImplThread = 0;
-    } else if (drawFrame)
+    }
+
+    if (drawFrame)
         result.didSwap = m_layerTreeHostImpl->swapBuffers();
 
     // Tell the main thread that the the newly-commited frame was drawn.
@@ -768,6 +746,14 @@ void CCThreadProxy::setAnimationEvents(PassOwnPtr<CCAnimationEventsVector> event
     m_layerTreeHost->setAnimationEvents(events, wallClockTime);
 }
 
+void CCThreadProxy::setContentsMemoryAllocationLimitBytes(size_t bytes)
+{
+    ASSERT(isMainThread());
+    if (!m_layerTreeHost)
+        return;
+    m_layerTreeHost->setContentsMemoryAllocationLimitBytes(bytes);
+}
+
 class CCThreadProxyContextRecreationTimer : public CCTimer, CCTimerClient {
 public:
     static PassOwnPtr<CCThreadProxyContextRecreationTimer> create(CCThreadProxy* proxy) { return adoptPtr(new CCThreadProxyContextRecreationTimer(proxy)); }
@@ -850,8 +836,7 @@ void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio
 {
     TRACE_EVENT("CCThreadProxy::layerTreeHostClosedOnImplThread", this, 0);
     ASSERT(isImplThread());
-    if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit())
-        m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
+    m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
     m_inputHandlerOnImplThread.clear();
     m_layerTreeHostImpl.clear();
     m_schedulerOnImplThread.clear();
index 572f9f4..5521f2f 100644 (file)
@@ -56,7 +56,6 @@ public:
     virtual bool isStarted() const OVERRIDE;
     virtual bool initializeContext() OVERRIDE;
     virtual void setSurfaceReady() OVERRIDE;
-    virtual void setVisible(bool) OVERRIDE;
     virtual bool initializeLayerRenderer() OVERRIDE;
     virtual bool recreateContext() OVERRIDE;
     virtual int compositorIdentifier() const OVERRIDE;
@@ -64,6 +63,7 @@ public:
     virtual void loseContext() OVERRIDE;
     virtual void setNeedsAnimate() OVERRIDE;
     virtual void setNeedsCommit() OVERRIDE;
+    virtual void setNeedsForcedCommit() OVERRIDE;
     virtual void setNeedsRedraw() OVERRIDE;
     virtual bool commitRequested() const OVERRIDE;
     virtual void didAddAnimation() OVERRIDE { }
@@ -80,6 +80,7 @@ public:
     virtual void setNeedsRedrawOnImplThread() OVERRIDE;
     virtual void setNeedsCommitOnImplThread() OVERRIDE;
     virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE;
+    virtual void postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(size_t) OVERRIDE;
 
     // CCSchedulerClient implementation
     virtual bool canDraw() OVERRIDE;
@@ -107,8 +108,6 @@ private:
         double monotonicFrameBeginTime;
         OwnPtr<CCScrollAndScaleSet> scrollInfo;
         CCTextureUpdater* updater;
-        bool contentsTexturesWereDeleted;
-        size_t memoryAllocationLimitBytes;
     };
     OwnPtr<BeginFrameAndCommitState> m_pendingBeginFrameRequest;
 
@@ -117,6 +116,7 @@ private:
     void didCommitAndDrawFrame();
     void didCompleteSwapBuffers();
     void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime);
+    void setContentsMemoryAllocationLimitBytes(size_t);
     void beginContextRecreation();
     void tryToRecreateContext();
 
@@ -129,13 +129,11 @@ private:
     };
     void forceBeginFrameOnImplThread(CCCompletionEvent*);
     void beginFrameCompleteOnImplThread(CCCompletionEvent*);
-    void beginFrameAbortedOnImplThread();
     void requestReadbackOnImplThread(ReadbackRequest*);
     void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double durationSec);
     void finishAllRenderingOnImplThread(CCCompletionEvent*);
     void initializeImplOnImplThread(CCCompletionEvent*);
     void setSurfaceReadyOnImplThread();
-    void setVisibleOnImplThread(CCCompletionEvent*, bool);
     void initializeContextOnImplThread(CCGraphicsContext*);
     void initializeLayerRendererOnImplThread(CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*);
     void layerTreeHostClosedOnImplThread(CCCompletionEvent*);
@@ -159,7 +157,6 @@ private:
     LayerRendererCapabilities m_layerRendererCapabilitiesMainThreadCopy;
     bool m_started;
     bool m_texturesAcquired;
-    bool m_inCompositeAndReadback;
 
     OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl;
 
index dbb07a0..46e578f 100644 (file)
@@ -31,7 +31,6 @@
 
 #include "Extensions3DChromium.h"
 #include "GraphicsContext3D.h"
-#include "LayerRendererChromium.h" // For GLC macro
 #include "LayerTextureSubImage.h"
 #include "NotImplemented.h"
 #include "TextStream.h"
@@ -76,7 +75,7 @@ CCVideoLayerImpl::~CCVideoLayerImpl()
         m_provider->setVideoFrameProviderClient(0);
         m_provider = 0;
     }
-    freePlaneData(layerTreeHostImpl()->context());
+    freePlaneData(layerTreeHostImpl()->layerRenderer());
 
 #if !ASSERT_DISABLED
     for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i)
@@ -126,7 +125,7 @@ void CCVideoLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* co
     m_providerMutex.lock();
 
     willDrawInternal(layerRenderer, context);
-    freeUnusedPlaneData(context);
+    freeUnusedPlaneData(layerRenderer);
 
     if (!m_frame)
         m_providerMutex.unlock();
@@ -160,7 +159,7 @@ void CCVideoLayerImpl::willDrawInternal(CCRenderer* layerRenderer, CCGraphicsCon
         return;
     }
 
-    if (!allocatePlaneData(layerRenderer, context)) {
+    if (!allocatePlaneData(layerRenderer)) {
         m_provider->putCurrentFrame(m_frame);
         m_frame = 0;
         return;
@@ -283,43 +282,25 @@ IntSize CCVideoLayerImpl::computeVisibleSize(const WebKit::WebVideoFrame& frame,
     return IntSize(visibleWidth, visibleHeight);
 }
 
-bool CCVideoLayerImpl::FramePlane::allocateData(CCGraphicsContext* context)
+bool CCVideoLayerImpl::FramePlane::allocateData(CCRenderer* layerRenderer)
 {
     if (textureId)
         return true;
 
-    GraphicsContext3D* context3D = context->context3D();
-    if (!context3D)
-        return false;
-
-    GLC(context3D, textureId = context3D->createTexture());
-    GLC(context3D, context3D->bindTexture(GraphicsContext3D::TEXTURE_2D, textureId));
-    // Do basic linear filtering on resize.
-    GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
-    GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
-    // NPOT textures in GL ES only work when the wrap mode is set to GraphicsContext3D::CLAMP_TO_EDGE.
-    GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
-    GLC(context3D, context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
-
-    GLC(context3D, context3D->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, format, size.width(), size.height(), 0, format, GraphicsContext3D::UNSIGNED_BYTE));
-
+    textureId = layerRenderer->contentsTextureAllocator()->createTexture(size, format);
     return textureId;
 }
 
-void CCVideoLayerImpl::FramePlane::freeData(CCGraphicsContext* context)
+void CCVideoLayerImpl::FramePlane::freeData(CCRenderer* layerRenderer)
 {
     if (!textureId)
         return;
 
-    GraphicsContext3D* context3D = context->context3D();
-    if (!context3D)
-        return;
-
-    GLC(context3D, context3D->deleteTexture(textureId));
+    layerRenderer->contentsTextureAllocator()->deleteTexture(textureId, size, format);
     textureId = 0;
 }
 
-bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer, CCGraphicsContext* context)
+bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer)
 {
     int maxTextureSize = layerRenderer->capabilities().maxTextureSize;
     for (unsigned planeIndex = 0; planeIndex < m_frame->planes(); ++planeIndex) {
@@ -331,13 +312,13 @@ bool CCVideoLayerImpl::allocatePlaneData(CCRenderer* layerRenderer, CCGraphicsCo
             return false;
 
         if (plane.size != requiredTextureSize || plane.format != m_format) {
-            plane.freeData(context);
+            plane.freeData(layerRenderer);
             plane.size = requiredTextureSize;
             plane.format = m_format;
         }
 
         if (!plane.textureId) {
-            if (!plane.allocateData(context))
+            if (!plane.allocateData(layerRenderer))
                 return false;
             plane.visibleSize = computeVisibleSize(*m_frame, planeIndex);
         }
@@ -370,17 +351,17 @@ bool CCVideoLayerImpl::copyPlaneData(CCRenderer* layerRenderer, CCGraphicsContex
     return true;
 }
 
-void CCVideoLayerImpl::freePlaneData(CCGraphicsContext* context)
+void CCVideoLayerImpl::freePlaneData(CCRenderer* layerRenderer)
 {
     for (unsigned i = 0; i < WebKit::WebVideoFrame::maxPlanes; ++i)
-        m_framePlanes[i].freeData(context);
+        m_framePlanes[i].freeData(layerRenderer);
 }
 
-void CCVideoLayerImpl::freeUnusedPlaneData(CCGraphicsContext* context)
+void CCVideoLayerImpl::freeUnusedPlaneData(CCRenderer* layerRenderer)
 {
     unsigned firstUnusedPlane = m_frame ? m_frame->planes() : 0;
     for (unsigned i = firstUnusedPlane; i < WebKit::WebVideoFrame::maxPlanes; ++i)
-        m_framePlanes[i].freeData(context);
+        m_framePlanes[i].freeData(layerRenderer);
 }
 
 void CCVideoLayerImpl::didReceiveFrame()
@@ -400,7 +381,7 @@ void CCVideoLayerImpl::didUpdateMatrix(const float matrix[16])
 
 void CCVideoLayerImpl::didLoseContext()
 {
-    freePlaneData(layerTreeHostImpl()->context());
+    freePlaneData(layerTreeHostImpl()->layerRenderer());
 }
 
 void CCVideoLayerImpl::setNeedsRedraw()
index b2e088f..bef1d5f 100644 (file)
@@ -75,8 +75,8 @@ public:
 
         FramePlane() : textureId(0) { }
 
-        bool allocateData(CCGraphicsContext*);
-        void freeData(CCGraphicsContext*);
+        bool allocateData(CCRenderer*);
+        void freeData(CCRenderer*);
     };
 
 private:
@@ -86,10 +86,10 @@ private:
     virtual const char* layerTypeAsString() const OVERRIDE { return "VideoLayer"; }
 
     void willDrawInternal(CCRenderer*, CCGraphicsContext*);
-    bool allocatePlaneData(CCRenderer*, CCGraphicsContext*);
+    bool allocatePlaneData(CCRenderer*);
     bool copyPlaneData(CCRenderer*, CCGraphicsContext*);
-    void freePlaneData(CCGraphicsContext*);
-    void freeUnusedPlaneData(CCGraphicsContext*);
+    void freePlaneData(CCRenderer*);
+    void freeUnusedPlaneData(CCRenderer*);
 
     // Guards the destruction of m_provider and the frame that it provides
     Mutex m_providerMutex;
index 276c1ab..bdb762e 100644 (file)
@@ -1,3 +1,38 @@
+2012-06-21  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r120982.
+        http://trac.webkit.org/changeset/120982
+        https://bugs.webkit.org/show_bug.cgi?id=89740
+
+        [chromium] ASSERTION FAILED:
+        m_allocatedTextureIds.contains(textureId) (Requested by ukai
+        on #webkit).
+
+        * tests/CCLayerTreeHostImplTest.cpp:
+        * tests/CCLayerTreeHostTest.cpp:
+        (CCLayerTreeHostTestVisibilityAndAllocationControlDrawing):
+        (WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing):
+        (WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::beginTest):
+        (WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::didCommitAndDrawFrame):
+        (WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::didCommit):
+        (WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::commitCompleteOnCCThread):
+        (WTF::CCLayerTreeHostTestVisibilityAndAllocationControlDrawing::afterTest):
+        (WTF):
+        (WTF::CCLayerTreeHostTestLayerOcclusion::beginTest):
+        (WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest):
+        (WTF::CCLayerTreeHostTestManySurfaces::beginTest):
+        * tests/CCSchedulerStateMachineTest.cpp:
+        (WebCore::TEST):
+        * tests/CCTiledLayerTestCommon.h:
+        (WebKitTests::FakeTextureAllocator::createTexture):
+        (WebKitTests::FakeTextureAllocator::deleteTexture):
+        * tests/FakeWebGraphicsContext3D.h:
+        (WebKit::FakeWebGraphicsContext3D::createTexture):
+        (FakeWebGraphicsContext3D):
+        * tests/LayerRendererChromiumTest.cpp:
+        (TEST_F):
+        * tests/TiledLayerChromiumTest.cpp:
+
 2012-06-21  James Robinson  <jamesr@chromium.org>
 
         [chromium] Initialize compositor's visibility state upon initialization
index d19b036..49536bb 100644 (file)
@@ -81,6 +81,7 @@ public:
     virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; }
     virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; }
     virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { }
+    virtual void postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(size_t) OVERRIDE { }
 
     PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassRefPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr)
     {
@@ -1791,7 +1792,7 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapNoUpdate)
     Mock::VerifyAndClearExpectations(&mockContext);
 }
 
-class PartialSwapContext : public FakeWebGraphicsContext3D {
+class PartialSwapContext: public FakeWebGraphicsContext3D {
 public:
     WebString getString(WGC3Denum name)
     {
@@ -2040,17 +2041,12 @@ private:
 // FakeWebGraphicsContext3D have an id of 1).
 class StrictWebGraphicsContext3D : public FakeWebGraphicsContext3D {
 public:
-    StrictWebGraphicsContext3D()
-        : FakeWebGraphicsContext3D()
-    {
-        m_nextTextureId = 7; // Start allocating texture ids larger than any other resource IDs so we can tell if someone's mixing up their resource types.
-    }
-
     virtual WebGLId createBuffer() { return 2; }
     virtual WebGLId createFramebuffer() { return 3; }
     virtual WebGLId createProgram() { return 4; }
     virtual WebGLId createRenderbuffer() { return 5; }
     virtual WebGLId createShader(WGC3Denum) { return 6; }
+    virtual WebGLId createTexture() { return 7; }
 
     virtual void deleteBuffer(WebGLId id)
     {
@@ -2082,17 +2078,10 @@ public:
             ADD_FAILURE() << "Trying to delete shader id " << id;
     }
 
-    virtual WebGLId createTexture()
-    {
-        unsigned textureId = FakeWebGraphicsContext3D::createTexture();
-        m_allocatedTextureIds.add(textureId);
-        return textureId;
-    }
     virtual void deleteTexture(WebGLId id)
     {
-        if (!m_allocatedTextureIds.contains(id))
+        if (id != 7)
             ADD_FAILURE() << "Trying to delete texture id " << id;
-        m_allocatedTextureIds.remove(id);
     }
 
     virtual void bindBuffer(WGC3Denum, WebGLId id)
@@ -2127,7 +2116,7 @@ public:
 
     virtual void bindTexture(WGC3Denum, WebGLId id)
     {
-        if (id && !m_allocatedTextureIds.contains(id))
+        if (id != 7 && id)
             ADD_FAILURE() << "Trying to bind texture id " << id;
     }
 
@@ -2135,9 +2124,6 @@ public:
     {
         return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new StrictWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow);
     }
-
-private:
-    HashSet<unsigned> m_allocatedTextureIds;
 };
 
 // Fake video frame that represents a 4x4 YUV video frame.
@@ -2277,13 +2263,14 @@ TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
 class TrackingWebGraphicsContext3D : public FakeWebGraphicsContext3D {
 public:
     TrackingWebGraphicsContext3D()
-        : FakeWebGraphicsContext3D()
+        : m_nextTextureId(1)
         , m_numTextures(0)
     { }
 
     virtual WebGLId createTexture() OVERRIDE
     {
-        WebGLId id = FakeWebGraphicsContext3D::createTexture();
+        WebGLId id = m_nextTextureId;
+        ++m_nextTextureId;
 
         m_textures.set(id, true);
         ++m_numTextures;
@@ -2315,6 +2302,7 @@ public:
     unsigned numTextures() const { return m_numTextures; }
 
 private:
+    WebGLId m_nextTextureId;
     HashMap<WebGLId, bool> m_textures;
     unsigned m_numTextures;
 };
index d277379..4a2fd31 100644 (file)
@@ -486,40 +486,6 @@ TEST_F(CCLayerTreeHostTestCompositeAndReadbackWhileInvisible, runMultiThread)
     runTestThreaded();
 }
 
-class CCLayerTreeHostTestAbortFrameWhenInvisible : public CCLayerTreeHostTestThreadOnly {
-public:
-    CCLayerTreeHostTestAbortFrameWhenInvisible()
-    {
-    }
-
-    virtual void beginTest()
-    {
-        // Request a commit (from the main thread), which will trigger the commit flow from the impl side.
-        m_layerTreeHost->setNeedsCommit();
-        // Then mark ourselves as not visible before processing any more messages on the main thread.
-        m_layerTreeHost->setVisible(false);
-        // If we make it without kicking a frame, we pass!
-        endTestAfterDelay(1);
-    }
-
-    virtual void layout() OVERRIDE
-    {
-        ASSERT_FALSE(true);
-        endTest();
-    }
-
-    virtual void afterTest()
-    {
-    }
-
-private:
-};
-
-TEST_F(CCLayerTreeHostTestAbortFrameWhenInvisible, runMultiThread)
-{
-    runTestThreaded();
-}
-
 
 // Trigger a frame with setNeedsCommit. Then, inside the resulting animate
 // callback, requet another frame using setNeedsAnimate. End the test when
@@ -1031,6 +997,113 @@ TEST_F(CCLayerTreeHostTestCommit, runTest)
     runTest(true);
 }
 
+class CCLayerTreeHostTestVisibilityAndAllocationControlDrawing : public CCLayerTreeHostTest {
+public:
+
+    CCLayerTreeHostTestVisibilityAndAllocationControlDrawing() { }
+
+    virtual void beginTest()
+    {
+        postSetNeedsCommitToMainThread();
+    }
+
+    virtual void didCommitAndDrawFrame()
+    {
+        int lastFrame = m_layerTreeHost->frameNumber() - 1;
+
+        // These frames should draw.
+        switch (lastFrame) {
+        case 0:
+            // Set the tree invisible, this should not draw.
+            m_layerTreeHost->setVisible(false);
+            break;
+        case 2:
+            // Set the tree invisible and give a non-visible allocation, this
+            // should not draw.
+            m_layerTreeHost->setVisible(false);
+            m_layerTreeHost->setContentsMemoryAllocationLimitBytes(0);
+            break;
+        case 5:
+            // Give a memory allocation not for display, but while we are
+            // visible. This should not be used and we should remain
+            // ready for display and it should draw.
+            m_layerTreeHost->setContentsMemoryAllocationLimitBytes(0);
+            break;
+        case 6:
+            endTest();
+            break;
+
+        default:
+            ASSERT_NOT_REACHED();
+        }
+    }
+
+    virtual void didCommit()
+    {
+        int lastFrame = m_layerTreeHost->frameNumber() - 1;
+
+        // These frames should not draw.
+        switch (lastFrame) {
+        case 1:
+            // Set the tree visible, this should draw.
+            m_layerTreeHost->setVisible(true);
+            break;
+        case 3:
+            // Set visible without giving a visible memory allocation, this
+            // shouldn't make the impl side ready for display, so it should
+            // not draw.
+            m_layerTreeHost->setVisible(true);
+            break;
+        case 4:
+            // Now give a memory allocation for display, this should draw.
+            m_layerTreeHost->setContentsMemoryAllocationLimitBytes(1);
+            break;
+        }
+    }
+
+    virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
+    {
+        switch (impl->sourceFrameNumber()) {
+        case 0:
+            // The host starts out visible and able to display before we do any commit.
+            EXPECT_TRUE(impl->visible());
+            EXPECT_TRUE(impl->sourceFrameCanBeDrawn());
+            break;
+        case 1:
+            // We still have a memory allocation for display.
+            EXPECT_FALSE(impl->visible());
+            EXPECT_TRUE(impl->sourceFrameCanBeDrawn());
+            break;
+        case 2:
+            EXPECT_TRUE(impl->visible());
+            EXPECT_TRUE(impl->sourceFrameCanBeDrawn());
+            break;
+        case 3:
+            EXPECT_FALSE(impl->visible());
+            EXPECT_FALSE(impl->sourceFrameCanBeDrawn());
+            break;
+        case 4:
+            EXPECT_TRUE(impl->visible());
+            EXPECT_FALSE(impl->sourceFrameCanBeDrawn());
+            break;
+        case 5:
+            EXPECT_TRUE(impl->visible());
+            EXPECT_TRUE(impl->sourceFrameCanBeDrawn());
+            break;
+        case 6:
+            EXPECT_TRUE(impl->visible());
+            EXPECT_TRUE(impl->sourceFrameCanBeDrawn());
+            break;
+        }
+    }
+
+    virtual void afterTest()
+    {
+    }
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestVisibilityAndAllocationControlDrawing)
+
 // Verifies that startPageScaleAnimation events propagate correctly from CCLayerTreeHost to
 // CCLayerTreeHostImpl in the MT compositor.
 class CCLayerTreeHostTestStartPageScaleAnimation : public CCLayerTreeHostTest {
@@ -1661,7 +1734,7 @@ public:
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
         ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
         CCTextureUpdater updater;
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
@@ -1678,7 +1751,7 @@ public:
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
@@ -1696,7 +1769,7 @@ public:
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
@@ -1716,7 +1789,7 @@ public:
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
@@ -1738,7 +1811,7 @@ public:
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
@@ -1760,7 +1833,7 @@ public:
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
@@ -1783,7 +1856,7 @@ public:
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds());
@@ -1806,7 +1879,7 @@ public:
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
@@ -1869,7 +1942,7 @@ public:
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
         ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
         CCTextureUpdater updater;
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
@@ -1896,7 +1969,7 @@ public:
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds());
@@ -1958,7 +2031,7 @@ public:
         m_layerTreeHost->setViewportSize(layers[0]->bounds());
         ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
         CCTextureUpdater updater;
-        m_layerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
 
         for (int i = 0; i < numSurfaces-1; ++i) {
index 2e31d44..a99149b 100644 (file)
@@ -807,7 +807,7 @@ TEST(CCSchedulerStateMachineTest, TestRequestCommitInvisible)
     EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
 }
 
-TEST(CCSchedulerStateMachineTest, TestGoesInvisibleBeforeBeginFrameCompletes)
+TEST(CCSchedulerStateMachineTest, TestGoesInvisibleMidCommit)
 {
     StateMachine state;
     state.setCanBeginFrame(true);
@@ -823,12 +823,33 @@ TEST(CCSchedulerStateMachineTest, TestGoesInvisibleBeforeBeginFrameCompletes)
     EXPECT_FALSE(state.needsCommit());
     EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
 
-    // Become invisible and abort the beginFrame.
+    // Become invisible
     state.setVisible(false);
-    state.beginFrameAborted();
 
-    // We should now be back in the idle state as if we didn't start a frame at all.
-    EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_IDLE, state.commitState());
+    // Tell the scheduler the frame finished
+    state.beginFrameComplete();
+    EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_UPDATING_RESOURCES, state.commitState());
+    EXPECT_EQ(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES, state.nextAction());
+
+    // Tell the scheduler the update began and finished
+    state.updateState(CCSchedulerStateMachine::ACTION_BEGIN_UPDATE_MORE_RESOURCES);
+    state.beginUpdateMoreResourcesComplete(false);
+    EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_READY_TO_COMMIT, state.commitState());
+    EXPECT_EQ(CCSchedulerStateMachine::ACTION_COMMIT, state.nextAction());
+
+    // Commit in invisible state should leave us:
+    // - COMMIT_STATE_WAITING_FOR_FIRST_DRAW
+    // - Waiting for redraw.
+    // - No commit needed
+    state.updateState(CCSchedulerStateMachine::ACTION_COMMIT);
+    EXPECT_EQ(CCSchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW, state.commitState());
+    EXPECT_TRUE(state.needsRedraw());
+    EXPECT_FALSE(state.needsCommit());
+
+    // Expect to do nothing, both in and out of vsync.
+    state.didLeaveVSync();
+    EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
+    state.didEnterVSync();
     EXPECT_EQ(CCSchedulerStateMachine::ACTION_NONE, state.nextAction());
 }
 
index 614e1ee..68fef64 100644 (file)
@@ -150,9 +150,8 @@ protected:
 
 class FakeTextureAllocator : public WebCore::TextureAllocator {
 public:
-    virtual unsigned createTexture(const WebCore::IntSize&, GC3Denum) OVERRIDE { return 1; }
-    virtual void deleteTexture(unsigned, const WebCore::IntSize&, GC3Denum) OVERRIDE { }
-    virtual void deleteAllTextures() OVERRIDE { }
+    virtual unsigned createTexture(const WebCore::IntSize&, GC3Denum) { return 1; }
+    virtual void deleteTexture(unsigned, const WebCore::IntSize&, GC3Denum) { }
 };
 
 class FakeTextureCopier : public WebCore::TextureCopier {
index b864c35..191d05f 100644 (file)
@@ -35,11 +35,6 @@ namespace WebKit {
 // All operations are no-ops (returning 0 if necessary).
 class FakeWebGraphicsContext3D : public WebGraphicsContext3D {
 public:
-    FakeWebGraphicsContext3D()
-        : m_nextTextureId(1)
-    {
-    }
-
     virtual bool makeContextCurrent() { return true; }
 
     virtual int width() { return 0; }
@@ -251,7 +246,7 @@ public:
     virtual WebGLId createProgram() { return 1; }
     virtual WebGLId createRenderbuffer() { return 1; }
     virtual WebGLId createShader(WGC3Denum) { return 1; }
-    virtual WebGLId createTexture() { return m_nextTextureId++; }
+    virtual WebGLId createTexture() { return 1; }
 
     virtual void deleteBuffer(WebGLId) { }
     virtual void deleteFramebuffer(WebGLId) { }
@@ -272,7 +267,6 @@ public:
     virtual void getQueryObjectuivEXT(WebGLId, GC3Denum, GC3Duint*) { }
 
 protected:
-    unsigned m_nextTextureId;
     Attributes m_attrs;
 };
 
index e465096..64d9d71 100644 (file)
@@ -84,13 +84,12 @@ public:
     }
 
     // CCRendererClient methods.
-    virtual const IntSize& deviceViewportSize() const OVERRIDE { static IntSize fakeSize(1, 1); return fakeSize; }
+    virtual const IntSize& deviceViewportSize() const OVERRIDE { static IntSize fakeSize; return fakeSize; }
     virtual const CCLayerTreeSettings& settings() const OVERRIDE { static CCLayerTreeSettings fakeSettings; return fakeSettings; }
     virtual void didLoseContext() OVERRIDE { }
     virtual void onSwapBuffersComplete() OVERRIDE { }
     virtual void setFullRootLayerDamage() OVERRIDE { m_setFullRootLayerDamageCount++; }
-    virtual void releaseContentsTextures() OVERRIDE { }
-    virtual void setMemoryAllocationLimitBytes(size_t bytes) OVERRIDE { m_memoryAllocationLimitBytes = bytes; }
+    virtual void setContentsMemoryAllocationLimitBytes(size_t bytes) OVERRIDE { m_memoryAllocationLimitBytes = bytes; }
 
     // Methods added for test.
     int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCount; }
@@ -169,34 +168,20 @@ TEST_F(LayerRendererChromiumTest, SuggestBackbufferYesWhenItAlreadyExistsShouldD
 }
 
 // Test LayerRendererChromium discardFramebuffer functionality:
-// Suggest discarding framebuffer when one exists and the renderer is not visible.
+// Suggest discarding framebuffer when one exists.
 // Expected: it is discarded and damage tracker is reset.
-TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayerWhileNotVisible)
+TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayer)
 {
-    m_layerRendererChromium.setVisible(false);
     m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
     EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
     EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
 }
 
 // Test LayerRendererChromium discardFramebuffer functionality:
-// Suggest discarding framebuffer when one exists and the renderer is visible.
-// Expected: the allocation is ignored.
-TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoDoNothingWhenVisible)
-{
-    m_layerRendererChromium.setVisible(true);
-    m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
-    EXPECT_EQ(0, m_mockClient.setFullRootLayerDamageCount());
-    EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
-}
-
-
-// Test LayerRendererChromium discardFramebuffer functionality:
 // Suggest discarding framebuffer when one does not exist.
 // Expected: it does nothing.
 TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNothing)
 {
-    m_layerRendererChromium.setVisible(false);
     m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
     EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
     EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
@@ -207,37 +192,37 @@ TEST_F(LayerRendererChromiumTest, SuggestBackbufferNoWhenItDoesntExistShouldDoNo
 }
 
 // Test LayerRendererChromium discardFramebuffer functionality:
-// Begin drawing a frame while a framebuffer is discarded.
-// Expected: will recreate framebuffer.
-TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatedForScopeDuration)
+// Suggest discarding framebuffer, then try to swapBuffers.
+// Expected: framebuffer is discarded, swaps are ignored, and damage is reset after discard and after each swap.
+TEST_F(LayerRendererChromiumTest, SwapBuffersWhileBackbufferDiscardedShouldIgnoreSwapAndDamageRootLayer)
 {
-    m_layerRendererChromium.setVisible(false);
     m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
     EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
     EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
 
-    m_layerRendererChromium.setVisible(true);
-    m_layerRendererChromium.beginDrawingFrame(m_mockClient.rootRenderPass());
-    EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
+    swapBuffers();
+    EXPECT_EQ(0, m_mockContext.frameCount());
+    EXPECT_EQ(2, m_mockClient.setFullRootLayerDamageCount());
 
     swapBuffers();
-    EXPECT_EQ(1, m_mockContext.frameCount());
+    EXPECT_EQ(0, m_mockContext.frameCount());
+    EXPECT_EQ(3, m_mockClient.setFullRootLayerDamageCount());
 }
 
-TEST_F(LayerRendererChromiumTest, FramebufferDiscardedAfterReadbackWhenNotVisible)
+// Test LayerRendererChromium discardFramebuffer functionality:
+// Begin drawing a frame while a framebuffer is discarded.
+// Expected: will recreate framebuffer.
+TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatredForScopeDuration)
 {
-    m_layerRendererChromium.setVisible(false);
     m_mockContext.setMemoryAllocation(m_suggestHaveBackbufferNo);
     EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
     EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
 
-    char pixels[4];
     m_layerRendererChromium.beginDrawingFrame(m_mockClient.rootRenderPass());
     EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
 
-    m_layerRendererChromium.getFramebufferPixels(pixels, IntRect(0, 0, 1, 1));
-    EXPECT_TRUE(m_layerRendererChromium.isFramebufferDiscarded());
-    EXPECT_EQ(2, m_mockClient.setFullRootLayerDamageCount());
+    swapBuffers();
+    EXPECT_EQ(1, m_mockContext.frameCount());
 }
 
 class ForbidSynchronousCallContext : public FakeWebGraphicsContext3D {
index 9495e70..073fa19 100644 (file)
@@ -824,7 +824,8 @@ TEST(TiledLayerChromiumTest, skipsDrawGetsReset)
 
     ccLayerTreeHost->setRootLayer(rootLayer);
     ccLayerTreeHost->setViewportSize(IntSize(300, 300));
-    ccLayerTreeHost->updateLayers(updater, memoryLimit);
+    textureManager->setMaxMemoryLimitBytes(memoryLimit);
+    ccLayerTreeHost->updateLayers(updater);
 
     // We'll skip the root layer.
     EXPECT_TRUE(rootLayer->skipsDraw());
@@ -836,7 +837,7 @@ TEST(TiledLayerChromiumTest, skipsDrawGetsReset)
     // Remove the child layer.
     rootLayer->removeAllChildren();
 
-    ccLayerTreeHost->updateLayers(updater, memoryLimit);
+    ccLayerTreeHost->updateLayers(updater);
     EXPECT_FALSE(rootLayer->skipsDraw());
 
     ccLayerTreeHost->setRootLayer(0);
@@ -903,7 +904,7 @@ TEST(TiledLayerChromiumTest, partialUpdates)
     ccLayerTreeHost->setViewportSize(IntSize(300, 200));
 
     // Full update of all 6 tiles.
-    ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+    ccLayerTreeHost->updateLayers(updater);
     {
         DebugScopedSetImplThread implThread;
         OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
@@ -921,7 +922,7 @@ TEST(TiledLayerChromiumTest, partialUpdates)
 
     // Full update of 3 tiles and partial update of 3 tiles.
     layer->invalidateRect(IntRect(0, 0, 300, 150));
-    ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+    ccLayerTreeHost->updateLayers(updater);
     {
         DebugScopedSetImplThread implThread;
         OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
@@ -942,7 +943,7 @@ TEST(TiledLayerChromiumTest, partialUpdates)
     {
         DebugScopedSetImplThread implThread;
         OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
-        ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        ccLayerTreeHost->updateLayers(updater);
         updater.update(0, &allocator, &copier, &uploader, 4);
         EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount());
         EXPECT_TRUE(updater.hasMoreUpdates());
@@ -969,7 +970,7 @@ TEST(TiledLayerChromiumTest, partialUpdates)
     {
         DebugScopedSetImplThread implThread;
         OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
-        ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        ccLayerTreeHost->updateLayers(updater);
         updater.update(0, &allocator, &copier, &uploader, 4);
         EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
         EXPECT_TRUE(updater.hasMoreUpdates());
@@ -987,7 +988,7 @@ TEST(TiledLayerChromiumTest, partialUpdates)
     {
         DebugScopedSetImplThread implThread;
         OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
-        ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max());
+        ccLayerTreeHost->updateLayers(updater);
         updater.update(0, &allocator, &copier, &uploader, 4);
         EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount());
         EXPECT_FALSE(updater.hasMoreUpdates());