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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 AppendQuadsForLayer(target_render_pass, | 798 AppendQuadsForLayer(target_render_pass, |
799 *it, | 799 *it, |
800 occlusion_tracker, | 800 occlusion_tracker, |
801 &append_quads_data); | 801 &append_quads_data); |
802 } | 802 } |
803 | 803 |
804 ++layers_drawn; | 804 ++layers_drawn; |
805 } | 805 } |
806 | 806 |
807 if (append_quads_data.num_missing_tiles) { | 807 if (append_quads_data.num_missing_tiles) { |
808 rendering_stats_instrumentation_->AddMissingTiles( | |
809 append_quads_data.num_missing_tiles); | |
810 bool layer_has_animating_transform = | 808 bool layer_has_animating_transform = |
811 it->screen_space_transform_is_animating() || | 809 it->screen_space_transform_is_animating() || |
812 it->draw_transform_is_animating(); | 810 it->draw_transform_is_animating(); |
813 if (layer_has_animating_transform) | 811 if (layer_has_animating_transform) |
814 draw_frame = false; | 812 draw_frame = false; |
815 } | 813 } |
816 | 814 |
817 if (append_quads_data.had_incomplete_tile) | 815 if (append_quads_data.had_incomplete_tile) |
818 frame->contains_incomplete_tile = true; | 816 frame->contains_incomplete_tile = true; |
819 | 817 |
820 occlusion_tracker.LeaveLayer(it); | 818 occlusion_tracker.LeaveLayer(it); |
821 } | 819 } |
822 | 820 |
823 if (have_copy_request || | 821 if (have_copy_request || |
824 output_surface_->capabilities().draw_and_swap_full_viewport_every_frame) | 822 output_surface_->capabilities().draw_and_swap_full_viewport_every_frame) |
825 draw_frame = true; | 823 draw_frame = true; |
826 | 824 |
827 rendering_stats_instrumentation_->AddLayersDrawn(layers_drawn); | |
828 | |
829 #ifndef NDEBUG | 825 #ifndef NDEBUG |
830 for (size_t i = 0; i < frame->render_passes.size(); ++i) { | 826 for (size_t i = 0; i < frame->render_passes.size(); ++i) { |
831 for (size_t j = 0; j < frame->render_passes[i]->quad_list.size(); ++j) | 827 for (size_t j = 0; j < frame->render_passes[i]->quad_list.size(); ++j) |
832 DCHECK(frame->render_passes[i]->quad_list[j]->shared_quad_state); | 828 DCHECK(frame->render_passes[i]->quad_list[j]->shared_quad_state); |
833 DCHECK(frame->render_passes_by_id.find(frame->render_passes[i]->id) | 829 DCHECK(frame->render_passes_by_id.find(frame->render_passes[i]->id) |
834 != frame->render_passes_by_id.end()); | 830 != frame->render_passes_by_id.end()); |
835 } | 831 } |
836 #endif | 832 #endif |
837 DCHECK(frame->render_passes.back()->output_rect.origin().IsOrigin()); | 833 DCHECK(frame->render_passes.back()->output_rect.origin().IsOrigin()); |
838 | 834 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 | 1260 |
1265 if (frame->has_no_damage) { | 1261 if (frame->has_no_damage) { |
1266 TRACE_EVENT0("cc", "EarlyOut_NoDamage"); | 1262 TRACE_EVENT0("cc", "EarlyOut_NoDamage"); |
1267 DCHECK(!output_surface_->capabilities() | 1263 DCHECK(!output_surface_->capabilities() |
1268 .draw_and_swap_full_viewport_every_frame); | 1264 .draw_and_swap_full_viewport_every_frame); |
1269 return; | 1265 return; |
1270 } | 1266 } |
1271 | 1267 |
1272 DCHECK(!frame->render_passes.empty()); | 1268 DCHECK(!frame->render_passes.empty()); |
1273 | 1269 |
1274 int old_dropped_frame_count = fps_counter_->dropped_frame_count(); | |
1275 fps_counter_->SaveTimeStamp(frame_begin_time, | 1270 fps_counter_->SaveTimeStamp(frame_begin_time, |
1276 !output_surface_->context_provider()); | 1271 !output_surface_->context_provider()); |
1277 | 1272 |
1278 bool on_main_thread = false; | 1273 bool on_main_thread = false; |
1279 rendering_stats_instrumentation_->IncrementScreenFrameCount( | 1274 rendering_stats_instrumentation_->IncrementFrameCount( |
1280 1, on_main_thread); | 1275 1, on_main_thread); |
1281 rendering_stats_instrumentation_->IncrementDroppedFrameCount( | |
1282 fps_counter_->dropped_frame_count() - old_dropped_frame_count); | |
1283 | 1276 |
1284 if (tile_manager_) { | 1277 if (tile_manager_) { |
1285 memory_history_->SaveEntry( | 1278 memory_history_->SaveEntry( |
1286 tile_manager_->memory_stats_from_last_assign()); | 1279 tile_manager_->memory_stats_from_last_assign()); |
1287 } | 1280 } |
1288 | 1281 |
1289 if (debug_state_.ShowHudRects()) { | 1282 if (debug_state_.ShowHudRects()) { |
1290 debug_rect_history_->SaveDebugRectsForCurrentFrame( | 1283 debug_rect_history_->SaveDebugRectsForCurrentFrame( |
1291 active_tree_->root_layer(), | 1284 active_tree_->root_layer(), |
1292 *frame->render_surface_layer_list, | 1285 *frame->render_surface_layer_list, |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 // to be used. | 1515 // to be used. |
1523 client_->ReduceWastedContentsTextureMemoryOnImplThread(); | 1516 client_->ReduceWastedContentsTextureMemoryOnImplThread(); |
1524 | 1517 |
1525 client_->OnCanDrawStateChanged(CanDraw()); | 1518 client_->OnCanDrawStateChanged(CanDraw()); |
1526 client_->SetNeedsRedrawOnImplThread(); | 1519 client_->SetNeedsRedrawOnImplThread(); |
1527 client_->RenewTreePriority(); | 1520 client_->RenewTreePriority(); |
1528 | 1521 |
1529 if (debug_state_.continuous_painting) { | 1522 if (debug_state_.continuous_painting) { |
1530 const RenderingStats& stats = | 1523 const RenderingStats& stats = |
1531 rendering_stats_instrumentation_->GetRenderingStats(); | 1524 rendering_stats_instrumentation_->GetRenderingStats(); |
1532 paint_time_counter_->SavePaintTime( | 1525 paint_time_counter_->SavePaintTime(stats.main_stats.paint_time + |
1533 stats.main_stats.paint_time + stats.main_stats.record_time + | 1526 stats.main_stats.record_time + |
1534 stats.impl_stats.rasterize_time_for_now_bins_on_pending_tree); | 1527 stats.impl_stats.rasterize_time); |
1535 } | 1528 } |
1536 | 1529 |
1537 client_->DidActivatePendingTree(); | 1530 client_->DidActivatePendingTree(); |
1538 if (!tree_activation_callback_.is_null()) | 1531 if (!tree_activation_callback_.is_null()) |
1539 tree_activation_callback_.Run(); | 1532 tree_activation_callback_.Run(); |
1540 | 1533 |
1541 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) | 1534 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) |
1542 DCHECK(active_tree_->root_layer()); | 1535 DCHECK(active_tree_->root_layer()); |
1543 } | 1536 } |
1544 | 1537 |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1965 device_scale_factor_); | 1958 device_scale_factor_); |
1966 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( | 1959 LayerImpl* layer_impl = LayerTreeHostCommon::FindLayerThatIsHitByPoint( |
1967 device_viewport_point, | 1960 device_viewport_point, |
1968 active_tree_->RenderSurfaceLayerList()); | 1961 active_tree_->RenderSurfaceLayerList()); |
1969 bool scroll_on_main_thread = false; | 1962 bool scroll_on_main_thread = false; |
1970 LayerImpl* potentially_scrolling_layer_impl = | 1963 LayerImpl* potentially_scrolling_layer_impl = |
1971 FindScrollLayerForDeviceViewportPoint(device_viewport_point, type, | 1964 FindScrollLayerForDeviceViewportPoint(device_viewport_point, type, |
1972 layer_impl, &scroll_on_main_thread); | 1965 layer_impl, &scroll_on_main_thread); |
1973 | 1966 |
1974 if (scroll_on_main_thread) { | 1967 if (scroll_on_main_thread) { |
1975 rendering_stats_instrumentation_->IncrementMainThreadScrolls(); | |
1976 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); | 1968 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", true); |
1977 return ScrollOnMainThread; | 1969 return ScrollOnMainThread; |
1978 } | 1970 } |
1979 | 1971 |
1980 // If we want to send a DidOverscroll for this scroll it can't be ignored. | 1972 // If we want to send a DidOverscroll for this scroll it can't be ignored. |
1981 if (!potentially_scrolling_layer_impl && settings_.always_overscroll) | 1973 if (!potentially_scrolling_layer_impl && settings_.always_overscroll) |
1982 potentially_scrolling_layer_impl = RootScrollLayer(); | 1974 potentially_scrolling_layer_impl = RootScrollLayer(); |
1983 | 1975 |
1984 if (potentially_scrolling_layer_impl) { | 1976 if (potentially_scrolling_layer_impl) { |
1985 active_tree_->SetCurrentlyScrollingLayer( | 1977 active_tree_->SetCurrentlyScrollingLayer( |
1986 potentially_scrolling_layer_impl); | 1978 potentially_scrolling_layer_impl); |
1987 should_bubble_scrolls_ = (type != NonBubblingGesture); | 1979 should_bubble_scrolls_ = (type != NonBubblingGesture); |
1988 wheel_scrolling_ = (type == Wheel); | 1980 wheel_scrolling_ = (type == Wheel); |
1989 rendering_stats_instrumentation_->IncrementImplThreadScrolls(); | |
1990 client_->RenewTreePriority(); | 1981 client_->RenewTreePriority(); |
1991 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); | 1982 UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false); |
1992 return ScrollStarted; | 1983 return ScrollStarted; |
1993 } | 1984 } |
1994 return ScrollIgnored; | 1985 return ScrollIgnored; |
1995 } | 1986 } |
1996 | 1987 |
1997 gfx::Vector2dF LayerTreeHostImpl::ScrollLayerWithViewportSpaceDelta( | 1988 gfx::Vector2dF LayerTreeHostImpl::ScrollLayerWithViewportSpaceDelta( |
1998 LayerImpl* layer_impl, | 1989 LayerImpl* layer_impl, |
1999 float scale_from_viewport_to_screen_space, | 1990 float scale_from_viewport_to_screen_space, |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2802 std::set<UIResourceId>::iterator found_in_evicted = | 2793 std::set<UIResourceId>::iterator found_in_evicted = |
2803 evicted_ui_resources_.find(uid); | 2794 evicted_ui_resources_.find(uid); |
2804 if (found_in_evicted == evicted_ui_resources_.end()) | 2795 if (found_in_evicted == evicted_ui_resources_.end()) |
2805 return; | 2796 return; |
2806 evicted_ui_resources_.erase(found_in_evicted); | 2797 evicted_ui_resources_.erase(found_in_evicted); |
2807 if (evicted_ui_resources_.empty()) | 2798 if (evicted_ui_resources_.empty()) |
2808 client_->OnCanDrawStateChanged(CanDraw()); | 2799 client_->OnCanDrawStateChanged(CanDraw()); |
2809 } | 2800 } |
2810 | 2801 |
2811 } // namespace cc | 2802 } // namespace cc |
OLD | NEW |