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_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_H_ |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 #include <list> | 9 #include <list> |
10 #include <vector> | 10 #include <vector> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 int max_texture_size; | 81 int max_texture_size; |
82 bool avoid_pow2_textures; | 82 bool avoid_pow2_textures; |
83 bool using_map_image; | 83 bool using_map_image; |
84 bool using_shared_memory_resources; | 84 bool using_shared_memory_resources; |
85 }; | 85 }; |
86 | 86 |
87 struct CC_EXPORT UIResourceRequest { | 87 struct CC_EXPORT UIResourceRequest { |
88 enum UIResourceRequestType { | 88 enum UIResourceRequestType { |
89 UIResourceCreate, | 89 UIResourceCreate, |
90 UIResourceDelete, | 90 UIResourceDelete, |
| 91 UIResourceEvictionAck, |
91 UIResourceInvalidRequest | 92 UIResourceInvalidRequest |
92 }; | 93 }; |
93 | 94 |
94 UIResourceRequest(); | 95 UIResourceRequest(); |
95 ~UIResourceRequest(); | 96 ~UIResourceRequest(); |
96 UIResourceRequestType type; | 97 UIResourceRequestType type; |
97 UIResourceId id; | 98 UIResourceId id; |
98 scoped_refptr<UIResourceBitmap> bitmap; | 99 scoped_refptr<UIResourceBitmap> bitmap; |
| 100 uint64 ack; |
99 }; | 101 }; |
100 | 102 |
101 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { | 103 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { |
102 public: | 104 public: |
103 static scoped_ptr<LayerTreeHost> Create( | 105 static scoped_ptr<LayerTreeHost> Create( |
104 LayerTreeHostClient* client, | 106 LayerTreeHostClient* client, |
105 const LayerTreeSettings& settings, | 107 const LayerTreeSettings& settings, |
106 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 108 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
107 virtual ~LayerTreeHost(); | 109 virtual ~LayerTreeHost(); |
108 | 110 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // CreateUIResource creates a resource given a bitmap. The bitmap is | 278 // CreateUIResource creates a resource given a bitmap. The bitmap is |
277 // generated via an interface function, which is called when initializing the | 279 // generated via an interface function, which is called when initializing the |
278 // resource and when the resource has been lost (due to lost context). The | 280 // resource and when the resource has been lost (due to lost context). The |
279 // parameter of the interface is a single boolean, which indicates whether the | 281 // parameter of the interface is a single boolean, which indicates whether the |
280 // resource has been lost or not. CreateUIResource returns an Id of the | 282 // resource has been lost or not. CreateUIResource returns an Id of the |
281 // resource, which is always positive. | 283 // resource, which is always positive. |
282 virtual UIResourceId CreateUIResource(UIResourceClient* client); | 284 virtual UIResourceId CreateUIResource(UIResourceClient* client); |
283 // Deletes a UI resource. May safely be called more than once. | 285 // Deletes a UI resource. May safely be called more than once. |
284 virtual void DeleteUIResource(UIResourceId id); | 286 virtual void DeleteUIResource(UIResourceId id); |
285 | 287 |
| 288 // Record the eviction count sent by the LayerTreeHostImpl at BeginFrame. |
| 289 // If |ui_resource_eviction_count| value is more recent than the current |
| 290 // value of |ui_resource_eviction_count_last_acked_|, then add the recreation |
| 291 // of all UI resources to the UIResourceRequestQueue. |
| 292 void SetUIResourceEvictionCountToAck(uint64 ui_resource_eviction_count); |
| 293 |
286 bool UsingSharedMemoryResources(); | 294 bool UsingSharedMemoryResources(); |
287 int id() const { return tree_id_; } | 295 int id() const { return tree_id_; } |
288 | 296 |
289 protected: | 297 protected: |
290 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); | 298 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); |
291 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 299 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
292 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); | 300 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); |
293 | 301 |
294 private: | 302 private: |
295 bool InitializeProxy(scoped_ptr<Proxy> proxy); | 303 bool InitializeProxy(scoped_ptr<Proxy> proxy); |
(...skipping 24 matching lines...) Expand all Loading... |
320 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); | 328 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); |
321 | 329 |
322 void RecreateUIResources(bool resource_lost); | 330 void RecreateUIResources(bool resource_lost); |
323 | 331 |
324 typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap; | 332 typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap; |
325 UIResourceClientMap ui_resource_client_map_; | 333 UIResourceClientMap ui_resource_client_map_; |
326 int next_ui_resource_id_; | 334 int next_ui_resource_id_; |
327 | 335 |
328 typedef std::list<UIResourceRequest> UIResourceRequestQueue; | 336 typedef std::list<UIResourceRequest> UIResourceRequestQueue; |
329 UIResourceRequestQueue ui_resource_request_queue_; | 337 UIResourceRequestQueue ui_resource_request_queue_; |
| 338 uint64 ui_resource_eviction_count_last_acked_; |
330 | 339 |
331 void CalculateLCDTextMetricsCallback(Layer* layer); | 340 void CalculateLCDTextMetricsCallback(Layer* layer); |
332 | 341 |
333 bool animating_; | 342 bool animating_; |
334 bool needs_full_tree_sync_; | 343 bool needs_full_tree_sync_; |
335 bool needs_filter_context_; | 344 bool needs_filter_context_; |
336 | 345 |
337 base::CancelableClosure prepaint_callback_; | 346 base::CancelableClosure prepaint_callback_; |
338 | 347 |
339 LayerTreeHostClient* client_; | 348 LayerTreeHostClient* client_; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 }; | 418 }; |
410 LCDTextMetrics lcd_text_metrics_; | 419 LCDTextMetrics lcd_text_metrics_; |
411 int tree_id_; | 420 int tree_id_; |
412 | 421 |
413 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 422 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
414 }; | 423 }; |
415 | 424 |
416 } // namespace cc | 425 } // namespace cc |
417 | 426 |
418 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 427 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
OLD | NEW |