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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 365463003: Implement scroll handler latency tracking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 4 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/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 2d7a9323edf74e7bceb7eab96100f2d8996b12f6..061a8041e62ded0b334a0ca12bb67f6d659386d3 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -503,6 +503,11 @@ LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor(
new LatencyInfoSwapPromiseMonitor(latency, NULL, this));
}
+void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate(
+ scoped_ptr<SwapPromise> swap_promise) {
+ swap_promises_for_main_thread_scroll_update_.push_back(swap_promise.Pass());
+}
+
void LayerTreeHostImpl::TrackDamageForAllSurfaces(
LayerImpl* root_draw_layer,
const LayerImplList& render_surface_layer_list) {
@@ -2648,6 +2653,11 @@ bool LayerTreeHostImpl::ScrollBy(const gfx::Point& viewport_point,
bool did_scroll_content = did_scroll_x || did_scroll_y;
if (did_scroll_content) {
+ // If we are scrolling with an active scroll handler, forward latency
+ // tracking information to the main thread so the delay introduced by the
+ // handler is accounted for.
+ if (scroll_affects_scroll_handler())
+ NotifySwapPromiseMonitorsOfForwardingToMainThread();
client_->SetNeedsCommitOnImplThread();
SetNeedsRedraw();
client_->RenewTreePriority();
@@ -2949,6 +2959,7 @@ scoped_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() {
CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer());
scroll_info->page_scale_delta = active_tree_->page_scale_delta();
active_tree_->set_sent_page_scale_delta(scroll_info->page_scale_delta);
+ scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_);
return scroll_info.Pass();
}
@@ -3362,6 +3373,12 @@ void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() {
(*it)->OnSetNeedsRedrawOnImpl();
}
+void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() {
+ std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
+ for (; it != swap_promise_monitor_.end(); it++)
+ (*it)->OnForwardScrollUpdateToMainThreadOnImpl();
+}
+
void LayerTreeHostImpl::RegisterPictureLayerImpl(PictureLayerImpl* layer) {
DCHECK(std::find(picture_layers_.begin(), picture_layers_.end(), layer) ==
picture_layers_.end());
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698