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

Unified Diff: cc/thread_proxy.cc

Issue 12217105: cc: Check for completed raster tasks at interval. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Post task to impl thread when worker pool becomes idle. Created 7 years, 10 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
« no previous file with comments | « cc/thread_proxy.h ('k') | cc/tile_manager.h » ('j') | cc/worker_pool.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/thread_proxy.cc
diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
index fe92817ea58a659061e98380f4953a1c5dd5043c..21c826ce01cb9a045c9f09d0dfdcff23f6fe71a0 100644
--- a/cc/thread_proxy.cc
+++ b/cc/thread_proxy.cc
@@ -29,6 +29,9 @@ const double contextRecreationTickRate = 0.03;
// Measured in seconds.
const double smoothnessTakesPriorityExpirationDelay = 0.25;
+// Measured in seconds.
+const double checkForCompletedRasterTasksDelay = 0.004;
+
} // namespace
namespace cc {
@@ -51,6 +54,8 @@ ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost, scoped_ptr<Thread> implTh
, m_manageTilesPending(false)
, m_weakFactoryOnImplThread(ALLOW_THIS_IN_INITIALIZER_LIST(this))
, m_weakFactory(ALLOW_THIS_IN_INITIALIZER_LIST(this))
+ , m_weakCheckForCompletedRasterTasksFactory(
+ ALLOW_THIS_IN_INITIALIZER_LIST(this))
, m_beginFrameCompletionEventOnImplThread(0)
, m_readbackRequestOnImplThread(0)
, m_commitCompletionEventOnImplThread(0)
@@ -62,6 +67,7 @@ ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost, scoped_ptr<Thread> implTh
, m_totalCommitCount(0)
, m_deferCommits(false)
, m_renewTreePriorityOnImplThreadPending(false)
+ , m_checkForCompletedRasterTasksPending(false)
{
TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy");
DCHECK(isMainThread());
@@ -355,6 +361,7 @@ void ThreadProxy::setNeedsCommitOnImplThread()
void ThreadProxy::setNeedsManageTilesOnImplThread()
{
+ DCHECK(isImplThread());
if (m_manageTilesPending)
return;
Proxy::implThread()->postTask(base::Bind(&ThreadProxy::manageTilesOnImplThread, m_implThreadWeakPtr));
@@ -363,12 +370,33 @@ void ThreadProxy::setNeedsManageTilesOnImplThread()
void ThreadProxy::manageTilesOnImplThread()
{
+ DCHECK(isImplThread());
// TODO(nduca): If needed, move this into CCSchedulerStateMachine.
m_manageTilesPending = false;
if (m_layerTreeHostImpl)
m_layerTreeHostImpl->manageTiles();
}
+void ThreadProxy::setNeedsCheckForCompletedRasterTasksOnImplThread()
+{
+ DCHECK(isImplThread());
+ if (m_checkForCompletedRasterTasksPending)
+ return;
+ Proxy::implThread()->postDelayedTask(
+ base::Bind(&ThreadProxy::checkForCompletedRasterTasksOnImplThread,
+ m_weakCheckForCompletedRasterTasksFactory.GetWeakPtr()),
+ checkForCompletedRasterTasksDelay * 1000);
+ m_checkForCompletedRasterTasksPending = true;
+}
+
+void ThreadProxy::checkForCompletedRasterTasksOnImplThread()
+{
+ DCHECK(isImplThread());
+ m_checkForCompletedRasterTasksPending = false;
+ if (m_layerTreeHostImpl)
+ m_layerTreeHostImpl->checkForCompletedRasterTasks();
+}
+
void ThreadProxy::setNeedsForcedCommitOnImplThread()
{
DCHECK(isImplThread());
@@ -486,6 +514,20 @@ void ThreadProxy::didUploadVisibleHighResolutionTileOnImplThread()
m_schedulerOnImplThread->setNeedsRedraw();
}
+void ThreadProxy::didDetectIdleRasterOnImplThread()
+{
+ DCHECK(isImplThread());
+ TRACE_EVENT0("cc", "ThreadProxy::didDetectIdleRasterOnImplThread");
+
+ // Cancel pending check.
+ m_weakCheckForCompletedRasterTasksFactory.InvalidateWeakPtrs();
+ m_checkForCompletedRasterTasksPending = false;
+
+ // Perform immediate check.
+ if (m_layerTreeHostImpl)
+ m_layerTreeHostImpl->checkForCompletedRasterTasks();
+}
+
void ThreadProxy::mainThreadHasStoppedFlinging()
{
if (m_inputHandlerOnImplThread)
@@ -1045,6 +1087,7 @@ void ThreadProxy::layerTreeHostClosedOnImplThread(CompletionEvent* completion)
m_layerTreeHostImpl.reset();
m_schedulerOnImplThread.reset();
m_weakFactoryOnImplThread.InvalidateWeakPtrs();
+ m_weakCheckForCompletedRasterTasksFactory.InvalidateWeakPtrs();
completion->signal();
}
« no previous file with comments | « cc/thread_proxy.h ('k') | cc/tile_manager.h » ('j') | cc/worker_pool.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698