Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3510)

Unified Diff: cc/CCLayerTreeHost.cpp

Issue 10916292: Adaptively throttle texture uploads (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/CCLayerTreeHost.cpp
diff --git a/cc/CCLayerTreeHost.cpp b/cc/CCLayerTreeHost.cpp
index 08e1141c7cc72d1a6a69214d0da8ae86fb29c65c..1f4abc8dda6ff7a56032772700c8893e5f13a5cf 100644
--- a/cc/CCLayerTreeHost.cpp
+++ b/cc/CCLayerTreeHost.cpp
@@ -68,6 +68,7 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTre
, m_triggerIdleUpdates(true)
, m_backgroundColor(SK_ColorWHITE)
, m_hasTransparentBackground(false)
+ , m_maxPartialTextureUpdates(0)
, m_partialTextureUpdateRequests(0)
{
ASSERT(CCProxy::isMainThread());
@@ -119,9 +120,6 @@ void CCLayerTreeHost::initializeRenderer()
// Update m_settings based on capabilities that we got back from the renderer.
m_settings.acceleratePainting = m_proxy->rendererCapabilities().usingAcceleratedPainting;
- // Update m_settings based on partial update capability.
- m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates());
-
m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, CCRenderer::ContentPool);
m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GraphicsContext3D::RGBA);
@@ -451,7 +449,7 @@ bool CCLayerTreeHost::initializeRendererIfNeeded()
return true;
}
-void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAllocationLimitBytes)
+void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAllocationLimitBytes, size_t *maxTextureUpdates)
{
ASSERT(m_rendererInitialized);
ASSERT(memoryAllocationLimitBytes);
@@ -464,7 +462,7 @@ void CCLayerTreeHost::updateLayers(CCTextureUpdateQueue& queue, size_t memoryAll
m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes);
- updateLayers(rootLayer(), queue);
+ updateLayers(rootLayer(), queue, maxTextureUpdates);
}
static void setScale(LayerChromium* layer, float deviceScaleFactor, float pageScaleFactor)
@@ -492,7 +490,7 @@ static void updateLayerScale(LayerChromium* layer, float deviceScaleFactor, floa
updateLayerScale(children[i].get(), deviceScaleFactor, pageScaleFactor);
}
-void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueue& queue)
+void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueue& queue, size_t *maxTextureUpdates)
{
TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers");
@@ -508,6 +506,8 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu
// Reset partial texture update requests.
m_partialTextureUpdateRequests = 0;
+ m_maxPartialTextureUpdates = std::min(m_settings.maxPartialTextureUpdates, *maxTextureUpdates);
+ *maxTextureUpdates = m_maxPartialTextureUpdates; // We need to communicate that we've clamped.
brianderson 2012/09/13 20:09:26 Actually, I shouldn't communicate that we've clamp
bool needMoreUpdates = paintLayerContents(updateList, queue);
if (m_triggerIdleUpdates && needMoreUpdates)
@@ -716,7 +716,7 @@ bool CCLayerTreeHost::bufferedUpdates()
bool CCLayerTreeHost::requestPartialTextureUpdate()
{
- if (m_partialTextureUpdateRequests >= m_settings.maxPartialTextureUpdates)
+ if (m_partialTextureUpdateRequests >= m_maxPartialTextureUpdates)
return false;
m_partialTextureUpdateRequests++;

Powered by Google App Engine
This is Rietveld 408576698