| 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_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "cc/layers/scrollbar_layer_impl_base.h" | 27 #include "cc/layers/scrollbar_layer_impl_base.h" |
| 28 #include "cc/resources/ui_resource_request.h" | 28 #include "cc/resources/ui_resource_request.h" |
| 29 #include "cc/trees/layer_tree_host_common.h" | 29 #include "cc/trees/layer_tree_host_common.h" |
| 30 #include "cc/trees/layer_tree_host_impl.h" | 30 #include "cc/trees/layer_tree_host_impl.h" |
| 31 #include "cc/trees/occlusion_tracker.h" | 31 #include "cc/trees/occlusion_tracker.h" |
| 32 #include "ui/gfx/geometry/point_conversions.h" | 32 #include "ui/gfx/geometry/point_conversions.h" |
| 33 #include "ui/gfx/geometry/size_conversions.h" | 33 #include "ui/gfx/geometry/size_conversions.h" |
| 34 #include "ui/gfx/geometry/vector2d_conversions.h" | 34 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 35 | 35 |
| 36 namespace cc { | 36 namespace cc { |
| 37 | |
| 38 // This class exists to split the LayerScrollOffsetDelegate between the | 37 // This class exists to split the LayerScrollOffsetDelegate between the |
| 39 // InnerViewportScrollLayer and the OuterViewportScrollLayer in a manner | 38 // InnerViewportScrollLayer and the OuterViewportScrollLayer in a manner |
| 40 // that never requires the embedder or LayerImpl to know about. | 39 // that never requires the embedder or LayerImpl to know about. |
| 41 class LayerScrollOffsetDelegateProxy : public LayerImpl::ScrollOffsetDelegate { | 40 class LayerScrollOffsetDelegateProxy : public LayerImpl::ScrollOffsetDelegate { |
| 42 public: | 41 public: |
| 43 LayerScrollOffsetDelegateProxy(LayerImpl* layer, | 42 LayerScrollOffsetDelegateProxy(LayerImpl* layer, |
| 44 LayerScrollOffsetDelegate* delegate, | 43 LayerScrollOffsetDelegate* delegate, |
| 45 LayerTreeImpl* layer_tree) | 44 LayerTreeImpl* layer_tree) |
| 46 : layer_(layer), delegate_(delegate), layer_tree_impl_(layer_tree) {} | 45 : layer_(layer), delegate_(delegate), layer_tree_impl_(layer_tree) {} |
| 47 virtual ~LayerScrollOffsetDelegateProxy() {} | 46 virtual ~LayerScrollOffsetDelegateProxy() {} |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 127 } |
| 129 | 128 |
| 130 void LayerTreeImpl::RecreateResources() { | 129 void LayerTreeImpl::RecreateResources() { |
| 131 if (root_layer_) { | 130 if (root_layer_) { |
| 132 LayerTreeHostCommon::CallFunctionForSubtree( | 131 LayerTreeHostCommon::CallFunctionForSubtree( |
| 133 root_layer_.get(), | 132 root_layer_.get(), |
| 134 [](LayerImpl* layer) { layer->RecreateResources(); }); | 133 [](LayerImpl* layer) { layer->RecreateResources(); }); |
| 135 } | 134 } |
| 136 } | 135 } |
| 137 | 136 |
| 137 void LayerTreeImpl::GatherFrameTimingRequestIds( |
| 138 std::vector<int64_t>* request_ids) { |
| 139 if (!root_layer_) |
| 140 return; |
| 141 |
| 142 // TODO(vmpstr): Early out if there are no requests on any of the layers. For |
| 143 // that, we need to inform LayerTreeImpl whenever there are requests when we |
| 144 // get them. |
| 145 LayerTreeHostCommon::CallFunctionForSubtree( |
| 146 root_layer_.get(), [request_ids](LayerImpl* layer) { |
| 147 layer->GatherFrameTimingRequestIds(request_ids); |
| 148 }); |
| 149 } |
| 150 |
| 138 void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) { | 151 void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) { |
| 139 if (inner_viewport_scroll_layer_) | 152 if (inner_viewport_scroll_layer_) |
| 140 inner_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); | 153 inner_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); |
| 141 if (outer_viewport_scroll_layer_) | 154 if (outer_viewport_scroll_layer_) |
| 142 outer_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); | 155 outer_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); |
| 143 inner_viewport_scroll_delegate_proxy_ = nullptr; | 156 inner_viewport_scroll_delegate_proxy_ = nullptr; |
| 144 outer_viewport_scroll_delegate_proxy_ = nullptr; | 157 outer_viewport_scroll_delegate_proxy_ = nullptr; |
| 145 | 158 |
| 146 root_layer_ = layer.Pass(); | 159 root_layer_ = layer.Pass(); |
| 147 currently_scrolling_layer_ = NULL; | 160 currently_scrolling_layer_ = NULL; |
| (...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 scoped_ptr<PendingPageScaleAnimation> pending_animation) { | 1649 scoped_ptr<PendingPageScaleAnimation> pending_animation) { |
| 1637 pending_page_scale_animation_ = pending_animation.Pass(); | 1650 pending_page_scale_animation_ = pending_animation.Pass(); |
| 1638 } | 1651 } |
| 1639 | 1652 |
| 1640 scoped_ptr<PendingPageScaleAnimation> | 1653 scoped_ptr<PendingPageScaleAnimation> |
| 1641 LayerTreeImpl::TakePendingPageScaleAnimation() { | 1654 LayerTreeImpl::TakePendingPageScaleAnimation() { |
| 1642 return pending_page_scale_animation_.Pass(); | 1655 return pending_page_scale_animation_.Pass(); |
| 1643 } | 1656 } |
| 1644 | 1657 |
| 1645 } // namespace cc | 1658 } // namespace cc |
| OLD | NEW |