| Index: Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
|
| ===================================================================
|
| --- Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (revision 122257)
|
| +++ Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (working copy)
|
| @@ -72,7 +72,6 @@
|
| , m_needsAnimateLayers(false)
|
| , m_client(client)
|
| , m_frameNumber(0)
|
| - , m_frameIsForDisplay(false)
|
| , m_layerRendererInitialized(false)
|
| , m_contextLost(false)
|
| , m_numTimesRecreateShouldFail(0)
|
| @@ -80,8 +79,6 @@
|
| , m_settings(settings)
|
| , m_deviceScaleFactor(1)
|
| , m_visible(true)
|
| - , m_memoryAllocationBytes(0)
|
| - , m_memoryAllocationIsForDisplay(false)
|
| , m_pageScaleFactor(1)
|
| , m_minPageScaleFactor(1)
|
| , m_maxPageScaleFactor(1)
|
| @@ -151,11 +148,6 @@
|
|
|
| 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),
|
| @@ -256,8 +248,6 @@
|
| 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++;
|
| }
|
| @@ -328,11 +318,6 @@
|
| m_proxy->setNeedsCommit();
|
| }
|
|
|
| -void CCLayerTreeHost::setNeedsForcedCommit()
|
| -{
|
| - m_proxy->setNeedsForcedCommit();
|
| -}
|
| -
|
| void CCLayerTreeHost::setNeedsRedraw()
|
| {
|
| m_proxy->setNeedsRedraw();
|
| @@ -398,35 +383,15 @@
|
| {
|
| if (m_visible == visible)
|
| return;
|
| -
|
| m_visible = 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();
|
| + m_proxy->setVisible(visible);
|
| }
|
|
|
| -void CCLayerTreeHost::setContentsMemoryAllocationLimitBytes(size_t bytes)
|
| +void CCLayerTreeHost::evictAllContentTextures()
|
| {
|
| ASSERT(CCProxy::isMainThread());
|
| - 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();
|
| + ASSERT(m_contentsTextureManager.get());
|
| + m_contentsTextureManager->evictAndRemoveAllDeletedTextures();
|
| }
|
|
|
| void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec)
|
| @@ -473,19 +438,10 @@
|
| }
|
|
|
|
|
| -void CCLayerTreeHost::updateLayers(CCTextureUpdater& updater)
|
| +void CCLayerTreeHost::updateLayers(CCTextureUpdater& updater, size_t contentsMemoryLimitBytes)
|
| {
|
| ASSERT(m_layerRendererInitialized);
|
| - // 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;
|
| - }
|
| + ASSERT(contentsMemoryLimitBytes);
|
|
|
| if (!rootLayer())
|
| return;
|
| @@ -493,6 +449,8 @@
|
| if (viewportSize().isEmpty())
|
| return;
|
|
|
| + m_contentsTextureManager->setMemoryAllocationLimitBytes(contentsMemoryLimitBytes);
|
| +
|
| updateLayers(rootLayer(), updater);
|
| }
|
|
|
|
|