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

Side by Side Diff: cc/trees/layer_tree_host.cc

Issue 20994007: Add impl/comp scrolling instrumentation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 988
989 in_paint_layer_contents_ = false; 989 in_paint_layer_contents_ = false;
990 990
991 occlusion_tracker.overdraw_metrics()->RecordMetrics(this); 991 occlusion_tracker.overdraw_metrics()->RecordMetrics(this);
992 } 992 }
993 993
994 void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) { 994 void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) {
995 if (!root_layer_.get()) 995 if (!root_layer_.get())
996 return; 996 return;
997 997
998 const bool has_scrolls =
999 !info.scrolls.empty() || info.page_scale_delta != 1.0f;
1000
1001 if (has_scrolls) {
1002 // We use async events here because we want to conditionally trace. This
1003 // is too spammy otherwise.
1004 TRACE_EVENT_ASYNC_BEGIN0(
dsinclair 2013/08/08 17:30:14 Why not TRACE_EVENT_BEGIN0 and END0 below?
1005 "impl-scroll",
1006 "LayerTreeHost::ApplyScrollAndScale",
1007 this);
1008 }
1009
998 gfx::Vector2d root_scroll_delta; 1010 gfx::Vector2d root_scroll_delta;
999 Layer* root_scroll_layer = FindFirstScrollableLayer(root_layer_.get()); 1011 Layer* root_scroll_layer = FindFirstScrollableLayer(root_layer_.get());
1000 1012
1001 for (size_t i = 0; i < info.scrolls.size(); ++i) { 1013 for (size_t i = 0; i < info.scrolls.size(); ++i) {
1002 Layer* layer = 1014 Layer* layer =
1003 LayerTreeHostCommon::FindLayerInSubtree(root_layer_.get(), 1015 LayerTreeHostCommon::FindLayerInSubtree(root_layer_.get(),
1004 info.scrolls[i].layer_id); 1016 info.scrolls[i].layer_id);
1005 if (!layer) 1017 if (!layer)
1006 continue; 1018 continue;
1007 if (layer == root_scroll_layer) { 1019 if (layer == root_scroll_layer) {
(...skipping 12 matching lines...) Expand all
1020 // Preemptively apply the scroll offset and scale delta here before sending 1032 // Preemptively apply the scroll offset and scale delta here before sending
1021 // it to the client. If the client comes back and sets it to the same 1033 // it to the client. If the client comes back and sets it to the same
1022 // value, then the layer can early out without needing a full commit. 1034 // value, then the layer can early out without needing a full commit.
1023 if (root_scroll_layer) { 1035 if (root_scroll_layer) {
1024 root_scroll_layer->SetScrollOffsetFromImplSide( 1036 root_scroll_layer->SetScrollOffsetFromImplSide(
1025 root_scroll_layer->scroll_offset() + root_scroll_delta); 1037 root_scroll_layer->scroll_offset() + root_scroll_delta);
1026 } 1038 }
1027 ApplyPageScaleDeltaFromImplSide(info.page_scale_delta); 1039 ApplyPageScaleDeltaFromImplSide(info.page_scale_delta);
1028 client_->ApplyScrollAndScale(root_scroll_delta, info.page_scale_delta); 1040 client_->ApplyScrollAndScale(root_scroll_delta, info.page_scale_delta);
1029 } 1041 }
1042
1043 if (has_scrolls) {
1044 TRACE_EVENT_ASYNC_END0(
1045 "impl-scroll",
1046 "LayerTreeHost::ApplyScrollAndScale",
1047 this);
1048 }
1030 } 1049 }
1031 1050
1032 void LayerTreeHost::StartRateLimiter(WebKit::WebGraphicsContext3D* context3d) { 1051 void LayerTreeHost::StartRateLimiter(WebKit::WebGraphicsContext3D* context3d) {
1033 if (animating_) 1052 if (animating_)
1034 return; 1053 return;
1035 1054
1036 DCHECK(context3d); 1055 DCHECK(context3d);
1037 RateLimiterMap::iterator it = rate_limiters_.find(context3d); 1056 RateLimiterMap::iterator it = rate_limiters_.find(context3d);
1038 if (it != rate_limiters_.end()) { 1057 if (it != rate_limiters_.end()) {
1039 it->second->Start(); 1058 it->second->Start();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 void LayerTreeHost::DidLoseUIResources() { 1191 void LayerTreeHost::DidLoseUIResources() {
1173 // When output surface is lost, we need to recreate the resource. 1192 // When output surface is lost, we need to recreate the resource.
1174 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); 1193 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin();
1175 iter != ui_resource_client_map_.end(); 1194 iter != ui_resource_client_map_.end();
1176 ++iter) { 1195 ++iter) {
1177 UIResourceLost(iter->first); 1196 UIResourceLost(iter->first);
1178 } 1197 }
1179 } 1198 }
1180 1199
1181 } // namespace cc 1200 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698