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

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 typo 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 // CreateUIResource creates a resource given a bitmap. The bitmap is 280 // CreateUIResource creates a resource given a bitmap. The bitmap is
281 // generated via an interface function, which is called when initializing the 281 // 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 282 // 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 283 // 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 284 // resource has been lost or not. CreateUIResource returns an Id of the
285 // resource, which is always positive. 285 // resource, which is always positive.
286 virtual UIResourceId CreateUIResource(UIResourceClient* client); 286 virtual UIResourceId CreateUIResource(UIResourceClient* client);
287 // Deletes a UI resource. May safely be called more than once. 287 // Deletes a UI resource. May safely be called more than once.
288 virtual void DeleteUIResource(UIResourceId id); 288 virtual void DeleteUIResource(UIResourceId id);
289 // Put the recreation of all UI resources into the resource queue after they
290 // were evicted on the impl thread.
291 void RecreateUIResources();
289 292
290 bool UsingSharedMemoryResources(); 293 bool UsingSharedMemoryResources();
291 int id() const { return tree_id_; } 294 int id() const { return tree_id_; }
292 295
293 protected: 296 protected:
294 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); 297 LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings);
295 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); 298 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner);
296 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); 299 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing);
297 300
298 private: 301 private:
(...skipping 17 matching lines...) Expand all
316 void PrioritizeTextures( 319 void PrioritizeTextures(
317 const RenderSurfaceLayerList& render_surface_layer_list, 320 const RenderSurfaceLayerList& render_surface_layer_list,
318 OverdrawMetrics* metrics); 321 OverdrawMetrics* metrics);
319 void SetPrioritiesForSurfaces(size_t surface_memory_bytes); 322 void SetPrioritiesForSurfaces(size_t surface_memory_bytes);
320 void SetPrioritiesForLayers(const RenderSurfaceLayerList& update_list); 323 void SetPrioritiesForLayers(const RenderSurfaceLayerList& update_list);
321 size_t CalculateMemoryForRenderSurfaces( 324 size_t CalculateMemoryForRenderSurfaces(
322 const RenderSurfaceLayerList& update_list); 325 const RenderSurfaceLayerList& update_list);
323 326
324 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); 327 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time);
325 328
326 void RecreateUIResources(bool resource_lost);
327
328 typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap; 329 typedef base::hash_map<UIResourceId, UIResourceClient*> UIResourceClientMap;
329 UIResourceClientMap ui_resource_client_map_; 330 UIResourceClientMap ui_resource_client_map_;
330 int next_ui_resource_id_; 331 int next_ui_resource_id_;
331 332
332 typedef std::list<UIResourceRequest> UIResourceRequestQueue; 333 typedef std::list<UIResourceRequest> UIResourceRequestQueue;
333 UIResourceRequestQueue ui_resource_request_queue_; 334 UIResourceRequestQueue ui_resource_request_queue_;
334 335
335 void CalculateLCDTextMetricsCallback(Layer* layer); 336 void CalculateLCDTextMetricsCallback(Layer* layer);
336 337
337 bool animating_; 338 bool animating_;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 }; 418 };
418 LCDTextMetrics lcd_text_metrics_; 419 LCDTextMetrics lcd_text_metrics_;
419 int tree_id_; 420 int tree_id_;
420 421
421 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 422 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
422 }; 423 };
423 424
424 } // namespace cc 425 } // namespace cc
425 426
426 #endif // CC_TREES_LAYER_TREE_HOST_H_ 427 #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