| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 #include "cc/tiles/picture_layer_tiling.h" | 75 #include "cc/tiles/picture_layer_tiling.h" |
| 76 #include "cc/tiles/raster_tile_priority_queue.h" | 76 #include "cc/tiles/raster_tile_priority_queue.h" |
| 77 #include "cc/tiles/software_image_decode_controller.h" | 77 #include "cc/tiles/software_image_decode_controller.h" |
| 78 #include "cc/tiles/tile_task_manager.h" | 78 #include "cc/tiles/tile_task_manager.h" |
| 79 #include "cc/trees/damage_tracker.h" | 79 #include "cc/trees/damage_tracker.h" |
| 80 #include "cc/trees/draw_property_utils.h" | 80 #include "cc/trees/draw_property_utils.h" |
| 81 #include "cc/trees/latency_info_swap_promise_monitor.h" | 81 #include "cc/trees/latency_info_swap_promise_monitor.h" |
| 82 #include "cc/trees/layer_tree_host.h" | 82 #include "cc/trees/layer_tree_host.h" |
| 83 #include "cc/trees/layer_tree_host_common.h" | 83 #include "cc/trees/layer_tree_host_common.h" |
| 84 #include "cc/trees/layer_tree_impl.h" | 84 #include "cc/trees/layer_tree_impl.h" |
| 85 #include "cc/trees/root_scroller_controller.h" |
| 85 #include "cc/trees/single_thread_proxy.h" | 86 #include "cc/trees/single_thread_proxy.h" |
| 86 #include "cc/trees/tree_synchronizer.h" | 87 #include "cc/trees/tree_synchronizer.h" |
| 87 #include "gpu/GLES2/gl2extchromium.h" | 88 #include "gpu/GLES2/gl2extchromium.h" |
| 88 #include "gpu/command_buffer/client/gles2_interface.h" | 89 #include "gpu/command_buffer/client/gles2_interface.h" |
| 89 #include "ui/gfx/geometry/point_conversions.h" | 90 #include "ui/gfx/geometry/point_conversions.h" |
| 90 #include "ui/gfx/geometry/rect_conversions.h" | 91 #include "ui/gfx/geometry/rect_conversions.h" |
| 91 #include "ui/gfx/geometry/scroll_offset.h" | 92 #include "ui/gfx/geometry/scroll_offset.h" |
| 92 #include "ui/gfx/geometry/size_conversions.h" | 93 #include "ui/gfx/geometry/size_conversions.h" |
| 93 #include "ui/gfx/geometry/vector2d_conversions.h" | 94 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 94 | 95 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 260 |
| 260 viewport_ = Viewport::Create(this); | 261 viewport_ = Viewport::Create(this); |
| 261 | 262 |
| 262 TRACE_EVENT_OBJECT_CREATED_WITH_ID( | 263 TRACE_EVENT_OBJECT_CREATED_WITH_ID( |
| 263 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 264 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
| 264 | 265 |
| 265 top_controls_manager_ = | 266 top_controls_manager_ = |
| 266 TopControlsManager::Create(this, | 267 TopControlsManager::Create(this, |
| 267 settings.top_controls_show_threshold, | 268 settings.top_controls_show_threshold, |
| 268 settings.top_controls_hide_threshold); | 269 settings.top_controls_hide_threshold); |
| 270 root_scroller_controller_ = RootScrollerController::Create(); |
| 269 } | 271 } |
| 270 | 272 |
| 271 LayerTreeHostImpl::~LayerTreeHostImpl() { | 273 LayerTreeHostImpl::~LayerTreeHostImpl() { |
| 272 DCHECK(task_runner_provider_->IsImplThread()); | 274 DCHECK(task_runner_provider_->IsImplThread()); |
| 273 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 275 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
| 274 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 276 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 275 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 277 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
| 276 | 278 |
| 277 if (input_handler_client_) { | 279 if (input_handler_client_) { |
| 278 input_handler_client_->WillShutdown(); | 280 input_handler_client_->WillShutdown(); |
| (...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2025 } else { | 2027 } else { |
| 2026 active_tree_->ProcessUIResourceRequestQueue(); | 2028 active_tree_->ProcessUIResourceRequestQueue(); |
| 2027 } | 2029 } |
| 2028 | 2030 |
| 2029 // bounds_delta isn't a pushed property, so the newly-pushed property tree | 2031 // bounds_delta isn't a pushed property, so the newly-pushed property tree |
| 2030 // won't already account for current bounds_delta values. This needs to | 2032 // won't already account for current bounds_delta values. This needs to |
| 2031 // happen before calling UpdateViewportContainerSizes(). | 2033 // happen before calling UpdateViewportContainerSizes(). |
| 2032 active_tree_->UpdatePropertyTreesForBoundsDelta(); | 2034 active_tree_->UpdatePropertyTreesForBoundsDelta(); |
| 2033 UpdateViewportContainerSizes(); | 2035 UpdateViewportContainerSizes(); |
| 2034 | 2036 |
| 2037 root_scroller_controller_->SetRootScrollerLayer( |
| 2038 active_tree_->RootScrollerLayer()); |
| 2039 |
| 2035 active_tree_->DidBecomeActive(); | 2040 active_tree_->DidBecomeActive(); |
| 2036 client_->RenewTreePriority(); | 2041 client_->RenewTreePriority(); |
| 2037 // If we have any picture layers, then by activating we also modified tile | 2042 // If we have any picture layers, then by activating we also modified tile |
| 2038 // priorities. | 2043 // priorities. |
| 2039 if (!active_tree_->picture_layers().empty()) | 2044 if (!active_tree_->picture_layers().empty()) |
| 2040 DidModifyTilePriorities(); | 2045 DidModifyTilePriorities(); |
| 2041 | 2046 |
| 2042 client_->OnCanDrawStateChanged(CanDraw()); | 2047 client_->OnCanDrawStateChanged(CanDraw()); |
| 2043 client_->DidActivateSyncTree(); | 2048 client_->DidActivateSyncTree(); |
| 2044 if (!tree_activation_callback_.is_null()) | 2049 if (!tree_activation_callback_.is_null()) |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3042 // crbug.com/526462) | 3047 // crbug.com/526462) |
| 3043 std::list<const ScrollNode*> current_scroll_chain; | 3048 std::list<const ScrollNode*> current_scroll_chain; |
| 3044 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; | 3049 ScrollTree& scroll_tree = active_tree_->property_trees()->scroll_tree; |
| 3045 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); | 3050 ScrollNode* scroll_node = scroll_tree.CurrentlyScrollingNode(); |
| 3046 if (scroll_node) { | 3051 if (scroll_node) { |
| 3047 for (; scroll_tree.parent(scroll_node); | 3052 for (; scroll_tree.parent(scroll_node); |
| 3048 scroll_node = scroll_tree.parent(scroll_node)) { | 3053 scroll_node = scroll_tree.parent(scroll_node)) { |
| 3049 // Skip the outer viewport scroll layer so that we try to scroll the | 3054 // Skip the outer viewport scroll layer so that we try to scroll the |
| 3050 // viewport only once. i.e. The inner viewport layer represents the | 3055 // viewport only once. i.e. The inner viewport layer represents the |
| 3051 // viewport. | 3056 // viewport. |
| 3052 if (!scroll_node->data.scrollable || | 3057 if (scroll_node->data.scrollable && |
| 3053 scroll_node->data.is_outer_viewport_scroll_layer) | 3058 !scroll_node->data.is_outer_viewport_scroll_layer) |
| 3054 continue; | 3059 current_scroll_chain.push_front(scroll_node); |
| 3055 current_scroll_chain.push_front(scroll_node); | 3060 |
| 3061 // TODO(bokan): We should modify the scroll tree to be built to take |
| 3062 // account of the root scroller. |
| 3063 // If we're reached the root scroller, don't keep chaining. |
| 3064 LayerImpl* root_scroller_layer = |
| 3065 root_scroller_controller()->GetRootScrollerLayer(); |
| 3066 if (root_scroller_layer && |
| 3067 scroll_node->owner_id == root_scroller_layer->id()) |
| 3068 break; |
| 3056 } | 3069 } |
| 3057 } | 3070 } |
| 3058 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, | 3071 scroll_state->set_scroll_chain_and_layer_tree(current_scroll_chain, |
| 3059 active_tree()); | 3072 active_tree()); |
| 3060 scroll_state->DistributeToScrollChainDescendant(); | 3073 scroll_state->DistributeToScrollChainDescendant(); |
| 3061 } | 3074 } |
| 3062 | 3075 |
| 3063 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( | 3076 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
| 3064 ScrollState* scroll_state) { | 3077 ScrollState* scroll_state) { |
| 3065 DCHECK(scroll_state); | 3078 DCHECK(scroll_state); |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4008 return task_runner_provider_->HasImplThread(); | 4021 return task_runner_provider_->HasImplThread(); |
| 4009 } | 4022 } |
| 4010 | 4023 |
| 4011 bool LayerTreeHostImpl::CommitToActiveTree() const { | 4024 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 4012 // In single threaded mode we skip the pending tree and commit directly to the | 4025 // In single threaded mode we skip the pending tree and commit directly to the |
| 4013 // active tree. | 4026 // active tree. |
| 4014 return !task_runner_provider_->HasImplThread(); | 4027 return !task_runner_provider_->HasImplThread(); |
| 4015 } | 4028 } |
| 4016 | 4029 |
| 4017 } // namespace cc | 4030 } // namespace cc |
| OLD | NEW |