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

Unified Diff: cc/CCSingleThreadProxy.cpp

Issue 10916292: Adaptively throttle texture uploads (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add tests. 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/CCSingleThreadProxy.cpp
diff --git a/cc/CCSingleThreadProxy.cpp b/cc/CCSingleThreadProxy.cpp
index f6d4f67f1a9cb60c058611abbc39c5f57cc775e2..a373fc6ee61e9275b1d77e14688babff999bfa49 100644
--- a/cc/CCSingleThreadProxy.cpp
+++ b/cc/CCSingleThreadProxy.cpp
@@ -16,6 +16,13 @@
using namespace WTF;
+namespace {
+
+// We don't need to split texture uploads into multiple batches if we are single threaded.
+const size_t maxTextureUpdates = std::numeric_limits<size_t>::max();
+
+}
+
namespace WebCore {
PassOwnPtr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost)
@@ -28,6 +35,8 @@ CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost)
, m_contextLost(false)
, m_rendererInitialized(false)
, m_nextFrameIsNewlyCommittedFrame(false)
+ , m_totalCommitTime(0)
+ , m_totalCommitCount(0)
{
TRACE_EVENT0("cc", "CCSingleThreadProxy::CCSingleThreadProxy");
ASSERT(CCProxy::isMainThread());
@@ -150,8 +159,10 @@ bool CCSingleThreadProxy::recreateContext()
return initialized;
}
-void CCSingleThreadProxy::implSideRenderingStats(CCRenderingStats& stats)
+void CCSingleThreadProxy::renderingStats(CCRenderingStats& stats)
{
+ stats.totalCommitTimeInSeconds = m_totalCommitTime;
+ stats.totalCommitCount = m_totalCommitCount;
m_layerTreeHostImpl->renderingStats(stats);
}
@@ -183,6 +194,7 @@ void CCSingleThreadProxy::doCommit(CCTextureUpdateQueue& queue)
DebugScopedSetMainThreadBlocked mainThreadBlocked;
DebugScopedSetImplThread impl;
+ double startTime = WTF::monotonicallyIncreasingTime();
m_layerTreeHostImpl->beginCommit();
m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get());
@@ -193,7 +205,7 @@ void CCSingleThreadProxy::doCommit(CCTextureUpdateQueue& queue)
// single thread mode. For correctness, loop until no more updates are
// pending.
while (queue.hasMoreUpdates())
- CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader(), &queue, maxPartialTextureUpdates());
+ CCTextureUpdateController::updateTextures(m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader(), &queue, maxTextureUpdates);
m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get());
@@ -205,6 +217,11 @@ void CCSingleThreadProxy::doCommit(CCTextureUpdateQueue& queue)
OwnPtr<CCScrollAndScaleSet> scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
ASSERT(!scrollInfo->scrolls.size());
#endif
+
+ double endTime = WTF::monotonicallyIncreasingTime();
+ double commitTime = endTime - startTime;
+ m_totalCommitTime += commitTime;
+ m_totalCommitCount++;
}
m_layerTreeHost->commitComplete();
m_nextFrameIsNewlyCommittedFrame = true;
@@ -287,7 +304,7 @@ bool CCSingleThreadProxy::commitAndComposite()
}
CCTextureUpdateQueue queue;
- m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLimitBytes());
+ m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLimitBytes(), maxTextureUpdates);
m_layerTreeHostImpl->resetContentsTexturesPurged();
m_layerTreeHost->willCommit();

Powered by Google App Engine
This is Rietveld 408576698