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

Unified Diff: cc/trees/thread_proxy.cc

Issue 13947038: Retry tree activation if raster tasks finish during first half of vsync interval (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/trees/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/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 3cc54e64b5524c134e4f3232982201e5925e1b1b..deccf0eb4ff62a36faedaa26c0e8fb8201c6de74 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -28,6 +28,10 @@ const double kContextRecreationTickRate = 0.03;
// Measured in seconds.
const double kSmoothnessTakesPriorityExpirationDelay = 0.25;
+// Time period in seconds from the previous vsync during which we are allowed to
+// retry tree activation and rendering.
+const double kTreeActivationGracePeriod = 0.008;
+
} // namespace
namespace cc {
@@ -849,6 +853,21 @@ void ThreadProxy::ScheduledActionActivatePendingTreeIfNeeded() {
layer_tree_host_impl_->ActivatePendingTreeIfNeeded();
}
+void ThreadProxy::DidFinishTileRasterTasks() {
+ DCHECK(IsImplThread());
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::DidFinishTileRasterTasks");
+ base::TimeDelta time_since_vsync =
+ base::TimeTicks::Now() - scheduler_on_impl_thread_->LastVSyncTime();
+ base::TimeDelta grace_period =
+ base::TimeDelta::FromMilliseconds(kTreeActivationGracePeriod);
+ if (time_since_vsync > grace_period) {
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::DidFinishTileRasterTasks: too late");
+ return;
+ }
+ if (layer_tree_host_impl_->ActivatePendingTreeIfNeeded())
+ scheduler_on_impl_thread_->VSyncTick(false);
+}
+
void ThreadProxy::ScheduledActionBeginContextRecreation() {
DCHECK(IsImplThread());
Proxy::MainThread()->PostTask(
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698