Index: Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp |
=================================================================== |
--- Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (revision 122257) |
+++ Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (working copy) |
@@ -29,6 +29,7 @@ |
#include "Extensions3D.h" |
#include "LayerRendererChromium.h" |
#include "TraceEvent.h" |
+#include "TrackingTextureAllocator.h" |
#include "cc/CCActiveGestureAnimation.h" |
#include "cc/CCDamageTracker.h" |
#include "cc/CCDebugRectHistory.h" |
@@ -122,7 +123,8 @@ |
, m_settings(settings) |
, m_deviceScaleFactor(1) |
, m_visible(true) |
- , m_sourceFrameCanBeDrawn(true) |
+ , m_contentsTexturesWerePurgedSinceLastCommit(false) |
+ , m_memoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize())) |
, m_headsUpDisplay(CCHeadsUpDisplay::create()) |
, m_pageScale(1) |
, m_pageScaleDelta(1) |
@@ -157,6 +159,7 @@ |
// Recompute max scroll position; must be after layer content bounds are |
// updated. |
updateMaxScrollPosition(); |
+ m_contentsTexturesWerePurgedSinceLastCommit = false; |
} |
bool CCLayerTreeHostImpl::canDraw() |
@@ -167,12 +170,12 @@ |
return false; |
if (!m_layerRenderer) |
return false; |
- if (!m_sourceFrameCanBeDrawn) |
+ if (m_contentsTexturesWerePurgedSinceLastCommit) |
return false; |
return true; |
} |
-CCGraphicsContext* CCLayerTreeHostImpl::context() |
+CCGraphicsContext* CCLayerTreeHostImpl::context() const |
{ |
return m_context.get(); |
} |
@@ -402,11 +405,22 @@ |
return true; |
} |
-void CCLayerTreeHostImpl::setContentsMemoryAllocationLimitBytes(size_t bytes) |
+void CCLayerTreeHostImpl::releaseContentsTextures() |
{ |
- m_client->postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(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(); |
+} |
+ |
void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) |
{ |
TRACE_EVENT0("cc", "CCLayerTreeHostImpl::drawLayers"); |