| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 enum UIResourceRequestType { | 88 enum UIResourceRequestType { |
| 89 UIResourceCreate, | 89 UIResourceCreate, |
| 90 UIResourceDelete, | 90 UIResourceDelete, |
| 91 UIResourceInvalidRequest | 91 UIResourceInvalidRequest |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 UIResourceRequest(); | 94 UIResourceRequest(); |
| 95 ~UIResourceRequest(); | 95 ~UIResourceRequest(); |
| 96 UIResourceRequestType type; | 96 UIResourceRequestType type; |
| 97 UIResourceId id; | 97 UIResourceId id; |
| 98 scoped_refptr<UIResourceBitmap> bitmap; | 98 UIResourceBitmap bitmap; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { | 101 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { |
| 102 public: | 102 public: |
| 103 static scoped_ptr<LayerTreeHost> Create( | 103 static scoped_ptr<LayerTreeHost> Create( |
| 104 LayerTreeHostClient* client, | 104 LayerTreeHostClient* client, |
| 105 const LayerTreeSettings& settings, | 105 const LayerTreeSettings& settings, |
| 106 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 106 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 107 virtual ~LayerTreeHost(); | 107 virtual ~LayerTreeHost(); |
| 108 | 108 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // CreateUIResource creates a resource given a bitmap. The bitmap is | 276 // CreateUIResource creates a resource given a bitmap. The bitmap is |
| 277 // generated via an interface function, which is called when initializing the | 277 // 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 | 278 // 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 | 279 // 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 | 280 // resource has been lost or not. CreateUIResource returns an Id of the |
| 281 // resource, which is always positive. | 281 // resource, which is always positive. |
| 282 virtual UIResourceId CreateUIResource(UIResourceClient* client); | 282 virtual UIResourceId CreateUIResource(UIResourceClient* client); |
| 283 // Deletes a UI resource. May safely be called more than once. | 283 // Deletes a UI resource. May safely be called more than once. |
| 284 virtual void DeleteUIResource(UIResourceId id); | 284 virtual void DeleteUIResource(UIResourceId id); |
| 285 | 285 |
| 286 virtual gfx::Size GetUIResourceSize(UIResourceId id) const; |
| 287 |
| 286 bool UsingSharedMemoryResources(); | 288 bool UsingSharedMemoryResources(); |
| 287 int id() const { return tree_id_; } | 289 int id() const { return tree_id_; } |
| 288 | 290 |
| 289 protected: | 291 protected: |
| 290 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); | 292 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); |
| 291 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 293 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 292 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); | 294 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); |
| 293 | 295 |
| 294 private: | 296 private: |
| 295 bool InitializeProxy(scoped_ptr<Proxy> proxy); | 297 bool InitializeProxy(scoped_ptr<Proxy> proxy); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 316 void SetPrioritiesForLayers(const RenderSurfaceLayerList& update_list); | 318 void SetPrioritiesForLayers(const RenderSurfaceLayerList& update_list); |
| 317 size_t CalculateMemoryForRenderSurfaces( | 319 size_t CalculateMemoryForRenderSurfaces( |
| 318 const RenderSurfaceLayerList& update_list); | 320 const RenderSurfaceLayerList& update_list); |
| 319 | 321 |
| 320 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); | 322 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); |
| 321 | 323 |
| 322 void UIResourceLost(UIResourceId id); | 324 void UIResourceLost(UIResourceId id); |
| 323 | 325 |
| 324 void DidLoseUIResources(); | 326 void DidLoseUIResources(); |
| 325 | 327 |
| 326 typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap; | 328 struct UIResourceClientData { |
| 329 UIResourceClient* client; |
| 330 gfx::Size size; |
| 331 }; |
| 332 |
| 333 typedef base::hash_map<UIResourceId, UIResourceClientData> |
| 334 UIResourceClientMap; |
| 327 UIResourceClientMap ui_resource_client_map_; | 335 UIResourceClientMap ui_resource_client_map_; |
| 328 int next_ui_resource_id_; | 336 int next_ui_resource_id_; |
| 329 | 337 |
| 330 typedef std::list<UIResourceRequest> UIResourceRequestQueue; | 338 typedef std::list<UIResourceRequest> UIResourceRequestQueue; |
| 331 UIResourceRequestQueue ui_resource_request_queue_; | 339 UIResourceRequestQueue ui_resource_request_queue_; |
| 332 | 340 |
| 333 void CalculateLCDTextMetricsCallback(Layer* layer); | 341 void CalculateLCDTextMetricsCallback(Layer* layer); |
| 334 | 342 |
| 335 bool animating_; | 343 bool animating_; |
| 336 bool needs_full_tree_sync_; | 344 bool needs_full_tree_sync_; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 }; | 419 }; |
| 412 LCDTextMetrics lcd_text_metrics_; | 420 LCDTextMetrics lcd_text_metrics_; |
| 413 int tree_id_; | 421 int tree_id_; |
| 414 | 422 |
| 415 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 423 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| 416 }; | 424 }; |
| 417 | 425 |
| 418 } // namespace cc | 426 } // namespace cc |
| 419 | 427 |
| 420 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 428 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
| OLD | NEW |