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

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

Issue 12519006: cc:: Add RenderingStatsInstrumentation to manage collection of RenderingStats (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to LayerTreeTest Created 7 years, 9 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
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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "cc/animation/scrollbar_animation_controller.h" 15 #include "cc/animation/scrollbar_animation_controller.h"
16 #include "cc/base/math_util.h" 16 #include "cc/base/math_util.h"
17 #include "cc/base/util.h" 17 #include "cc/base/util.h"
18 #include "cc/debug/debug_rect_history.h" 18 #include "cc/debug/debug_rect_history.h"
19 #include "cc/debug/frame_rate_counter.h" 19 #include "cc/debug/frame_rate_counter.h"
20 #include "cc/debug/overdraw_metrics.h" 20 #include "cc/debug/overdraw_metrics.h"
21 #include "cc/debug/paint_time_counter.h" 21 #include "cc/debug/paint_time_counter.h"
22 #include "cc/debug/rendering_stats.h" 22 #include "cc/debug/rendering_stats_instrumentation.h"
23 #include "cc/input/page_scale_animation.h" 23 #include "cc/input/page_scale_animation.h"
24 #include "cc/input/top_controls_manager.h" 24 #include "cc/input/top_controls_manager.h"
25 #include "cc/layers/append_quads_data.h" 25 #include "cc/layers/append_quads_data.h"
26 #include "cc/layers/heads_up_display_layer_impl.h" 26 #include "cc/layers/heads_up_display_layer_impl.h"
27 #include "cc/layers/layer_iterator.h" 27 #include "cc/layers/layer_iterator.h"
28 #include "cc/layers/scrollbar_layer_impl.h" 28 #include "cc/layers/scrollbar_layer_impl.h"
29 #include "cc/output/compositor_frame_metadata.h" 29 #include "cc/output/compositor_frame_metadata.h"
30 #include "cc/output/delegating_renderer.h" 30 #include "cc/output/delegating_renderer.h"
31 #include "cc/output/gl_renderer.h" 31 #include "cc/output/gl_renderer.h"
32 #include "cc/output/software_renderer.h" 32 #include "cc/output/software_renderer.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 }; 134 };
135 135
136 LayerTreeHostImpl::FrameData::FrameData() 136 LayerTreeHostImpl::FrameData::FrameData()
137 : contains_incomplete_tile(false) {} 137 : contains_incomplete_tile(false) {}
138 138
139 LayerTreeHostImpl::FrameData::~FrameData() {} 139 LayerTreeHostImpl::FrameData::~FrameData() {}
140 140
141 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( 141 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create(
142 const LayerTreeSettings& settings, 142 const LayerTreeSettings& settings,
143 LayerTreeHostImplClient* client, 143 LayerTreeHostImplClient* client,
144 Proxy* proxy) { 144 Proxy* proxy,
145 return make_scoped_ptr(new LayerTreeHostImpl(settings, client, proxy)); 145 RenderingStatsInstrumentation* rendering_stats_instrumentation) {
146 return make_scoped_ptr(
147 new LayerTreeHostImpl(settings,
148 client,
149 proxy,
150 rendering_stats_instrumentation));
146 } 151 }
147 152
148 LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, 153 LayerTreeHostImpl::LayerTreeHostImpl(
149 LayerTreeHostImplClient* client, 154 const LayerTreeSettings& settings,
150 Proxy* proxy) 155 LayerTreeHostImplClient* client,
156 Proxy* proxy,
157 RenderingStatsInstrumentation* rendering_stats_instrumentation)
151 : client_(client), 158 : client_(client),
152 proxy_(proxy), 159 proxy_(proxy),
153 did_lock_scrolling_layer_(false), 160 did_lock_scrolling_layer_(false),
154 should_bubble_scrolls_(false), 161 should_bubble_scrolls_(false),
155 wheel_scrolling_(false), 162 wheel_scrolling_(false),
156 settings_(settings), 163 settings_(settings),
157 device_scale_factor_(1.f), 164 device_scale_factor_(1.f),
158 visible_(true), 165 visible_(true),
159 managed_memory_policy_( 166 managed_memory_policy_(
160 PrioritizedResourceManager::DefaultMemoryAllocationLimit(), 167 PrioritizedResourceManager::DefaultMemoryAllocationLimit(),
161 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING, 168 ManagedMemoryPolicy::CUTOFF_ALLOW_EVERYTHING,
162 0, 169 0,
163 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING), 170 ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING),
164 pinch_gesture_active_(false), 171 pinch_gesture_active_(false),
165 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())), 172 fps_counter_(FrameRateCounter::Create(proxy_->HasImplThread())),
166 paint_time_counter_(PaintTimeCounter::Create()), 173 paint_time_counter_(PaintTimeCounter::Create()),
167 memory_history_(MemoryHistory::Create()), 174 memory_history_(MemoryHistory::Create()),
168 debug_rect_history_(DebugRectHistory::Create()), 175 debug_rect_history_(DebugRectHistory::Create()),
169 num_impl_thread_scrolls_(0),
170 num_main_thread_scrolls_(0),
171 cumulative_num_layers_drawn_(0),
172 cumulative_num_missing_tiles_(0),
173 last_sent_memory_visible_bytes_(0), 176 last_sent_memory_visible_bytes_(0),
174 last_sent_memory_visible_and_nearby_bytes_(0), 177 last_sent_memory_visible_and_nearby_bytes_(0),
175 last_sent_memory_use_bytes_(0), 178 last_sent_memory_use_bytes_(0),
176 animation_registrar_(AnimationRegistrar::Create()) { 179 animation_registrar_(AnimationRegistrar::Create()),
180 rendering_stats_instrumentation_(rendering_stats_instrumentation) {
177 DCHECK(proxy_->IsImplThread()); 181 DCHECK(proxy_->IsImplThread());
178 DidVisibilityChange(this, visible_); 182 DidVisibilityChange(this, visible_);
179 183
180 SetDebugState(settings.initialDebugState); 184 SetDebugState(settings.initialDebugState);
181 185
182 if (settings.calculateTopControlsPosition) { 186 if (settings.calculateTopControlsPosition) {
183 top_controls_manager_ = 187 top_controls_manager_ =
184 TopControlsManager::Create(this, 188 TopControlsManager::Create(this,
185 settings.topControlsHeight, 189 settings.topControlsHeight,
186 settings.topControlsShowThreshold, 190 settings.topControlsShowThreshold,
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 std::vector<LayerImpl*>, 537 std::vector<LayerImpl*>,
534 RenderSurfaceImpl, 538 RenderSurfaceImpl,
535 LayerIteratorActions::FrontToBack> LayerIteratorType; 539 LayerIteratorActions::FrontToBack> LayerIteratorType;
536 540
537 // Typically when we are missing a texture and use a checkerboard quad, we 541 // Typically when we are missing a texture and use a checkerboard quad, we
538 // still draw the frame. However when the layer being checkerboarded is moving 542 // still draw the frame. However when the layer being checkerboarded is moving
539 // due to an impl-animation, we drop the frame to avoid flashing due to the 543 // due to an impl-animation, we drop the frame to avoid flashing due to the
540 // texture suddenly appearing in the future. 544 // texture suddenly appearing in the future.
541 bool draw_frame = true; 545 bool draw_frame = true;
542 546
547 int layers_drawn = 0;
548
543 LayerIteratorType end = 549 LayerIteratorType end =
544 LayerIteratorType::End(frame->render_surface_layer_list); 550 LayerIteratorType::End(frame->render_surface_layer_list);
545 for (LayerIteratorType it = 551 for (LayerIteratorType it =
546 LayerIteratorType::Begin(frame->render_surface_layer_list); 552 LayerIteratorType::Begin(frame->render_surface_layer_list);
547 it != end; 553 it != end;
548 ++it) { 554 ++it) {
549 RenderPass::Id target_render_pass_id = 555 RenderPass::Id target_render_pass_id =
550 it.target_render_surface_layer()->render_surface()->RenderPassId(); 556 it.target_render_surface_layer()->render_surface()->RenderPassId();
551 RenderPass* target_render_pass = 557 RenderPass* target_render_pass =
552 frame->render_passes_by_id[target_render_pass_id]; 558 frame->render_passes_by_id[target_render_pass_id];
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 it->NextContributingRenderPassId(contributing_render_pass_id); 607 it->NextContributingRenderPassId(contributing_render_pass_id);
602 } 608 }
603 } 609 }
604 610
605 AppendQuadsForLayer(target_render_pass, 611 AppendQuadsForLayer(target_render_pass,
606 *it, 612 *it,
607 occlusion_tracker, 613 occlusion_tracker,
608 &append_quads_data); 614 &append_quads_data);
609 } 615 }
610 616
611 ++cumulative_num_layers_drawn_; 617 ++layers_drawn;
612 } 618 }
613 619
614 if (append_quads_data.hadOcclusionFromOutsideTargetSurface) 620 if (append_quads_data.hadOcclusionFromOutsideTargetSurface)
615 target_render_pass->has_occlusion_from_outside_target_surface = true; 621 target_render_pass->has_occlusion_from_outside_target_surface = true;
616 622
617 if (append_quads_data.numMissingTiles) { 623 if (append_quads_data.numMissingTiles) {
618 cumulative_num_missing_tiles_ += append_quads_data.numMissingTiles; 624 rendering_stats_instrumentation_->AddMissingTiles(
625 append_quads_data.numMissingTiles);
619 bool layer_has_animating_transform = 626 bool layer_has_animating_transform =
620 it->screen_space_transform_is_animating() || 627 it->screen_space_transform_is_animating() ||
621 it->draw_transform_is_animating(); 628 it->draw_transform_is_animating();
622 if (layer_has_animating_transform) 629 if (layer_has_animating_transform)
623 draw_frame = false; 630 draw_frame = false;
624 } 631 }
625 632
626 if (append_quads_data.hadIncompleteTile) 633 if (append_quads_data.hadIncompleteTile)
627 frame->contains_incomplete_tile = true; 634 frame->contains_incomplete_tile = true;
628 635
629 occlusion_tracker.LeaveLayer(it); 636 occlusion_tracker.LeaveLayer(it);
630 } 637 }
631 638
639 rendering_stats_instrumentation_->AddLayersDrawn(layers_drawn);
640
632 #ifndef NDEBUG 641 #ifndef NDEBUG
633 for (size_t i = 0; i < frame->render_passes.size(); ++i) { 642 for (size_t i = 0; i < frame->render_passes.size(); ++i) {
634 for (size_t j = 0; j < frame->render_passes[i]->quad_list.size(); ++j) 643 for (size_t j = 0; j < frame->render_passes[i]->quad_list.size(); ++j)
635 DCHECK(frame->render_passes[i]->quad_list[j]->shared_quad_state); 644 DCHECK(frame->render_passes[i]->quad_list[j]->shared_quad_state);
636 DCHECK(frame->render_passes_by_id.find(frame->render_passes[i]->id) 645 DCHECK(frame->render_passes_by_id.find(frame->render_passes[i]->id)
637 != frame->render_passes_by_id.end()); 646 != frame->render_passes_by_id.end());
638 } 647 }
639 #endif 648 #endif
640 DCHECK(frame->render_passes.back()->output_rect.origin().IsOrigin()); 649 DCHECK(frame->render_passes.back()->output_rect.origin().IsOrigin());
641 650
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 } 946 }
938 947
939 void LayerTreeHostImpl::DrawLayers(FrameData* frame, 948 void LayerTreeHostImpl::DrawLayers(FrameData* frame,
940 base::TimeTicks frame_begin_time) { 949 base::TimeTicks frame_begin_time) {
941 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); 950 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers");
942 DCHECK(CanDraw()); 951 DCHECK(CanDraw());
943 DCHECK(!frame->render_passes.empty()); 952 DCHECK(!frame->render_passes.empty());
944 953
945 fps_counter_->SaveTimeStamp(frame_begin_time); 954 fps_counter_->SaveTimeStamp(frame_begin_time);
946 955
956 rendering_stats_instrumentation_->SetScreenFrameCount(
957 fps_counter_->current_frame_number());
958 rendering_stats_instrumentation_->SetDroppedFrameCount(
959 fps_counter_->dropped_frame_count());
960
947 if (tile_manager_) { 961 if (tile_manager_) {
948 memory_history_->SaveEntry( 962 memory_history_->SaveEntry(
949 tile_manager_->memory_stats_from_last_assign()); 963 tile_manager_->memory_stats_from_last_assign());
950 } 964 }
951 965
952 if (debug_state_.ShowHudRects()) { 966 if (debug_state_.ShowHudRects()) {
953 debug_rect_history_->SaveDebugRectsForCurrentFrame( 967 debug_rect_history_->SaveDebugRectsForCurrentFrame(
954 active_tree_->root_layer(), 968 active_tree_->root_layer(),
955 *frame->render_surface_layer_list, 969 *frame->render_surface_layer_list,
956 frame->occluding_screen_space_rects, 970 frame->occluding_screen_space_rects,
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 // Reduce wasted memory now that unlinked resources are guaranteed not 1181 // Reduce wasted memory now that unlinked resources are guaranteed not
1168 // to be used. 1182 // to be used.
1169 client_->ReduceWastedContentsTextureMemoryOnImplThread(); 1183 client_->ReduceWastedContentsTextureMemoryOnImplThread();
1170 1184
1171 client_->OnCanDrawStateChanged(CanDraw()); 1185 client_->OnCanDrawStateChanged(CanDraw());
1172 client_->OnHasPendingTreeStateChanged(pending_tree_); 1186 client_->OnHasPendingTreeStateChanged(pending_tree_);
1173 client_->SetNeedsRedrawOnImplThread(); 1187 client_->SetNeedsRedrawOnImplThread();
1174 client_->RenewTreePriority(); 1188 client_->RenewTreePriority();
1175 1189
1176 if (tile_manager_ && debug_state_.continuous_painting) { 1190 if (tile_manager_ && debug_state_.continuous_painting) {
1177 RenderingStats stats; 1191 RenderingStats stats =
1178 tile_manager_->GetRenderingStats(&stats); 1192 rendering_stats_instrumentation_->GetRenderingStats();
1179 paint_time_counter_->SaveRasterizeTime( 1193 paint_time_counter_->SaveRasterizeTime(
1180 stats.totalRasterizeTimeForNowBinsOnPendingTree, 1194 stats.totalRasterizeTimeForNowBinsOnPendingTree,
1181 active_tree_->source_frame_number()); 1195 active_tree_->source_frame_number());
1182 } 1196 }
1183 } 1197 }
1184 1198
1185 void LayerTreeHostImpl::SetVisible(bool visible) { 1199 void LayerTreeHostImpl::SetVisible(bool visible) {
1186 DCHECK(proxy_->IsImplThread()); 1200 DCHECK(proxy_->IsImplThread());
1187 1201
1188 if (visible_ == visible) 1202 if (visible_ == visible)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 ResourceProvider::Create(output_surface.get()); 1242 ResourceProvider::Create(output_surface.get());
1229 if (!resource_provider) 1243 if (!resource_provider)
1230 return false; 1244 return false;
1231 1245
1232 if (settings_.implSidePainting) { 1246 if (settings_.implSidePainting) {
1233 tile_manager_.reset(new TileManager(this, 1247 tile_manager_.reset(new TileManager(this,
1234 resource_provider.get(), 1248 resource_provider.get(),
1235 settings_.numRasterThreads, 1249 settings_.numRasterThreads,
1236 settings_.useCheapnessEstimator, 1250 settings_.useCheapnessEstimator,
1237 settings_.useColorEstimator, 1251 settings_.useColorEstimator,
1238 settings_.predictionBenchmarking)); 1252 settings_.predictionBenchmarking,
1239 tile_manager_->SetRecordRenderingStats(debug_state_.RecordRenderingStats()); 1253 rendering_stats_instrumentation_));
1240 } 1254 }
1241 1255
1242 if (output_surface->capabilities().has_parent_compositor) { 1256 if (output_surface->capabilities().has_parent_compositor) {
1243 renderer_ = DelegatingRenderer::Create(this, output_surface.get(), 1257 renderer_ = DelegatingRenderer::Create(this, output_surface.get(),
1244 resource_provider.get()); 1258 resource_provider.get());
1245 } else if (output_surface->context3d()) { 1259 } else if (output_surface->context3d()) {
1246 renderer_ = GLRenderer::Create(this, 1260 renderer_ = GLRenderer::Create(this,
1247 output_surface.get(), 1261 output_surface.get(),
1248 resource_provider.get()); 1262 resource_provider.get());
1249 } else if (output_surface->software_device()) { 1263 } else if (output_surface->software_device()) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 LayerImpl* layer_impl = LayerTreeHostCommon::findLayerThatIsHitByPoint( 1368 LayerImpl* layer_impl = LayerTreeHostCommon::findLayerThatIsHitByPoint(
1355 device_viewport_point, active_tree_->RenderSurfaceLayerList()); 1369 device_viewport_point, active_tree_->RenderSurfaceLayerList());
1356 1370
1357 // Walk up the hierarchy and look for a scrollable layer. 1371 // Walk up the hierarchy and look for a scrollable layer.
1358 LayerImpl* potentially_scrolling_layer_impl = 0; 1372 LayerImpl* potentially_scrolling_layer_impl = 0;
1359 for (; layer_impl; layer_impl = layer_impl->parent()) { 1373 for (; layer_impl; layer_impl = layer_impl->parent()) {
1360 // The content layer can also block attempts to scroll outside the main 1374 // The content layer can also block attempts to scroll outside the main
1361 // thread. 1375 // thread.
1362 ScrollStatus status = layer_impl->TryScroll(device_viewport_point, type); 1376 ScrollStatus status = layer_impl->TryScroll(device_viewport_point, type);
1363 if (status == ScrollOnMainThread) { 1377 if (status == ScrollOnMainThread) {
1364 num_main_thread_scrolls_++; 1378 rendering_stats_instrumentation_->IncrementMainThreadScrolls();
1365 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); 1379 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true);
1366 active_tree()->DidBeginScroll(); 1380 active_tree()->DidBeginScroll();
1367 return ScrollOnMainThread; 1381 return ScrollOnMainThread;
1368 } 1382 }
1369 1383
1370 LayerImpl* scroll_layer_impl = FindScrollLayerForContentLayer(layer_impl); 1384 LayerImpl* scroll_layer_impl = FindScrollLayerForContentLayer(layer_impl);
1371 if (!scroll_layer_impl) 1385 if (!scroll_layer_impl)
1372 continue; 1386 continue;
1373 1387
1374 status = scroll_layer_impl->TryScroll(device_viewport_point, type); 1388 status = scroll_layer_impl->TryScroll(device_viewport_point, type);
1375 1389
1376 // If any layer wants to divert the scroll event to the main thread, abort. 1390 // If any layer wants to divert the scroll event to the main thread, abort.
1377 if (status == ScrollOnMainThread) { 1391 if (status == ScrollOnMainThread) {
1378 num_main_thread_scrolls_++; 1392 rendering_stats_instrumentation_->IncrementMainThreadScrolls();
1379 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); 1393 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true);
1380 active_tree()->DidBeginScroll(); 1394 active_tree()->DidBeginScroll();
1381 return ScrollOnMainThread; 1395 return ScrollOnMainThread;
1382 } 1396 }
1383 1397
1384 if (status == ScrollStarted && !potentially_scrolling_layer_impl) 1398 if (status == ScrollStarted && !potentially_scrolling_layer_impl)
1385 potentially_scrolling_layer_impl = scroll_layer_impl; 1399 potentially_scrolling_layer_impl = scroll_layer_impl;
1386 } 1400 }
1387 1401
1388 // When hiding top controls is enabled and the controls are hidden or 1402 // When hiding top controls is enabled and the controls are hidden or
1389 // overlaying the content, force scrolls to be enabled on the root layer to 1403 // overlaying the content, force scrolls to be enabled on the root layer to
1390 // allow bringing the top controls back into view. 1404 // allow bringing the top controls back into view.
1391 if (!potentially_scrolling_layer_impl && top_controls_manager_ && 1405 if (!potentially_scrolling_layer_impl && top_controls_manager_ &&
1392 top_controls_manager_->content_top_offset() != 1406 top_controls_manager_->content_top_offset() !=
1393 settings_.topControlsHeight) { 1407 settings_.topControlsHeight) {
1394 potentially_scrolling_layer_impl = RootScrollLayer(); 1408 potentially_scrolling_layer_impl = RootScrollLayer();
1395 } 1409 }
1396 1410
1397 if (potentially_scrolling_layer_impl) { 1411 if (potentially_scrolling_layer_impl) {
1398 active_tree_->SetCurrentlyScrollingLayer( 1412 active_tree_->SetCurrentlyScrollingLayer(
1399 potentially_scrolling_layer_impl); 1413 potentially_scrolling_layer_impl);
1400 should_bubble_scrolls_ = (type != NonBubblingGesture); 1414 should_bubble_scrolls_ = (type != NonBubblingGesture);
1401 wheel_scrolling_ = (type == Wheel); 1415 wheel_scrolling_ = (type == Wheel);
1402 num_impl_thread_scrolls_++; 1416 rendering_stats_instrumentation_->IncrementImplThreadScrolls();
1403 client_->RenewTreePriority(); 1417 client_->RenewTreePriority();
1404 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); 1418 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false);
1405 active_tree()->DidBeginScroll(); 1419 active_tree()->DidBeginScroll();
1406 return ScrollStarted; 1420 return ScrollStarted;
1407 } 1421 }
1408 return ScrollIgnored; 1422 return ScrollIgnored;
1409 } 1423 }
1410 1424
1411 gfx::Vector2dF LayerTreeHostImpl::ScrollLayerWithViewportSpaceDelta( 1425 gfx::Vector2dF LayerTreeHostImpl::ScrollLayerWithViewportSpaceDelta(
1412 LayerImpl* layer_impl, 1426 LayerImpl* layer_impl,
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 layer->render_surface()->DumpSurface(str, indent); 1802 layer->render_surface()->DumpSurface(str, indent);
1789 1803
1790 for (size_t i = 0; i < layer->children().size(); ++i) 1804 for (size_t i = 0; i < layer->children().size(); ++i)
1791 DumpRenderSurfaces(str, indent, layer->children()[i]); 1805 DumpRenderSurfaces(str, indent, layer->children()[i]);
1792 } 1806 }
1793 1807
1794 int LayerTreeHostImpl::SourceAnimationFrameNumber() const { 1808 int LayerTreeHostImpl::SourceAnimationFrameNumber() const {
1795 return fps_counter_->current_frame_number(); 1809 return fps_counter_->current_frame_number();
1796 } 1810 }
1797 1811
1798 void LayerTreeHostImpl::CollectRenderingStats(RenderingStats* stats) const {
1799 stats->numFramesSentToScreen = fps_counter_->current_frame_number();
1800 stats->droppedFrameCount = fps_counter_->dropped_frame_count();
1801 stats->numImplThreadScrolls = num_impl_thread_scrolls_;
1802 stats->numMainThreadScrolls = num_main_thread_scrolls_;
1803 stats->numLayersDrawn = cumulative_num_layers_drawn_;
1804 stats->numMissingTiles = cumulative_num_missing_tiles_;
1805
1806 if (tile_manager_)
1807 tile_manager_->GetRenderingStats(stats);
1808 }
1809
1810 void LayerTreeHostImpl::SendManagedMemoryStats( 1812 void LayerTreeHostImpl::SendManagedMemoryStats(
1811 size_t memory_visible_bytes, 1813 size_t memory_visible_bytes,
1812 size_t memory_visible_and_nearby_bytes, 1814 size_t memory_visible_and_nearby_bytes,
1813 size_t memory_use_bytes) { 1815 size_t memory_use_bytes) {
1814 if (!renderer_) 1816 if (!renderer_)
1815 return; 1817 return;
1816 1818
1817 // Round the numbers being sent up to the next 8MB, to throttle the rate 1819 // Round the numbers being sent up to the next 8MB, to throttle the rate
1818 // at which we spam the GPU process. 1820 // at which we spam the GPU process.
1819 static const size_t rounding_step = 8 * 1024 * 1024; 1821 static const size_t rounding_step = 8 * 1024 * 1024;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 pending_tree_ ? pending_tree_.get() : active_tree_.get(); 1956 pending_tree_ ? pending_tree_.get() : active_tree_.get();
1955 LayerImpl* layer = GetNonCompositedContentLayerRecursive(tree->root_layer()); 1957 LayerImpl* layer = GetNonCompositedContentLayerRecursive(tree->root_layer());
1956 return layer ? layer->GetPicture() : skia::RefPtr<SkPicture>(); 1958 return layer ? layer->GetPicture() : skia::RefPtr<SkPicture>();
1957 } 1959 }
1958 1960
1959 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { 1961 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) {
1960 if (debug_state_.continuous_painting != debug_state.continuous_painting) 1962 if (debug_state_.continuous_painting != debug_state.continuous_painting)
1961 paint_time_counter_->ClearHistory(); 1963 paint_time_counter_->ClearHistory();
1962 1964
1963 debug_state_ = debug_state; 1965 debug_state_ = debug_state;
1964
1965 if (tile_manager_)
1966 tile_manager_->SetRecordRenderingStats(debug_state_.RecordRenderingStats());
1967 } 1966 }
1968 1967
1969 void LayerTreeHostImpl::SavePaintTime(const base::TimeDelta& total_paint_time, 1968 void LayerTreeHostImpl::SavePaintTime(const base::TimeDelta& total_paint_time,
1970 int commit_number) { 1969 int commit_number) {
1971 DCHECK(debug_state_.continuous_painting); 1970 DCHECK(debug_state_.continuous_painting);
1972 paint_time_counter_->SavePaintTime(total_paint_time, commit_number); 1971 paint_time_counter_->SavePaintTime(total_paint_time, commit_number);
1973 } 1972 }
1974 1973
1975 } // namespace cc 1974 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698