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

Side by Side Diff: cc/trees/layer_tree_host_impl.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 typos 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
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_IMPL_H_ 5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_
6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_
7 7
8 #include <list> 8 #include <list>
9 #include <set>
9 #include <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/basictypes.h" 13 #include "base/basictypes.h"
13 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/time/time.h" 16 #include "base/time/time.h"
16 #include "cc/animation/animation_events.h" 17 #include "cc/animation/animation_events.h"
17 #include "cc/animation/animation_registrar.h" 18 #include "cc/animation/animation_registrar.h"
18 #include "cc/base/cc_export.h" 19 #include "cc/base/cc_export.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 scoped_ptr<base::Value> AsValue() const { return AsValueWithFrame(NULL); } 403 scoped_ptr<base::Value> AsValue() const { return AsValueWithFrame(NULL); }
403 scoped_ptr<base::Value> AsValueWithFrame(FrameData* frame) const; 404 scoped_ptr<base::Value> AsValueWithFrame(FrameData* frame) const;
404 scoped_ptr<base::Value> ActivationStateAsValue() const; 405 scoped_ptr<base::Value> ActivationStateAsValue() const;
405 406
406 bool page_scale_animation_active() const { return !!page_scale_animation_; } 407 bool page_scale_animation_active() const { return !!page_scale_animation_; }
407 408
408 void CreateUIResource(UIResourceId uid, 409 void CreateUIResource(UIResourceId uid,
409 scoped_refptr<UIResourceBitmap> bitmap); 410 scoped_refptr<UIResourceBitmap> bitmap);
410 // Deletes a UI resource. May safely be called more than once. 411 // Deletes a UI resource. May safely be called more than once.
411 void DeleteUIResource(UIResourceId uid); 412 void DeleteUIResource(UIResourceId uid);
412 void DeleteAllUIResources(); 413 void EvictAllUIResources();
414 bool EvictedUIResourcesExist() const;
413 415
414 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const; 416 ResourceProvider::ResourceId ResourceIdForUIResource(UIResourceId uid) const;
415 417
416 protected: 418 protected:
417 LayerTreeHostImpl( 419 LayerTreeHostImpl(
418 const LayerTreeSettings& settings, 420 const LayerTreeSettings& settings,
419 LayerTreeHostImplClient* client, 421 LayerTreeHostImplClient* client,
420 Proxy* proxy, 422 Proxy* proxy,
421 RenderingStatsInstrumentation* rendering_stats_instrumentation); 423 RenderingStatsInstrumentation* rendering_stats_instrumentation);
422 424
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 480
479 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const; 481 void UpdateCurrentFrameTime(base::TimeTicks* ticks, base::Time* now) const;
480 482
481 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time); 483 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time);
482 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy, 484 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy,
483 bool zero_budget); 485 bool zero_budget);
484 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy); 486 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy);
485 487
486 void DidInitializeVisibleTile(); 488 void DidInitializeVisibleTile();
487 489
490 void MarkUIResourceNotEvicted(UIResourceId uid);
491
488 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId> 492 typedef base::hash_map<UIResourceId, ResourceProvider::ResourceId>
489 UIResourceMap; 493 UIResourceMap;
490 UIResourceMap ui_resource_map_; 494 UIResourceMap ui_resource_map_;
491 495
496 // Resources that were evicted by EvictAllUIResources. Resources are removed
497 // from this when they are touched by a create or destroy from the UI resource
498 // request queue.
499 std::set<UIResourceId> evicted_ui_resources_;
500
492 scoped_ptr<OutputSurface> output_surface_; 501 scoped_ptr<OutputSurface> output_surface_;
493 scoped_refptr<ContextProvider> offscreen_context_provider_; 502 scoped_refptr<ContextProvider> offscreen_context_provider_;
494 503
495 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile- 504 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile-
496 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice(). 505 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice().
497 scoped_ptr<ResourceProvider> resource_provider_; 506 scoped_ptr<ResourceProvider> resource_provider_;
498 scoped_ptr<TileManager> tile_manager_; 507 scoped_ptr<TileManager> tile_manager_;
499 scoped_ptr<Renderer> renderer_; 508 scoped_ptr<Renderer> renderer_;
500 509
501 // Tree currently being drawn. 510 // Tree currently being drawn.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 610
602 // Optional callback to notify of new tree activations. 611 // Optional callback to notify of new tree activations.
603 base::Closure tree_activation_callback_; 612 base::Closure tree_activation_callback_;
604 613
605 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); 614 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
606 }; 615 };
607 616
608 } // namespace cc 617 } // namespace cc
609 618
610 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ 619 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698