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

Unified Diff: cc/thread_proxy.cc

Issue 11416043: Merge 167537 - Use message passing for BeginFrameAndCommitState and clean up forced commit logic (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1312/src/
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « cc/thread_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/thread_proxy.cc
===================================================================
--- cc/thread_proxy.cc (revision 168251)
+++ cc/thread_proxy.cc (working copy)
@@ -38,7 +38,6 @@
: m_animateRequested(false)
, m_commitRequested(false)
, m_commitRequestSentToImplThread(false)
- , m_forcedCommitRequested(false)
, m_layerTreeHost(layerTreeHost)
, m_rendererInitialized(false)
, m_started(false)
@@ -53,7 +52,6 @@
, m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled)
, m_totalCommitCount(0)
, m_deferCommits(false)
- , m_deferredCommitPending(false)
{
TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy");
DCHECK(isMainThread());
@@ -68,7 +66,7 @@
bool ThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
{
- TRACE_EVENT0("cc", "ThreadPRoxy::compositeAndReadback");
+ TRACE_EVENT0("cc", "ThreadProxy::compositeAndReadback");
DCHECK(isMainThread());
DCHECK(m_layerTreeHost);
DCHECK(!m_deferCommits);
@@ -87,7 +85,7 @@
beginFrameCompletion.wait();
}
m_inCompositeAndReadback = true;
- beginFrame();
+ beginFrame(NULL);
m_inCompositeAndReadback = false;
// Perform a synchronous readback.
@@ -338,7 +336,6 @@
{
DCHECK(isImplThread());
TRACE_EVENT0("cc", "ThreadProxy::setNeedsForcedCommitOnImplThread");
- m_schedulerOnImplThread->setNeedsCommit();
m_schedulerOnImplThread->setNeedsForcedCommit();
}
@@ -404,10 +401,8 @@
else
TRACE_EVENT_ASYNC_END0("cc", "ThreadProxy::setDeferCommits", this);
- if (!m_deferCommits && m_deferredCommitPending) {
- m_deferredCommitPending = false;
- m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::beginFrame));
- }
+ if (!m_deferCommits && m_pendingDeferredCommit)
+ m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::beginFrame, m_pendingDeferredCommit.release()));
}
bool ThreadProxy::commitRequested() const
@@ -488,28 +483,28 @@
TRACE_EVENT0("cc", "ThreadProxy::forceBeginFrameOnImplThread");
DCHECK(!m_beginFrameCompletionEventOnImplThread);
+ setNeedsForcedCommitOnImplThread();
if (m_schedulerOnImplThread->commitPending()) {
completion->signal();
return;
}
m_beginFrameCompletionEventOnImplThread = completion;
- setNeedsForcedCommitOnImplThread();
}
void ThreadProxy::scheduledActionBeginFrame()
{
TRACE_EVENT0("cc", "ThreadProxy::scheduledActionBeginFrame");
- DCHECK(!m_pendingBeginFrameRequest);
- m_pendingBeginFrameRequest = make_scoped_ptr(new BeginFrameAndCommitState());
- m_pendingBeginFrameRequest->monotonicFrameBeginTime = base::TimeTicks::Now();
- m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
- m_pendingBeginFrameRequest->implTransform = m_layerTreeHostImpl->implTransform();
- m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAllocationLimitBytes();
+ scoped_ptr<BeginFrameAndCommitState> beginFrameState(new BeginFrameAndCommitState);
+ beginFrameState->monotonicFrameBeginTime = base::TimeTicks::Now();
+ beginFrameState->scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
+ beginFrameState->implTransform = m_layerTreeHostImpl->implTransform();
+ DCHECK_GT(m_layerTreeHostImpl->memoryAllocationLimitBytes(), 0u);
+ beginFrameState->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAllocationLimitBytes();
if (m_layerTreeHost->contentsTextureManager())
- m_layerTreeHost->contentsTextureManager()->getEvictedBackings(m_pendingBeginFrameRequest->evictedContentsTexturesBackings);
+ m_layerTreeHost->contentsTextureManager()->getEvictedBackings(beginFrameState->evictedContentsTexturesBackings);
- m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::beginFrame));
+ m_mainThreadProxy->postTask(createThreadTask(this, &ThreadProxy::beginFrame, beginFrameState.release()));
if (m_beginFrameCompletionEventOnImplThread) {
m_beginFrameCompletionEventOnImplThread->signal();
@@ -517,30 +512,24 @@
}
}
-void ThreadProxy::beginFrame()
+void ThreadProxy::beginFrame(BeginFrameAndCommitState* rawBeginFrameState)
{
+ scoped_ptr<BeginFrameAndCommitState> beginFrameState(rawBeginFrameState);
TRACE_EVENT0("cc", "ThreadProxy::beginFrame");
DCHECK(isMainThread());
if (!m_layerTreeHost)
return;
if (m_deferCommits) {
- m_deferredCommitPending = true;
+ m_pendingDeferredCommit = beginFrameState.Pass();
m_layerTreeHost->didDeferCommit();
TRACE_EVENT0("cc", "EarlyOut_DeferCommits");
return;
}
- if (!m_pendingBeginFrameRequest) {
- TRACE_EVENT0("cc", "EarlyOut_StaleBeginFrameMessage");
- return;
- }
-
if (m_layerTreeHost->needsSharedContext() && !WebSharedGraphicsContext3D::haveCompositorThreadContext())
WebSharedGraphicsContext3D::createCompositorThreadContext();
- scoped_ptr<BeginFrameAndCommitState> request(m_pendingBeginFrameRequest.Pass());
-
// Do not notify the impl thread of commit requests that occur during
// the apply/animate/layout part of the beginFrameAndCommit process since
// those commit requests will get painted immediately. Once we have done
@@ -554,15 +543,14 @@
// callbacks will trigger another frame.
m_animateRequested = false;
- // FIXME: technically, scroll deltas need to be applied for dropped commits as well.
- // Re-do the commit flow so that we don't send the scrollInfo on the BFAC message.
- m_layerTreeHost->applyScrollAndScale(*request->scrollInfo);
- m_layerTreeHost->setImplTransform(request->implTransform);
+ if (beginFrameState) {
+ m_layerTreeHost->applyScrollAndScale(*beginFrameState->scrollInfo);
+ m_layerTreeHost->setImplTransform(beginFrameState->implTransform);
+ }
if (!m_inCompositeAndReadback && !m_layerTreeHost->visible()) {
m_commitRequested = false;
m_commitRequestSentToImplThread = false;
- m_forcedCommitRequested = false;
TRACE_EVENT0("cc", "EarlyOut_NotVisible");
Proxy::implThread()->postTask(createThreadTask(this, &ThreadProxy::beginFrameAbortedOnImplThread));
@@ -571,7 +559,8 @@
m_layerTreeHost->willBeginFrame();
- m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime);
+ if (beginFrameState)
+ m_layerTreeHost->updateAnimations(beginFrameState->monotonicFrameBeginTime);
m_layerTreeHost->layout();
// Clear the commit flag after updating animations and layout here --- objects that only
@@ -579,17 +568,17 @@
// updateLayers.
m_commitRequested = false;
m_commitRequestSentToImplThread = false;
- m_forcedCommitRequested = false;
if (!m_layerTreeHost->initializeRendererIfNeeded()) {
TRACE_EVENT0("cc", "EarlyOut_InitializeFailed");
return;
}
- m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(request->evictedContentsTexturesBackings);
+ if (beginFrameState)
+ m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(beginFrameState->evictedContentsTexturesBackings);
scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQueue);
- m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimitBytes);
+ m_layerTreeHost->updateLayers(*(queue.get()), beginFrameState ? beginFrameState->memoryAllocationLimitBytes : 0);
// Once single buffered layers are committed, they cannot be modified until
// they are drawn by the impl thread.
@@ -1002,6 +991,7 @@
}
ThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState()
+ : memoryAllocationLimitBytes(0)
{
}
« no previous file with comments | « cc/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698