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 namespace { | |
38 | |
39 template <typename Lambda> | |
40 void ProcessLayersRecursive(LayerImpl* current, const Lambda& lambda) { | |
enne (OOO)
2015/03/06 00:00:57
This isn't needed anymore, yeah?
vmpstr
2015/03/06 00:59:53
Whoops, removed.
| |
41 DCHECK(current); | |
42 lambda(current); | |
43 if (current->mask_layer()) | |
44 ProcessLayersRecursive(current->mask_layer(), lambda); | |
45 if (current->replica_layer()) | |
46 ProcessLayersRecursive(current->replica_layer(), lambda); | |
47 for (size_t i = 0; i < current->children().size(); ++i) | |
48 ProcessLayersRecursive(current->children()[i], lambda); | |
49 } | |
50 | |
51 } // namespace | |
37 | 52 |
38 // This class exists to split the LayerScrollOffsetDelegate between the | 53 // This class exists to split the LayerScrollOffsetDelegate between the |
39 // InnerViewportScrollLayer and the OuterViewportScrollLayer in a manner | 54 // InnerViewportScrollLayer and the OuterViewportScrollLayer in a manner |
40 // that never requires the embedder or LayerImpl to know about. | 55 // that never requires the embedder or LayerImpl to know about. |
41 class LayerScrollOffsetDelegateProxy : public LayerImpl::ScrollOffsetDelegate { | 56 class LayerScrollOffsetDelegateProxy : public LayerImpl::ScrollOffsetDelegate { |
42 public: | 57 public: |
43 LayerScrollOffsetDelegateProxy(LayerImpl* layer, | 58 LayerScrollOffsetDelegateProxy(LayerImpl* layer, |
44 LayerScrollOffsetDelegate* delegate, | 59 LayerScrollOffsetDelegate* delegate, |
45 LayerTreeImpl* layer_tree) | 60 LayerTreeImpl* layer_tree) |
46 : layer_(layer), delegate_(delegate), layer_tree_impl_(layer_tree) {} | 61 : layer_(layer), delegate_(delegate), layer_tree_impl_(layer_tree) {} |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 } | 143 } |
129 | 144 |
130 void LayerTreeImpl::RecreateResources() { | 145 void LayerTreeImpl::RecreateResources() { |
131 if (root_layer_) { | 146 if (root_layer_) { |
132 LayerTreeHostCommon::CallFunctionForSubtree( | 147 LayerTreeHostCommon::CallFunctionForSubtree( |
133 root_layer_.get(), | 148 root_layer_.get(), |
134 [](LayerImpl* layer) { layer->RecreateResources(); }); | 149 [](LayerImpl* layer) { layer->RecreateResources(); }); |
135 } | 150 } |
136 } | 151 } |
137 | 152 |
153 void LayerTreeImpl::GatherFrameTimingRequestIds( | |
154 std::vector<int64_t>* request_ids) { | |
155 if (!root_layer_) | |
156 return; | |
157 | |
158 // TODO(vmpstr): Early out if there are no requests on any of the layers. For | |
159 // that, we need to inform LayerTreeImpl whenever there are requests when we | |
160 // get them. | |
161 LayerTreeHostCommon::CallFunctionForSubtree( | |
162 root_layer_.get(), [request_ids](LayerImpl* layer) { | |
163 layer->GatherFrameTimingRequestIds(request_ids); | |
164 }); | |
165 } | |
166 | |
138 void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) { | 167 void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) { |
139 if (inner_viewport_scroll_layer_) | 168 if (inner_viewport_scroll_layer_) |
140 inner_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); | 169 inner_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); |
141 if (outer_viewport_scroll_layer_) | 170 if (outer_viewport_scroll_layer_) |
142 outer_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); | 171 outer_viewport_scroll_layer_->SetScrollOffsetDelegate(NULL); |
143 inner_viewport_scroll_delegate_proxy_ = nullptr; | 172 inner_viewport_scroll_delegate_proxy_ = nullptr; |
144 outer_viewport_scroll_delegate_proxy_ = nullptr; | 173 outer_viewport_scroll_delegate_proxy_ = nullptr; |
145 | 174 |
146 root_layer_ = layer.Pass(); | 175 root_layer_ = layer.Pass(); |
147 currently_scrolling_layer_ = NULL; | 176 currently_scrolling_layer_ = NULL; |
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1636 scoped_ptr<PendingPageScaleAnimation> pending_animation) { | 1665 scoped_ptr<PendingPageScaleAnimation> pending_animation) { |
1637 pending_page_scale_animation_ = pending_animation.Pass(); | 1666 pending_page_scale_animation_ = pending_animation.Pass(); |
1638 } | 1667 } |
1639 | 1668 |
1640 scoped_ptr<PendingPageScaleAnimation> | 1669 scoped_ptr<PendingPageScaleAnimation> |
1641 LayerTreeImpl::TakePendingPageScaleAnimation() { | 1670 LayerTreeImpl::TakePendingPageScaleAnimation() { |
1642 return pending_page_scale_animation_.Pass(); | 1671 return pending_page_scale_animation_.Pass(); |
1643 } | 1672 } |
1644 | 1673 |
1645 } // namespace cc | 1674 } // namespace cc |
OLD | NEW |