OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_IMPL_H_ |
6 #define CC_TREES_LAYER_TREE_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "cc/base/swap_promise.h" |
14 #include "cc/layers/layer_impl.h" | 15 #include "cc/layers/layer_impl.h" |
15 #include "cc/resources/ui_resource_client.h" | 16 #include "cc/resources/ui_resource_client.h" |
16 #include "ui/events/latency_info.h" | 17 #include "ui/events/latency_info.h" |
17 | 18 |
18 #if defined(COMPILER_GCC) | 19 #if defined(COMPILER_GCC) |
19 namespace BASE_HASH_NAMESPACE { | 20 namespace BASE_HASH_NAMESPACE { |
20 template<> | 21 template<> |
21 struct hash<cc::LayerImpl*> { | 22 struct hash<cc::LayerImpl*> { |
22 size_t operator()(cc::LayerImpl* ptr) const { | 23 size_t operator()(cc::LayerImpl* ptr) const { |
23 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | 24 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // Useful for debug assertions, probably shouldn't be used for anything else. | 201 // Useful for debug assertions, probably shouldn't be used for anything else. |
201 Proxy* proxy() const; | 202 Proxy* proxy() const; |
202 | 203 |
203 void SetRootLayerScrollOffsetDelegate( | 204 void SetRootLayerScrollOffsetDelegate( |
204 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate); | 205 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate); |
205 | 206 |
206 void SetLatencyInfo(const ui::LatencyInfo& latency_info); | 207 void SetLatencyInfo(const ui::LatencyInfo& latency_info); |
207 const ui::LatencyInfo& GetLatencyInfo(); | 208 const ui::LatencyInfo& GetLatencyInfo(); |
208 void ClearLatencyInfo(); | 209 void ClearLatencyInfo(); |
209 | 210 |
| 211 // Call this function when you expect there to be a swap buffer and want to |
| 212 // have something done when the swap buffer actaully happens. Provide a |
| 213 // did_swap_callback in the SwapPromise to be called when swap buffer happens, |
| 214 // and a swap_aborted_callback to be called when the swap buffer is aborted ( |
| 215 // e.g. the next frame generated does not have actual damage). |
| 216 void QueueSwapPromise(const SwapPromise& swap_promise); |
| 217 |
| 218 void TakeSwapPromise(std::vector<SwapPromise>* new_swap_promise); |
| 219 void FinishSwapPromise(); |
| 220 void BreakSwapPromise(const std::string& msg); |
| 221 |
210 void DidModifyTilePriorities(); | 222 void DidModifyTilePriorities(); |
211 | 223 |
212 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; | 224 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; |
213 void ProcessUIResourceRequestQueue(); | 225 void ProcessUIResourceRequestQueue(); |
214 | 226 |
215 bool IsUIResourceOpaque(UIResourceId uid) const; | 227 bool IsUIResourceOpaque(UIResourceId uid) const; |
216 | 228 |
217 void AddLayerWithCopyOutputRequest(LayerImpl* layer); | 229 void AddLayerWithCopyOutputRequest(LayerImpl* layer); |
218 void RemoveLayerWithCopyOutputRequest(LayerImpl* layer); | 230 void RemoveLayerWithCopyOutputRequest(LayerImpl* layer); |
219 const std::vector<LayerImpl*> LayersWithCopyOutputRequest() const; | 231 const std::vector<LayerImpl*> LayersWithCopyOutputRequest() const; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 bool needs_update_draw_properties_; | 274 bool needs_update_draw_properties_; |
263 | 275 |
264 // In impl-side painting mode, this is true when the tree may contain | 276 // In impl-side painting mode, this is true when the tree may contain |
265 // structural differences relative to the active tree. | 277 // structural differences relative to the active tree. |
266 bool needs_full_tree_sync_; | 278 bool needs_full_tree_sync_; |
267 | 279 |
268 bool next_activation_forces_redraw_; | 280 bool next_activation_forces_redraw_; |
269 | 281 |
270 ui::LatencyInfo latency_info_; | 282 ui::LatencyInfo latency_info_; |
271 | 283 |
| 284 std::vector<SwapPromise> swap_promise_list_; |
| 285 |
272 UIResourceRequestQueue ui_resource_request_queue_; | 286 UIResourceRequestQueue ui_resource_request_queue_; |
273 | 287 |
274 private: | 288 private: |
275 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 289 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
276 }; | 290 }; |
277 | 291 |
278 } // namespace cc | 292 } // namespace cc |
279 | 293 |
280 #endif // CC_TREES_LAYER_TREE_IMPL_H_ | 294 #endif // CC_TREES_LAYER_TREE_IMPL_H_ |
OLD | NEW |