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