Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: cc/trees/layer_tree_host.h

Issue 23548022: [cc] Evict UIResources when the renderer is not visible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix RenderTreePriority bug Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 bool avoid_pow2_textures; 83 bool avoid_pow2_textures;
84 bool using_map_image; 84 bool using_map_image;
85 bool using_shared_memory_resources; 85 bool using_shared_memory_resources;
86 bool using_discard_framebuffer; 86 bool using_discard_framebuffer;
87 }; 87 };
88 88
89 struct CC_EXPORT UIResourceRequest { 89 struct CC_EXPORT UIResourceRequest {
90 enum UIResourceRequestType { 90 enum UIResourceRequestType {
91 UIResourceCreate, 91 UIResourceCreate,
92 UIResourceDelete, 92 UIResourceDelete,
93 UIResourceEvictionRecreated,
aelias_OOO_until_Jul13 2013/09/09 22:52:37 Why is it necessary to track this in a different c
ccameron 2013/09/09 23:22:04 I strongly prefer that this be done explicitly --
93 UIResourceInvalidRequest 94 UIResourceInvalidRequest
94 }; 95 };
95 96
96 UIResourceRequest(); 97 UIResourceRequest();
97 ~UIResourceRequest(); 98 ~UIResourceRequest();
98 UIResourceRequestType type; 99 UIResourceRequestType type;
99 UIResourceId id; 100 UIResourceId id;
100 scoped_refptr<UIResourceBitmap> bitmap; 101 scoped_refptr<UIResourceBitmap> bitmap;
102 uint64 eviction_count_recreated;
101 }; 103 };
102 104
103 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) { 105 class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
104 public: 106 public:
105 static scoped_ptr<LayerTreeHost> Create( 107 static scoped_ptr<LayerTreeHost> Create(
106 LayerTreeHostClient* client, 108 LayerTreeHostClient* client,
107 const LayerTreeSettings& settings, 109 const LayerTreeSettings& settings,
108 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 110 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
109 virtual ~LayerTreeHost(); 111 virtual ~LayerTreeHost();
110 112
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // CreateUIResource creates a resource given a bitmap. The bitmap is 282 // CreateUIResource creates a resource given a bitmap. The bitmap is
281 // generated via an interface function, which is called when initializing the 283 // generated via an interface function, which is called when initializing the
282 // resource and when the resource has been lost (due to lost context). The 284 // resource and when the resource has been lost (due to lost context). The
283 // parameter of the interface is a single boolean, which indicates whether the 285 // parameter of the interface is a single boolean, which indicates whether the
284 // resource has been lost or not. CreateUIResource returns an Id of the 286 // resource has been lost or not. CreateUIResource returns an Id of the
285 // resource, which is always positive. 287 // resource, which is always positive.
286 virtual UIResourceId CreateUIResource(UIResourceClient* client); 288 virtual UIResourceId CreateUIResource(UIResourceClient* client);
287 // Deletes a UI resource. May safely be called more than once. 289 // Deletes a UI resource. May safely be called more than once.
288 virtual void DeleteUIResource(UIResourceId id); 290 virtual void DeleteUIResource(UIResourceId id);
289 291
292 // Record the eviction count sent by the LayerTreeHostImpl at BeginFrame.
293 // If the value of |ui_resource_eviction_count| is greater than the value of
294 // |ui_resource_eviction_count_recreated_| then add the recreation
295 // of all UI resources to the UIResourceRequestQueue and return true.
296 // Otherwise return false.
297 bool SetUIResourceEvictionCount(uint64 ui_resource_eviction_count);
298
290 bool UsingSharedMemoryResources(); 299 bool UsingSharedMemoryResources();
291 int id() const { return tree_id_; } 300 int id() const { return tree_id_; }
292 301
293 protected: 302 protected:
294 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); 303 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings);
295 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 304 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
296 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); 305 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing);
297 306
298 private: 307 private:
299 bool InitializeProxy(scoped_ptr<Proxy> proxy); 308 bool InitializeProxy(scoped_ptr<Proxy> proxy);
(...skipping 16 matching lines...) Expand all
316 void PrioritizeTextures( 325 void PrioritizeTextures(
317 const RenderSurfaceLayerList& render_surface_layer_list, 326 const RenderSurfaceLayerList& render_surface_layer_list,
318 OverdrawMetrics* metrics); 327 OverdrawMetrics* metrics);
319 void SetPrioritiesForSurfaces(size_t surface_memory_bytes); 328 void SetPrioritiesForSurfaces(size_t surface_memory_bytes);
320 void SetPrioritiesForLayers(const RenderSurfaceLayerList& update_list); 329 void SetPrioritiesForLayers(const RenderSurfaceLayerList& update_list);
321 size_t CalculateMemoryForRenderSurfaces( 330 size_t CalculateMemoryForRenderSurfaces(
322 const RenderSurfaceLayerList& update_list); 331 const RenderSurfaceLayerList& update_list);
323 332
324 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); 333 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time);
325 334
326 void RecreateUIResources(bool resource_lost);
327
328 typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap; 335 typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap;
329 UIResourceClientMap ui_resource_client_map_; 336 UIResourceClientMap ui_resource_client_map_;
330 int next_ui_resource_id_; 337 int next_ui_resource_id_;
331 338
332 typedef std::list<UIResourceRequest> UIResourceRequestQueue; 339 typedef std::list<UIResourceRequest> UIResourceRequestQueue;
333 UIResourceRequestQueue ui_resource_request_queue_; 340 UIResourceRequestQueue ui_resource_request_queue_;
341 uint64 ui_resource_eviction_count_recreated_;
aelias_OOO_until_Jul13 2013/09/09 22:52:37 It doesn't make sense to me to use a count here.
ccameron 2013/09/09 23:22:04 This isn't the number of resource that have been e
aelias_OOO_until_Jul13 2013/09/09 23:44:30 I agree with your reasoning that a bool is insuffi
334 342
335 void CalculateLCDTextMetricsCallback(Layer* layer); 343 void CalculateLCDTextMetricsCallback(Layer* layer);
336 344
337 bool animating_; 345 bool animating_;
338 bool needs_full_tree_sync_; 346 bool needs_full_tree_sync_;
339 bool needs_filter_context_; 347 bool needs_filter_context_;
340 348
341 base::CancelableClosure prepaint_callback_; 349 base::CancelableClosure prepaint_callback_;
342 350
343 LayerTreeHostClient* client_; 351 LayerTreeHostClient* client_;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 }; 425 };
418 LCDTextMetrics lcd_text_metrics_; 426 LCDTextMetrics lcd_text_metrics_;
419 int tree_id_; 427 int tree_id_;
420 428
421 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 429 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
422 }; 430 };
423 431
424 } // namespace cc 432 } // namespace cc
425 433
426 #endif // CC_TREES_LAYER_TREE_HOST_H_ 434 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698