| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 391 |
| 392 if (!renderer_) { | 392 if (!renderer_) { |
| 393 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer", | 393 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer", |
| 394 TRACE_EVENT_SCOPE_THREAD); | 394 TRACE_EVENT_SCOPE_THREAD); |
| 395 return false; | 395 return false; |
| 396 } | 396 } |
| 397 | 397 |
| 398 // Must have an OutputSurface if |renderer_| is not NULL. | 398 // Must have an OutputSurface if |renderer_| is not NULL. |
| 399 DCHECK(output_surface_); | 399 DCHECK(output_surface_); |
| 400 | 400 |
| 401 // TODO(boliu): Make draws without root_layer work and move this below | 401 // TODO(boliu): Make draws without layers work and move this below |
| 402 // |resourceless_software_draw_| check. Tracked in crbug.com/264967. | 402 // |resourceless_software_draw_| check. Tracked in crbug.com/264967. |
| 403 if (!active_tree_->root_layer()) { | 403 if (active_tree_->LayerListIsEmpty()) { |
| 404 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer", | 404 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer", |
| 405 TRACE_EVENT_SCOPE_THREAD); | 405 TRACE_EVENT_SCOPE_THREAD); |
| 406 return false; | 406 return false; |
| 407 } | 407 } |
| 408 | 408 |
| 409 if (resourceless_software_draw_) | 409 if (resourceless_software_draw_) |
| 410 return true; | 410 return true; |
| 411 | 411 |
| 412 if (DrawViewportSize().IsEmpty()) { | 412 if (DrawViewportSize().IsEmpty()) { |
| 413 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport", | 413 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport", |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 return scroll_elasticity_helper_.get(); | 625 return scroll_elasticity_helper_.get(); |
| 626 } | 626 } |
| 627 | 627 |
| 628 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( | 628 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( |
| 629 std::unique_ptr<SwapPromise> swap_promise) { | 629 std::unique_ptr<SwapPromise> swap_promise) { |
| 630 swap_promises_for_main_thread_scroll_update_.push_back( | 630 swap_promises_for_main_thread_scroll_update_.push_back( |
| 631 std::move(swap_promise)); | 631 std::move(swap_promise)); |
| 632 } | 632 } |
| 633 | 633 |
| 634 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 634 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
| 635 LayerImpl* root_draw_layer, | |
| 636 const LayerImplList& render_surface_layer_list) { | 635 const LayerImplList& render_surface_layer_list) { |
| 637 // For now, we use damage tracking to compute a global scissor. To do this, we | 636 // For now, we use damage tracking to compute a global scissor. To do this, we |
| 638 // must compute all damage tracking before drawing anything, so that we know | 637 // must compute all damage tracking before drawing anything, so that we know |
| 639 // the root damage rect. The root damage rect is then used to scissor each | 638 // the root damage rect. The root damage rect is then used to scissor each |
| 640 // surface. | 639 // surface. |
| 641 size_t render_surface_layer_list_size = render_surface_layer_list.size(); | 640 size_t render_surface_layer_list_size = render_surface_layer_list.size(); |
| 642 for (size_t i = 0; i < render_surface_layer_list_size; ++i) { | 641 for (size_t i = 0; i < render_surface_layer_list_size; ++i) { |
| 643 size_t surface_index = render_surface_layer_list_size - 1 - i; | 642 size_t surface_index = render_surface_layer_list_size - 1 - i; |
| 644 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; | 643 LayerImpl* render_surface_layer = render_surface_layer_list[surface_index]; |
| 645 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); | 644 RenderSurfaceImpl* render_surface = render_surface_layer->render_surface(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 | 722 |
| 724 surface->AppendQuads(target_render_pass, replica_draw_transform, | 723 surface->AppendQuads(target_render_pass, replica_draw_transform, |
| 725 replica_occlusion, replica_debug_border_color, | 724 replica_occlusion, replica_debug_border_color, |
| 726 replica_debug_border_width, replica_mask_layer, | 725 replica_debug_border_width, replica_mask_layer, |
| 727 append_quads_data, contributing_render_pass->id); | 726 append_quads_data, contributing_render_pass->id); |
| 728 } | 727 } |
| 729 } | 728 } |
| 730 | 729 |
| 731 static void AppendQuadsToFillScreen(const gfx::Rect& root_scroll_layer_rect, | 730 static void AppendQuadsToFillScreen(const gfx::Rect& root_scroll_layer_rect, |
| 732 RenderPass* target_render_pass, | 731 RenderPass* target_render_pass, |
| 733 LayerImpl* root_layer, | 732 RenderSurfaceImpl* root_render_surface, |
| 734 SkColor screen_background_color, | 733 SkColor screen_background_color, |
| 735 const Region& fill_region) { | 734 const Region& fill_region) { |
| 736 if (!root_layer || !SkColorGetA(screen_background_color)) | 735 if (!root_render_surface || !SkColorGetA(screen_background_color)) |
| 737 return; | 736 return; |
| 738 if (fill_region.IsEmpty()) | 737 if (fill_region.IsEmpty()) |
| 739 return; | 738 return; |
| 740 | 739 |
| 741 // Manually create the quad state for the gutter quads, as the root layer | 740 // Manually create the quad state for the gutter quads, as the root layer |
| 742 // doesn't have any bounds and so can't generate this itself. | 741 // doesn't have any bounds and so can't generate this itself. |
| 743 // TODO(danakj): Make the gutter quads generated by the solid color layer | 742 // TODO(danakj): Make the gutter quads generated by the solid color layer |
| 744 // (make it smarter about generating quads to fill unoccluded areas). | 743 // (make it smarter about generating quads to fill unoccluded areas). |
| 745 | 744 |
| 746 gfx::Rect root_target_rect = root_layer->render_surface()->content_rect(); | 745 gfx::Rect root_target_rect = root_render_surface->content_rect(); |
| 747 float opacity = 1.f; | 746 float opacity = 1.f; |
| 748 int sorting_context_id = 0; | 747 int sorting_context_id = 0; |
| 749 SharedQuadState* shared_quad_state = | 748 SharedQuadState* shared_quad_state = |
| 750 target_render_pass->CreateAndAppendSharedQuadState(); | 749 target_render_pass->CreateAndAppendSharedQuadState(); |
| 751 shared_quad_state->SetAll(gfx::Transform(), | 750 shared_quad_state->SetAll(gfx::Transform(), |
| 752 root_target_rect.size(), | 751 root_target_rect.size(), |
| 753 root_target_rect, | 752 root_target_rect, |
| 754 root_target_rect, | 753 root_target_rect, |
| 755 false, | 754 false, |
| 756 opacity, | 755 opacity, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 778 auto it = std::find_if( | 777 auto it = std::find_if( |
| 779 list.begin(), list.end(), | 778 list.begin(), list.end(), |
| 780 [id](const std::unique_ptr<RenderPass>& p) { return p->id == id; }); | 779 [id](const std::unique_ptr<RenderPass>& p) { return p->id == id; }); |
| 781 return it == list.end() ? nullptr : it->get(); | 780 return it == list.end() ? nullptr : it->get(); |
| 782 } | 781 } |
| 783 | 782 |
| 784 DrawResult LayerTreeHostImpl::CalculateRenderPasses( | 783 DrawResult LayerTreeHostImpl::CalculateRenderPasses( |
| 785 FrameData* frame) { | 784 FrameData* frame) { |
| 786 DCHECK(frame->render_passes.empty()); | 785 DCHECK(frame->render_passes.empty()); |
| 787 DCHECK(CanDraw()); | 786 DCHECK(CanDraw()); |
| 788 DCHECK(active_tree_->root_layer()); | 787 DCHECK(!active_tree_->LayerListIsEmpty()); |
| 789 | 788 |
| 790 TrackDamageForAllSurfaces(active_tree_->root_layer(), | 789 TrackDamageForAllSurfaces(*frame->render_surface_layer_list); |
| 791 *frame->render_surface_layer_list); | |
| 792 | 790 |
| 793 // If the root render surface has no visible damage, then don't generate a | 791 // If the root render surface has no visible damage, then don't generate a |
| 794 // frame at all. | 792 // frame at all. |
| 795 RenderSurfaceImpl* root_surface = | 793 RenderSurfaceImpl* root_surface = active_tree_->RootRenderSurface(); |
| 796 active_tree_->root_layer()->render_surface(); | |
| 797 bool root_surface_has_no_visible_damage = | 794 bool root_surface_has_no_visible_damage = |
| 798 !root_surface->damage_tracker()->current_damage_rect().Intersects( | 795 !root_surface->damage_tracker()->current_damage_rect().Intersects( |
| 799 root_surface->content_rect()); | 796 root_surface->content_rect()); |
| 800 bool root_surface_has_contributing_layers = | 797 bool root_surface_has_contributing_layers = |
| 801 !root_surface->layer_list().empty(); | 798 !root_surface->layer_list().empty(); |
| 802 bool hud_wants_to_draw_ = active_tree_->hud_layer() && | 799 bool hud_wants_to_draw_ = active_tree_->hud_layer() && |
| 803 active_tree_->hud_layer()->IsAnimatingHUDContents(); | 800 active_tree_->hud_layer()->IsAnimatingHUDContents(); |
| 804 if (root_surface_has_contributing_layers && | 801 if (root_surface_has_contributing_layers && |
| 805 root_surface_has_no_visible_damage && | 802 root_surface_has_no_visible_damage && |
| 806 !active_tree_->property_trees()->effect_tree.HasCopyRequests() && | 803 !active_tree_->property_trees()->effect_tree.HasCopyRequests() && |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 for (const auto& quad : render_pass->quad_list) | 976 for (const auto& quad : render_pass->quad_list) |
| 980 DCHECK(quad->shared_quad_state); | 977 DCHECK(quad->shared_quad_state); |
| 981 } | 978 } |
| 982 DCHECK(frame->render_passes.back()->output_rect.origin().IsOrigin()); | 979 DCHECK(frame->render_passes.back()->output_rect.origin().IsOrigin()); |
| 983 #endif | 980 #endif |
| 984 | 981 |
| 985 if (!active_tree_->has_transparent_background()) { | 982 if (!active_tree_->has_transparent_background()) { |
| 986 frame->render_passes.back()->has_transparent_background = false; | 983 frame->render_passes.back()->has_transparent_background = false; |
| 987 AppendQuadsToFillScreen( | 984 AppendQuadsToFillScreen( |
| 988 active_tree_->RootScrollLayerDeviceViewportBounds(), | 985 active_tree_->RootScrollLayerDeviceViewportBounds(), |
| 989 frame->render_passes.back().get(), active_tree_->root_layer(), | 986 frame->render_passes.back().get(), active_tree_->RootRenderSurface(), |
| 990 active_tree_->background_color(), unoccluded_screen_space_region); | 987 active_tree_->background_color(), unoccluded_screen_space_region); |
| 991 } | 988 } |
| 992 | 989 |
| 993 RemoveRenderPasses(frame); | 990 RemoveRenderPasses(frame); |
| 994 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); | 991 renderer_->DecideRenderPassAllocationsForFrame(frame->render_passes); |
| 995 | 992 |
| 996 if (have_copy_request) { | 993 if (have_copy_request) { |
| 997 // Any copy requests left in the tree are not going to get serviced, and | 994 // Any copy requests left in the tree are not going to get serviced, and |
| 998 // should be aborted. | 995 // should be aborted. |
| 999 active_tree()->property_trees()->effect_tree.ClearCopyRequests(); | 996 active_tree()->property_trees()->effect_tree.ClearCopyRequests(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 // This will cause NotifyTileStateChanged() to be called for any tiles that | 1097 // This will cause NotifyTileStateChanged() to be called for any tiles that |
| 1101 // completed, which will add damage for visible tiles to the frame for them so | 1098 // completed, which will add damage for visible tiles to the frame for them so |
| 1102 // they appear as part of the current frame being drawn. | 1099 // they appear as part of the current frame being drawn. |
| 1103 tile_manager_.Flush(); | 1100 tile_manager_.Flush(); |
| 1104 | 1101 |
| 1105 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); | 1102 frame->render_surface_layer_list = &active_tree_->RenderSurfaceLayerList(); |
| 1106 frame->render_passes.clear(); | 1103 frame->render_passes.clear(); |
| 1107 frame->will_draw_layers.clear(); | 1104 frame->will_draw_layers.clear(); |
| 1108 frame->has_no_damage = false; | 1105 frame->has_no_damage = false; |
| 1109 | 1106 |
| 1110 if (active_tree_->root_layer()) { | 1107 if (active_tree_->RootRenderSurface()) { |
| 1111 gfx::Rect device_viewport_damage_rect = viewport_damage_rect_; | 1108 gfx::Rect device_viewport_damage_rect = viewport_damage_rect_; |
| 1112 viewport_damage_rect_ = gfx::Rect(); | 1109 viewport_damage_rect_ = gfx::Rect(); |
| 1113 | 1110 |
| 1114 active_tree_->root_layer()->render_surface()->damage_tracker()-> | 1111 active_tree_->RootRenderSurface()->damage_tracker()->AddDamageNextUpdate( |
| 1115 AddDamageNextUpdate(device_viewport_damage_rect); | 1112 device_viewport_damage_rect); |
| 1116 } | 1113 } |
| 1117 | 1114 |
| 1118 DrawResult draw_result = CalculateRenderPasses(frame); | 1115 DrawResult draw_result = CalculateRenderPasses(frame); |
| 1119 if (draw_result != DRAW_SUCCESS) { | 1116 if (draw_result != DRAW_SUCCESS) { |
| 1120 DCHECK(!resourceless_software_draw_); | 1117 DCHECK(!resourceless_software_draw_); |
| 1121 return draw_result; | 1118 return draw_result; |
| 1122 } | 1119 } |
| 1123 | 1120 |
| 1124 // If we return DRAW_SUCCESS, then we expect DrawLayers() to be called before | 1121 // If we return DRAW_SUCCESS, then we expect DrawLayers() to be called before |
| 1125 // this function is called again. | 1122 // this function is called again. |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 DCHECK(!frame->render_passes.empty()); | 1636 DCHECK(!frame->render_passes.empty()); |
| 1640 | 1637 |
| 1641 fps_counter_->SaveTimeStamp(frame_begin_time, | 1638 fps_counter_->SaveTimeStamp(frame_begin_time, |
| 1642 !output_surface_->context_provider()); | 1639 !output_surface_->context_provider()); |
| 1643 rendering_stats_instrumentation_->IncrementFrameCount(1); | 1640 rendering_stats_instrumentation_->IncrementFrameCount(1); |
| 1644 | 1641 |
| 1645 memory_history_->SaveEntry(tile_manager_.memory_stats_from_last_assign()); | 1642 memory_history_->SaveEntry(tile_manager_.memory_stats_from_last_assign()); |
| 1646 | 1643 |
| 1647 if (debug_state_.ShowHudRects()) { | 1644 if (debug_state_.ShowHudRects()) { |
| 1648 debug_rect_history_->SaveDebugRectsForCurrentFrame( | 1645 debug_rect_history_->SaveDebugRectsForCurrentFrame( |
| 1649 active_tree_->root_layer(), | 1646 active_tree(), active_tree_->hud_layer(), |
| 1650 active_tree_->hud_layer(), | 1647 *frame->render_surface_layer_list, debug_state_); |
| 1651 *frame->render_surface_layer_list, | |
| 1652 debug_state_); | |
| 1653 } | 1648 } |
| 1654 | 1649 |
| 1655 bool is_new_trace; | 1650 bool is_new_trace; |
| 1656 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); | 1651 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); |
| 1657 if (is_new_trace) { | 1652 if (is_new_trace) { |
| 1658 if (pending_tree_) { | 1653 if (pending_tree_) { |
| 1659 LayerTreeHostCommon::CallFunctionForEveryLayer( | 1654 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 1660 pending_tree(), [](LayerImpl* layer) { layer->DidBeginTracing(); }); | 1655 pending_tree(), [](LayerImpl* layer) { layer->DidBeginTracing(); }); |
| 1661 } | 1656 } |
| 1662 LayerTreeHostCommon::CallFunctionForEveryLayer( | 1657 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 void LayerTreeHostImpl::DidLoseOutputSurface() { | 1930 void LayerTreeHostImpl::DidLoseOutputSurface() { |
| 1936 if (resource_provider_) | 1931 if (resource_provider_) |
| 1937 resource_provider_->DidLoseOutputSurface(); | 1932 resource_provider_->DidLoseOutputSurface(); |
| 1938 client_->DidLoseOutputSurfaceOnImplThread(); | 1933 client_->DidLoseOutputSurfaceOnImplThread(); |
| 1939 } | 1934 } |
| 1940 | 1935 |
| 1941 bool LayerTreeHostImpl::HaveRootScrollLayer() const { | 1936 bool LayerTreeHostImpl::HaveRootScrollLayer() const { |
| 1942 return !!InnerViewportScrollLayer(); | 1937 return !!InnerViewportScrollLayer(); |
| 1943 } | 1938 } |
| 1944 | 1939 |
| 1945 LayerImpl* LayerTreeHostImpl::RootLayer() const { | |
| 1946 return active_tree_->root_layer(); | |
| 1947 } | |
| 1948 | |
| 1949 LayerImpl* LayerTreeHostImpl::InnerViewportScrollLayer() const { | 1940 LayerImpl* LayerTreeHostImpl::InnerViewportScrollLayer() const { |
| 1950 return active_tree_->InnerViewportScrollLayer(); | 1941 return active_tree_->InnerViewportScrollLayer(); |
| 1951 } | 1942 } |
| 1952 | 1943 |
| 1953 LayerImpl* LayerTreeHostImpl::OuterViewportScrollLayer() const { | 1944 LayerImpl* LayerTreeHostImpl::OuterViewportScrollLayer() const { |
| 1954 return active_tree_->OuterViewportScrollLayer(); | 1945 return active_tree_->OuterViewportScrollLayer(); |
| 1955 } | 1946 } |
| 1956 | 1947 |
| 1957 LayerImpl* LayerTreeHostImpl::CurrentlyScrollingLayer() const { | 1948 LayerImpl* LayerTreeHostImpl::CurrentlyScrollingLayer() const { |
| 1958 return active_tree_->CurrentlyScrollingLayer(); | 1949 return active_tree_->CurrentlyScrollingLayer(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 DCHECK(pending_tree_duration_timer_); | 1984 DCHECK(pending_tree_duration_timer_); |
| 1994 // Reset will call the destructor and log the timer histogram. | 1985 // Reset will call the destructor and log the timer histogram. |
| 1995 pending_tree_duration_timer_.reset(); | 1986 pending_tree_duration_timer_.reset(); |
| 1996 | 1987 |
| 1997 // Process any requests in the UI resource queue. The request queue is | 1988 // Process any requests in the UI resource queue. The request queue is |
| 1998 // given in LayerTreeHost::FinishCommitOnImplThread. This must take place | 1989 // given in LayerTreeHost::FinishCommitOnImplThread. This must take place |
| 1999 // before the swap. | 1990 // before the swap. |
| 2000 pending_tree_->ProcessUIResourceRequestQueue(); | 1991 pending_tree_->ProcessUIResourceRequestQueue(); |
| 2001 | 1992 |
| 2002 if (pending_tree_->needs_full_tree_sync()) { | 1993 if (pending_tree_->needs_full_tree_sync()) { |
| 2003 TreeSynchronizer::SynchronizeTrees(pending_tree_->root_layer(), | 1994 TreeSynchronizer::SynchronizeTrees(pending_tree_.get(), |
| 2004 active_tree_.get()); | 1995 active_tree_.get()); |
| 2005 } | 1996 } |
| 2006 | 1997 |
| 2007 // Property trees may store damage status. We preserve the active tree | 1998 // Property trees may store damage status. We preserve the active tree |
| 2008 // damage status by pushing the damage status from active tree property | 1999 // damage status by pushing the damage status from active tree property |
| 2009 // trees to pending tree property trees or by moving it onto the layers. | 2000 // trees to pending tree property trees or by moving it onto the layers. |
| 2010 if (active_tree_->property_trees()->changed) { | 2001 if (active_tree_->property_trees()->changed) { |
| 2011 if (pending_tree_->property_trees()->sequence_number == | 2002 if (pending_tree_->property_trees()->sequence_number == |
| 2012 active_tree_->property_trees()->sequence_number) | 2003 active_tree_->property_trees()->sequence_number) |
| 2013 active_tree_->property_trees()->PushChangeTrackingTo( | 2004 active_tree_->property_trees()->PushChangeTrackingTo( |
| 2014 pending_tree_->property_trees()); | 2005 pending_tree_->property_trees()); |
| 2015 else | 2006 else |
| 2016 active_tree_->MoveChangeTrackingToLayers(); | 2007 active_tree_->MoveChangeTrackingToLayers(); |
| 2017 } | 2008 } |
| 2018 active_tree_->property_trees()->PushOpacityIfNeeded( | 2009 active_tree_->property_trees()->PushOpacityIfNeeded( |
| 2019 pending_tree_->property_trees()); | 2010 pending_tree_->property_trees()); |
| 2020 | 2011 |
| 2021 TreeSynchronizer::PushLayerProperties(pending_tree(), active_tree()); | 2012 TreeSynchronizer::PushLayerProperties(pending_tree(), active_tree()); |
| 2022 pending_tree_->PushPropertiesTo(active_tree_.get()); | 2013 pending_tree_->PushPropertiesTo(active_tree_.get()); |
| 2023 if (pending_tree_->root_layer()) | 2014 if (!pending_tree_->LayerListIsEmpty()) |
| 2024 pending_tree_->property_trees()->ResetAllChangeTracking(); | 2015 pending_tree_->property_trees()->ResetAllChangeTracking(); |
| 2025 | 2016 |
| 2026 // Now that we've synced everything from the pending tree to the active | 2017 // Now that we've synced everything from the pending tree to the active |
| 2027 // tree, rename the pending tree the recycle tree so we can reuse it on the | 2018 // tree, rename the pending tree the recycle tree so we can reuse it on the |
| 2028 // next sync. | 2019 // next sync. |
| 2029 DCHECK(!recycle_tree_); | 2020 DCHECK(!recycle_tree_); |
| 2030 pending_tree_.swap(recycle_tree_); | 2021 pending_tree_.swap(recycle_tree_); |
| 2031 | 2022 |
| 2032 // If we commit to the active tree directly, this is already done during | 2023 // If we commit to the active tree directly, this is already done during |
| 2033 // commit. | 2024 // commit. |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3361 std::unique_ptr<BeginFrameCallbackList> callbacks(new BeginFrameCallbackList); | 3352 std::unique_ptr<BeginFrameCallbackList> callbacks(new BeginFrameCallbackList); |
| 3362 if (mutator_) { | 3353 if (mutator_) { |
| 3363 const base::Closure& callback = mutator_->TakeMutations(); | 3354 const base::Closure& callback = mutator_->TakeMutations(); |
| 3364 if (!callback.is_null()) | 3355 if (!callback.is_null()) |
| 3365 callbacks->push_back(callback); | 3356 callbacks->push_back(callback); |
| 3366 } | 3357 } |
| 3367 return callbacks; | 3358 return callbacks; |
| 3368 } | 3359 } |
| 3369 | 3360 |
| 3370 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, | 3361 static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info, |
| 3371 LayerImpl* root_layer) { | 3362 LayerTreeImpl* tree_impl) { |
| 3372 if (!root_layer) | 3363 if (tree_impl->LayerListIsEmpty()) |
| 3373 return; | 3364 return; |
| 3374 | 3365 |
| 3375 return root_layer->layer_tree_impl() | 3366 return tree_impl->property_trees()->scroll_tree.CollectScrollDeltas( |
| 3376 ->property_trees() | 3367 scroll_info); |
| 3377 ->scroll_tree.CollectScrollDeltas(scroll_info); | |
| 3378 } | 3368 } |
| 3379 | 3369 |
| 3380 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { | 3370 std::unique_ptr<ScrollAndScaleSet> LayerTreeHostImpl::ProcessScrollDeltas() { |
| 3381 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); | 3371 std::unique_ptr<ScrollAndScaleSet> scroll_info(new ScrollAndScaleSet()); |
| 3382 | 3372 |
| 3383 CollectScrollDeltas(scroll_info.get(), active_tree_->root_layer()); | 3373 CollectScrollDeltas(scroll_info.get(), active_tree_.get()); |
| 3384 scroll_info->page_scale_delta = | 3374 scroll_info->page_scale_delta = |
| 3385 active_tree_->page_scale_factor()->PullDeltaForMainThread(); | 3375 active_tree_->page_scale_factor()->PullDeltaForMainThread(); |
| 3386 scroll_info->top_controls_delta = | 3376 scroll_info->top_controls_delta = |
| 3387 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); | 3377 active_tree()->top_controls_shown_ratio()->PullDeltaForMainThread(); |
| 3388 scroll_info->elastic_overscroll_delta = | 3378 scroll_info->elastic_overscroll_delta = |
| 3389 active_tree_->elastic_overscroll()->PullDeltaForMainThread(); | 3379 active_tree_->elastic_overscroll()->PullDeltaForMainThread(); |
| 3390 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); | 3380 scroll_info->swap_promises.swap(swap_promises_for_main_thread_scroll_update_); |
| 3391 | 3381 |
| 3392 return scroll_info; | 3382 return scroll_info; |
| 3393 } | 3383 } |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4034 const { | 4024 const { |
| 4035 return fixed_raster_scale_attempted_scale_change_history_.count() >= | 4025 return fixed_raster_scale_attempted_scale_change_history_.count() >= |
| 4036 kFixedRasterScaleAttemptedScaleChangeThreshold; | 4026 kFixedRasterScaleAttemptedScaleChangeThreshold; |
| 4037 } | 4027 } |
| 4038 | 4028 |
| 4039 void LayerTreeHostImpl::SetFixedRasterScaleAttemptedToChangeScale() { | 4029 void LayerTreeHostImpl::SetFixedRasterScaleAttemptedToChangeScale() { |
| 4040 fixed_raster_scale_attempted_scale_change_history_.set(0); | 4030 fixed_raster_scale_attempted_scale_change_history_.set(0); |
| 4041 } | 4031 } |
| 4042 | 4032 |
| 4043 } // namespace cc | 4033 } // namespace cc |
| OLD | NEW |