| OLD | NEW |
| 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/layer_tree_host_impl.h" | 5 #include "cc/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" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 std::vector<LayerImpl*>, | 533 std::vector<LayerImpl*>, |
| 530 RenderSurfaceImpl, | 534 RenderSurfaceImpl, |
| 531 LayerIteratorActions::FrontToBack> LayerIteratorType; | 535 LayerIteratorActions::FrontToBack> LayerIteratorType; |
| 532 | 536 |
| 533 // Typically when we are missing a texture and use a checkerboard quad, we | 537 // Typically when we are missing a texture and use a checkerboard quad, we |
| 534 // still draw the frame. However when the layer being checkerboarded is moving | 538 // still draw the frame. However when the layer being checkerboarded is moving |
| 535 // due to an impl-animation, we drop the frame to avoid flashing due to the | 539 // due to an impl-animation, we drop the frame to avoid flashing due to the |
| 536 // texture suddenly appearing in the future. | 540 // texture suddenly appearing in the future. |
| 537 bool draw_frame = true; | 541 bool draw_frame = true; |
| 538 | 542 |
| 543 int layers_drawn = 0; |
| 544 |
| 539 LayerIteratorType end = | 545 LayerIteratorType end = |
| 540 LayerIteratorType::end(frame->render_surface_layer_list); | 546 LayerIteratorType::end(frame->render_surface_layer_list); |
| 541 for (LayerIteratorType it = | 547 for (LayerIteratorType it = |
| 542 LayerIteratorType::begin(frame->render_surface_layer_list); | 548 LayerIteratorType::begin(frame->render_surface_layer_list); |
| 543 it != end; | 549 it != end; |
| 544 ++it) { | 550 ++it) { |
| 545 RenderPass::Id target_render_pass_id = | 551 RenderPass::Id target_render_pass_id = |
| 546 it.targetRenderSurfaceLayer()->render_surface()->RenderPassId(); | 552 it.targetRenderSurfaceLayer()->render_surface()->RenderPassId(); |
| 547 RenderPass* target_render_pass = | 553 RenderPass* target_render_pass = |
| 548 frame->render_passes_by_id[target_render_pass_id]; | 554 frame->render_passes_by_id[target_render_pass_id]; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 it->NextContributingRenderPassId(contributing_render_pass_id); | 603 it->NextContributingRenderPassId(contributing_render_pass_id); |
| 598 } | 604 } |
| 599 } | 605 } |
| 600 | 606 |
| 601 AppendQuadsForLayer(target_render_pass, | 607 AppendQuadsForLayer(target_render_pass, |
| 602 *it, | 608 *it, |
| 603 occlusion_tracker, | 609 occlusion_tracker, |
| 604 &append_quads_data); | 610 &append_quads_data); |
| 605 } | 611 } |
| 606 | 612 |
| 607 ++cumulative_num_layers_drawn_; | 613 ++layers_drawn; |
| 608 } | 614 } |
| 609 | 615 |
| 610 if (append_quads_data.hadOcclusionFromOutsideTargetSurface) | 616 if (append_quads_data.hadOcclusionFromOutsideTargetSurface) |
| 611 target_render_pass->has_occlusion_from_outside_target_surface = true; | 617 target_render_pass->has_occlusion_from_outside_target_surface = true; |
| 612 | 618 |
| 613 if (append_quads_data.numMissingTiles) { | 619 if (append_quads_data.numMissingTiles) { |
| 614 cumulative_num_missing_tiles_ += append_quads_data.numMissingTiles; | 620 rendering_stats_instrumentation_->AddMissingTiles( |
| 621 append_quads_data.numMissingTiles); |
| 615 bool layer_has_animating_transform = | 622 bool layer_has_animating_transform = |
| 616 it->screen_space_transform_is_animating() || | 623 it->screen_space_transform_is_animating() || |
| 617 it->draw_transform_is_animating(); | 624 it->draw_transform_is_animating(); |
| 618 if (layer_has_animating_transform) | 625 if (layer_has_animating_transform) |
| 619 draw_frame = false; | 626 draw_frame = false; |
| 620 } | 627 } |
| 621 | 628 |
| 622 if (append_quads_data.hadIncompleteTile) | 629 if (append_quads_data.hadIncompleteTile) |
| 623 frame->contains_incomplete_tile = true; | 630 frame->contains_incomplete_tile = true; |
| 624 | 631 |
| 625 occlusion_tracker.LeaveLayer(it); | 632 occlusion_tracker.LeaveLayer(it); |
| 626 } | 633 } |
| 627 | 634 |
| 635 rendering_stats_instrumentation_->AddLayersDrawn(layers_drawn); |
| 636 |
| 628 #ifndef NDEBUG | 637 #ifndef NDEBUG |
| 629 for (size_t i = 0; i < frame->render_passes.size(); ++i) { | 638 for (size_t i = 0; i < frame->render_passes.size(); ++i) { |
| 630 for (size_t j = 0; j < frame->render_passes[i]->quad_list.size(); ++j) | 639 for (size_t j = 0; j < frame->render_passes[i]->quad_list.size(); ++j) |
| 631 DCHECK(frame->render_passes[i]->quad_list[j]->shared_quad_state); | 640 DCHECK(frame->render_passes[i]->quad_list[j]->shared_quad_state); |
| 632 DCHECK(frame->render_passes_by_id.find(frame->render_passes[i]->id) | 641 DCHECK(frame->render_passes_by_id.find(frame->render_passes[i]->id) |
| 633 != frame->render_passes_by_id.end()); | 642 != frame->render_passes_by_id.end()); |
| 634 } | 643 } |
| 635 #endif | 644 #endif |
| 636 DCHECK(frame->render_passes.back()->output_rect.origin().IsOrigin()); | 645 DCHECK(frame->render_passes.back()->output_rect.origin().IsOrigin()); |
| 637 | 646 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 void LayerTreeHostImpl::DrawLayers(FrameData* frame) { | 942 void LayerTreeHostImpl::DrawLayers(FrameData* frame) { |
| 934 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); | 943 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); |
| 935 DCHECK(CanDraw()); | 944 DCHECK(CanDraw()); |
| 936 DCHECK(!frame->render_passes.empty()); | 945 DCHECK(!frame->render_passes.empty()); |
| 937 | 946 |
| 938 // FIXME: use the frame begin time from the overall compositor scheduler. | 947 // FIXME: use the frame begin time from the overall compositor scheduler. |
| 939 // This value is currently inaccessible because it is up in Chromium's | 948 // This value is currently inaccessible because it is up in Chromium's |
| 940 // RenderWidget. | 949 // RenderWidget. |
| 941 fps_counter_->saveTimeStamp(base::TimeTicks::Now()); | 950 fps_counter_->saveTimeStamp(base::TimeTicks::Now()); |
| 942 | 951 |
| 952 rendering_stats_instrumentation_->SetScreenFrameCount( |
| 953 fps_counter_->currentFrameNumber()); |
| 954 rendering_stats_instrumentation_->SetDroppedFrameCount( |
| 955 fps_counter_->droppedFrameCount()); |
| 956 |
| 943 if (tile_manager_) { | 957 if (tile_manager_) { |
| 944 memory_history_->SaveEntry( | 958 memory_history_->SaveEntry( |
| 945 tile_manager_->memory_stats_from_last_assign()); | 959 tile_manager_->memory_stats_from_last_assign()); |
| 946 } | 960 } |
| 947 | 961 |
| 948 if (debug_state_.showHudRects()) { | 962 if (debug_state_.showHudRects()) { |
| 949 debug_rect_history_->SaveDebugRectsForCurrentFrame( | 963 debug_rect_history_->SaveDebugRectsForCurrentFrame( |
| 950 active_tree_->root_layer(), | 964 active_tree_->root_layer(), |
| 951 *frame->render_surface_layer_list, | 965 *frame->render_surface_layer_list, |
| 952 frame->occluding_screen_space_rects, | 966 frame->occluding_screen_space_rects, |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 // Reduce wasted memory now that unlinked resources are guaranteed not | 1169 // Reduce wasted memory now that unlinked resources are guaranteed not |
| 1156 // to be used. | 1170 // to be used. |
| 1157 client_->ReduceWastedContentsTextureMemoryOnImplThread(); | 1171 client_->ReduceWastedContentsTextureMemoryOnImplThread(); |
| 1158 | 1172 |
| 1159 client_->OnCanDrawStateChanged(CanDraw()); | 1173 client_->OnCanDrawStateChanged(CanDraw()); |
| 1160 client_->OnHasPendingTreeStateChanged(pending_tree_); | 1174 client_->OnHasPendingTreeStateChanged(pending_tree_); |
| 1161 client_->SetNeedsRedrawOnImplThread(); | 1175 client_->SetNeedsRedrawOnImplThread(); |
| 1162 client_->RenewTreePriority(); | 1176 client_->RenewTreePriority(); |
| 1163 | 1177 |
| 1164 if (tile_manager_ && debug_state_.continuousPainting) { | 1178 if (tile_manager_ && debug_state_.continuousPainting) { |
| 1165 RenderingStats stats; | 1179 RenderingStats stats = |
| 1166 tile_manager_->GetRenderingStats(&stats); | 1180 rendering_stats_instrumentation_->GetRenderingStats(); |
| 1167 paint_time_counter_->SaveRasterizeTime( | 1181 paint_time_counter_->SaveRasterizeTime( |
| 1168 stats.totalRasterizeTimeForNowBinsOnPendingTree, | 1182 stats.totalRasterizeTimeForNowBinsOnPendingTree, |
| 1169 active_tree_->source_frame_number()); | 1183 active_tree_->source_frame_number()); |
| 1170 } | 1184 } |
| 1171 } | 1185 } |
| 1172 | 1186 |
| 1173 void LayerTreeHostImpl::SetVisible(bool visible) { | 1187 void LayerTreeHostImpl::SetVisible(bool visible) { |
| 1174 DCHECK(proxy_->IsImplThread()); | 1188 DCHECK(proxy_->IsImplThread()); |
| 1175 | 1189 |
| 1176 if (visible_ == visible) | 1190 if (visible_ == visible) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 ResourceProvider::Create(output_surface.get()); | 1230 ResourceProvider::Create(output_surface.get()); |
| 1217 if (!resource_provider) | 1231 if (!resource_provider) |
| 1218 return false; | 1232 return false; |
| 1219 | 1233 |
| 1220 if (settings_.implSidePainting) { | 1234 if (settings_.implSidePainting) { |
| 1221 tile_manager_.reset(new TileManager(this, | 1235 tile_manager_.reset(new TileManager(this, |
| 1222 resource_provider.get(), | 1236 resource_provider.get(), |
| 1223 settings_.numRasterThreads, | 1237 settings_.numRasterThreads, |
| 1224 settings_.useCheapnessEstimator, | 1238 settings_.useCheapnessEstimator, |
| 1225 settings_.useColorEstimator, | 1239 settings_.useColorEstimator, |
| 1226 settings_.predictionBenchmarking)); | 1240 settings_.predictionBenchmarking, |
| 1227 tile_manager_->SetRecordRenderingStats(debug_state_.recordRenderingStats()); | 1241 rendering_stats_instrumentation_)); |
| 1228 } | 1242 } |
| 1229 | 1243 |
| 1230 if (output_surface->capabilities().has_parent_compositor) { | 1244 if (output_surface->capabilities().has_parent_compositor) { |
| 1231 renderer_ = DelegatingRenderer::Create(this, output_surface.get(), | 1245 renderer_ = DelegatingRenderer::Create(this, output_surface.get(), |
| 1232 resource_provider.get()); | 1246 resource_provider.get()); |
| 1233 } else if (output_surface->context3d()) { | 1247 } else if (output_surface->context3d()) { |
| 1234 renderer_ = GLRenderer::Create(this, | 1248 renderer_ = GLRenderer::Create(this, |
| 1235 output_surface.get(), | 1249 output_surface.get(), |
| 1236 resource_provider.get()); | 1250 resource_provider.get()); |
| 1237 } else if (output_surface->software_device()) { | 1251 } else if (output_surface->software_device()) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 LayerImpl* layer_impl = LayerTreeHostCommon::findLayerThatIsHitByPoint( | 1356 LayerImpl* layer_impl = LayerTreeHostCommon::findLayerThatIsHitByPoint( |
| 1343 device_viewport_point, active_tree_->RenderSurfaceLayerList()); | 1357 device_viewport_point, active_tree_->RenderSurfaceLayerList()); |
| 1344 | 1358 |
| 1345 // Walk up the hierarchy and look for a scrollable layer. | 1359 // Walk up the hierarchy and look for a scrollable layer. |
| 1346 LayerImpl* potentially_scrolling_layer_impl = 0; | 1360 LayerImpl* potentially_scrolling_layer_impl = 0; |
| 1347 for (; layer_impl; layer_impl = layer_impl->parent()) { | 1361 for (; layer_impl; layer_impl = layer_impl->parent()) { |
| 1348 // The content layer can also block attempts to scroll outside the main | 1362 // The content layer can also block attempts to scroll outside the main |
| 1349 // thread. | 1363 // thread. |
| 1350 ScrollStatus status = layer_impl->TryScroll(device_viewport_point, type); | 1364 ScrollStatus status = layer_impl->TryScroll(device_viewport_point, type); |
| 1351 if (status == ScrollOnMainThread) { | 1365 if (status == ScrollOnMainThread) { |
| 1352 num_main_thread_scrolls_++; | 1366 rendering_stats_instrumentation_->IncrementMainThreadScrolls(); |
| 1353 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); | 1367 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); |
| 1354 return ScrollOnMainThread; | 1368 return ScrollOnMainThread; |
| 1355 } | 1369 } |
| 1356 | 1370 |
| 1357 LayerImpl* scroll_layer_impl = FindScrollLayerForContentLayer(layer_impl); | 1371 LayerImpl* scroll_layer_impl = FindScrollLayerForContentLayer(layer_impl); |
| 1358 if (!scroll_layer_impl) | 1372 if (!scroll_layer_impl) |
| 1359 continue; | 1373 continue; |
| 1360 | 1374 |
| 1361 status = scroll_layer_impl->TryScroll(device_viewport_point, type); | 1375 status = scroll_layer_impl->TryScroll(device_viewport_point, type); |
| 1362 | 1376 |
| 1363 // If any layer wants to divert the scroll event to the main thread, abort. | 1377 // If any layer wants to divert the scroll event to the main thread, abort. |
| 1364 if (status == ScrollOnMainThread) { | 1378 if (status == ScrollOnMainThread) { |
| 1365 num_main_thread_scrolls_++; | 1379 rendering_stats_instrumentation_->IncrementMainThreadScrolls(); |
| 1366 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); | 1380 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); |
| 1367 return ScrollOnMainThread; | 1381 return ScrollOnMainThread; |
| 1368 } | 1382 } |
| 1369 | 1383 |
| 1370 if (status == ScrollStarted && !potentially_scrolling_layer_impl) | 1384 if (status == ScrollStarted && !potentially_scrolling_layer_impl) |
| 1371 potentially_scrolling_layer_impl = scroll_layer_impl; | 1385 potentially_scrolling_layer_impl = scroll_layer_impl; |
| 1372 } | 1386 } |
| 1373 | 1387 |
| 1374 // When hiding top controls is enabled and the controls are hidden or | 1388 // When hiding top controls is enabled and the controls are hidden or |
| 1375 // overlaying the content, force scrolls to be enabled on the root layer to | 1389 // overlaying the content, force scrolls to be enabled on the root layer to |
| 1376 // allow bringing the top controls back into view. | 1390 // allow bringing the top controls back into view. |
| 1377 if (!potentially_scrolling_layer_impl && top_controls_manager_ && | 1391 if (!potentially_scrolling_layer_impl && top_controls_manager_ && |
| 1378 top_controls_manager_->content_top_offset() != | 1392 top_controls_manager_->content_top_offset() != |
| 1379 settings_.topControlsHeight) { | 1393 settings_.topControlsHeight) { |
| 1380 potentially_scrolling_layer_impl = RootScrollLayer(); | 1394 potentially_scrolling_layer_impl = RootScrollLayer(); |
| 1381 } | 1395 } |
| 1382 | 1396 |
| 1383 if (potentially_scrolling_layer_impl) { | 1397 if (potentially_scrolling_layer_impl) { |
| 1384 active_tree_->set_currently_scrolling_layer( | 1398 active_tree_->set_currently_scrolling_layer( |
| 1385 potentially_scrolling_layer_impl); | 1399 potentially_scrolling_layer_impl); |
| 1386 should_bubble_scrolls_ = (type != NonBubblingGesture); | 1400 should_bubble_scrolls_ = (type != NonBubblingGesture); |
| 1387 wheel_scrolling_ = (type == Wheel); | 1401 wheel_scrolling_ = (type == Wheel); |
| 1388 num_impl_thread_scrolls_++; | 1402 rendering_stats_instrumentation_->IncrementImplThreadScrolls(); |
| 1389 client_->RenewTreePriority(); | 1403 client_->RenewTreePriority(); |
| 1390 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); | 1404 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); |
| 1391 return ScrollStarted; | 1405 return ScrollStarted; |
| 1392 } | 1406 } |
| 1393 return ScrollIgnored; | 1407 return ScrollIgnored; |
| 1394 } | 1408 } |
| 1395 | 1409 |
| 1396 gfx::Vector2dF LayerTreeHostImpl::ScrollLayerWithViewportSpaceDelta( | 1410 gfx::Vector2dF LayerTreeHostImpl::ScrollLayerWithViewportSpaceDelta( |
| 1397 LayerImpl* layer_impl, | 1411 LayerImpl* layer_impl, |
| 1398 float scale_from_viewport_to_screen_space, | 1412 float scale_from_viewport_to_screen_space, |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 layer->render_surface()->DumpSurface(str, indent); | 1785 layer->render_surface()->DumpSurface(str, indent); |
| 1772 | 1786 |
| 1773 for (size_t i = 0; i < layer->children().size(); ++i) | 1787 for (size_t i = 0; i < layer->children().size(); ++i) |
| 1774 DumpRenderSurfaces(str, indent, layer->children()[i]); | 1788 DumpRenderSurfaces(str, indent, layer->children()[i]); |
| 1775 } | 1789 } |
| 1776 | 1790 |
| 1777 int LayerTreeHostImpl::SourceAnimationFrameNumber() const { | 1791 int LayerTreeHostImpl::SourceAnimationFrameNumber() const { |
| 1778 return fps_counter_->currentFrameNumber(); | 1792 return fps_counter_->currentFrameNumber(); |
| 1779 } | 1793 } |
| 1780 | 1794 |
| 1781 void LayerTreeHostImpl::CollectRenderingStats(RenderingStats* stats) const { | |
| 1782 stats->numFramesSentToScreen = fps_counter_->currentFrameNumber(); | |
| 1783 stats->droppedFrameCount = fps_counter_->droppedFrameCount(); | |
| 1784 stats->numImplThreadScrolls = num_impl_thread_scrolls_; | |
| 1785 stats->numMainThreadScrolls = num_main_thread_scrolls_; | |
| 1786 stats->numLayersDrawn = cumulative_num_layers_drawn_; | |
| 1787 stats->numMissingTiles = cumulative_num_missing_tiles_; | |
| 1788 | |
| 1789 if (tile_manager_) | |
| 1790 tile_manager_->GetRenderingStats(stats); | |
| 1791 } | |
| 1792 | |
| 1793 void LayerTreeHostImpl::SendManagedMemoryStats( | 1795 void LayerTreeHostImpl::SendManagedMemoryStats( |
| 1794 size_t memory_visible_bytes, | 1796 size_t memory_visible_bytes, |
| 1795 size_t memory_visible_and_nearby_bytes, | 1797 size_t memory_visible_and_nearby_bytes, |
| 1796 size_t memory_use_bytes) { | 1798 size_t memory_use_bytes) { |
| 1797 if (!renderer_) | 1799 if (!renderer_) |
| 1798 return; | 1800 return; |
| 1799 | 1801 |
| 1800 // Round the numbers being sent up to the next 8MB, to throttle the rate | 1802 // Round the numbers being sent up to the next 8MB, to throttle the rate |
| 1801 // at which we spam the GPU process. | 1803 // at which we spam the GPU process. |
| 1802 static const size_t rounding_step = 8 * 1024 * 1024; | 1804 static const size_t rounding_step = 8 * 1024 * 1024; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 pending_tree_ ? pending_tree_.get() : active_tree_.get(); | 1912 pending_tree_ ? pending_tree_.get() : active_tree_.get(); |
| 1911 LayerImpl* layer = GetNonCompositedContentLayerRecursive(tree->root_layer()); | 1913 LayerImpl* layer = GetNonCompositedContentLayerRecursive(tree->root_layer()); |
| 1912 return layer ? layer->GetPicture() : skia::RefPtr<SkPicture>(); | 1914 return layer ? layer->GetPicture() : skia::RefPtr<SkPicture>(); |
| 1913 } | 1915 } |
| 1914 | 1916 |
| 1915 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { | 1917 void LayerTreeHostImpl::SetDebugState(const LayerTreeDebugState& debug_state) { |
| 1916 if (debug_state_.continuousPainting != debug_state.continuousPainting) | 1918 if (debug_state_.continuousPainting != debug_state.continuousPainting) |
| 1917 paint_time_counter_->ClearHistory(); | 1919 paint_time_counter_->ClearHistory(); |
| 1918 | 1920 |
| 1919 debug_state_ = debug_state; | 1921 debug_state_ = debug_state; |
| 1920 | |
| 1921 if (tile_manager_) | |
| 1922 tile_manager_->SetRecordRenderingStats(debug_state_.recordRenderingStats()); | |
| 1923 } | 1922 } |
| 1924 | 1923 |
| 1925 void LayerTreeHostImpl::SavePaintTime(const base::TimeDelta& total_paint_time, | 1924 void LayerTreeHostImpl::SavePaintTime(const base::TimeDelta& total_paint_time, |
| 1926 int commit_number) { | 1925 int commit_number) { |
| 1927 DCHECK(debug_state_.continuousPainting); | 1926 DCHECK(debug_state_.continuousPainting); |
| 1928 paint_time_counter_->SavePaintTime(total_paint_time, commit_number); | 1927 paint_time_counter_->SavePaintTime(total_paint_time, commit_number); |
| 1929 } | 1928 } |
| 1930 | 1929 |
| 1931 } // namespace cc | 1930 } // namespace cc |
| OLD | NEW |