| 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 #ifndef CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
| 14 #include "cc/base/scoped_ptr_vector.h" | |
| 15 #include "cc/layers/layer_lists.h" | 14 #include "cc/layers/layer_lists.h" |
| 16 #include "cc/trees/property_tree.h" | 15 #include "cc/trees/property_tree.h" |
| 17 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 18 #include "ui/gfx/geometry/vector2d.h" | 17 #include "ui/gfx/geometry/vector2d.h" |
| 19 #include "ui/gfx/transform.h" | 18 #include "ui/gfx/transform.h" |
| 20 | 19 |
| 21 namespace cc { | 20 namespace cc { |
| 22 | 21 |
| 23 class LayerImpl; | 22 class LayerImpl; |
| 24 class Layer; | 23 class Layer; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // from the given root layer (including mask and replica layers). | 141 // from the given root layer (including mask and replica layers). |
| 143 template <typename LayerType> | 142 template <typename LayerType> |
| 144 static LayerType* FindLayerInSubtree(LayerType* root_layer, int layer_id); | 143 static LayerType* FindLayerInSubtree(LayerType* root_layer, int layer_id); |
| 145 | 144 |
| 146 static Layer* get_layer_as_raw_ptr(const LayerList& layers, size_t index) { | 145 static Layer* get_layer_as_raw_ptr(const LayerList& layers, size_t index) { |
| 147 return layers[index].get(); | 146 return layers[index].get(); |
| 148 } | 147 } |
| 149 | 148 |
| 150 static LayerImpl* get_layer_as_raw_ptr(const OwnedLayerImplList& layers, | 149 static LayerImpl* get_layer_as_raw_ptr(const OwnedLayerImplList& layers, |
| 151 size_t index) { | 150 size_t index) { |
| 152 return layers[index]; | 151 return layers[index].get(); |
| 153 } | 152 } |
| 154 | 153 |
| 155 static LayerImpl* get_layer_as_raw_ptr(const LayerImplList& layers, | 154 static LayerImpl* get_layer_as_raw_ptr(const LayerImplList& layers, |
| 156 size_t index) { | 155 size_t index) { |
| 157 return layers[index]; | 156 return layers[index]; |
| 158 } | 157 } |
| 159 | 158 |
| 160 struct ScrollUpdateInfo { | 159 struct ScrollUpdateInfo { |
| 161 int layer_id; | 160 int layer_id; |
| 162 // TODO(miletus): Use ScrollOffset once LayerTreeHost/Blink fully supports | 161 // TODO(miletus): Use ScrollOffset once LayerTreeHost/Blink fully supports |
| 163 // franctional scroll offset. | 162 // franctional scroll offset. |
| 164 gfx::Vector2d scroll_delta; | 163 gfx::Vector2d scroll_delta; |
| 165 }; | 164 }; |
| 166 }; | 165 }; |
| 167 | 166 |
| 168 struct CC_EXPORT ScrollAndScaleSet { | 167 struct CC_EXPORT ScrollAndScaleSet { |
| 169 ScrollAndScaleSet(); | 168 ScrollAndScaleSet(); |
| 170 ~ScrollAndScaleSet(); | 169 ~ScrollAndScaleSet(); |
| 171 | 170 |
| 172 std::vector<LayerTreeHostCommon::ScrollUpdateInfo> scrolls; | 171 std::vector<LayerTreeHostCommon::ScrollUpdateInfo> scrolls; |
| 173 float page_scale_delta; | 172 float page_scale_delta; |
| 174 gfx::Vector2dF elastic_overscroll_delta; | 173 gfx::Vector2dF elastic_overscroll_delta; |
| 175 float top_controls_delta; | 174 float top_controls_delta; |
| 176 ScopedPtrVector<SwapPromise> swap_promises; | 175 std::vector<scoped_ptr<SwapPromise>> swap_promises; |
| 177 }; | 176 }; |
| 178 | 177 |
| 179 template <typename LayerType> | 178 template <typename LayerType> |
| 180 bool LayerTreeHostCommon::RenderSurfaceContributesToTarget( | 179 bool LayerTreeHostCommon::RenderSurfaceContributesToTarget( |
| 181 LayerType* layer, | 180 LayerType* layer, |
| 182 int target_surface_layer_id) { | 181 int target_surface_layer_id) { |
| 183 // A layer will either contribute its own content, or its render surface's | 182 // A layer will either contribute its own content, or its render surface's |
| 184 // content, to the target surface. The layer contributes its surface's content | 183 // content, to the target surface. The layer contributes its surface's content |
| 185 // when both the following are true: | 184 // when both the following are true: |
| 186 // (1) The layer actually has a render surface and rendering into that | 185 // (1) The layer actually has a render surface and rendering into that |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 function); | 234 function); |
| 236 } | 235 } |
| 237 } | 236 } |
| 238 | 237 |
| 239 CC_EXPORT PropertyTrees* GetPropertyTrees(Layer* layer); | 238 CC_EXPORT PropertyTrees* GetPropertyTrees(Layer* layer); |
| 240 CC_EXPORT PropertyTrees* GetPropertyTrees(LayerImpl* layer); | 239 CC_EXPORT PropertyTrees* GetPropertyTrees(LayerImpl* layer); |
| 241 | 240 |
| 242 } // namespace cc | 241 } // namespace cc |
| 243 | 242 |
| 244 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ | 243 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ |
| OLD | NEW |