Chromium Code Reviews| Index: cc/resources/tile_manager.h |
| diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h |
| index 30f4730423e9ce616c61a614c287b38897752bf9..3d1f9564028af71a53f3695d168f62dfa0e364cc 100644 |
| --- a/cc/resources/tile_manager.h |
| +++ b/cc/resources/tile_manager.h |
| @@ -21,7 +21,6 @@ |
| #include "cc/resources/managed_tile_state.h" |
| #include "cc/resources/memory_history.h" |
| #include "cc/resources/picture_pile_impl.h" |
| -#include "cc/resources/prioritized_tile_set.h" |
| #include "cc/resources/rasterizer.h" |
| #include "cc/resources/resource_pool.h" |
| #include "cc/resources/tile.h" |
| @@ -222,12 +221,7 @@ class CC_EXPORT TileManager : public RasterizerClient, |
| void SetGlobalStateForTesting( |
| const GlobalStateThatImpactsTilePriority& state) { |
| - // Soft limit is used for resource pool such that |
| - // memory returns to soft limit after going over. |
| - if (state != global_state_) { |
| - global_state_ = state; |
| - prioritized_tiles_dirty_ = true; |
| - } |
| + global_state_ = state; |
| } |
| void SetRasterizerForTesting(Rasterizer* rasterizer); |
| @@ -241,13 +235,10 @@ class CC_EXPORT TileManager : public RasterizerClient, |
| Rasterizer* rasterizer, |
| RenderingStatsInstrumentation* rendering_stats_instrumentation); |
| - // Methods called by Tile |
| - friend class Tile; |
| - void DidChangeTilePriority(Tile* tile); |
| - |
| void CleanUpReleasedTiles(); |
| // Overriden from RefCountedManager<Tile>: |
| + friend class Tile; |
| virtual void Release(Tile* tile) OVERRIDE; |
| // Overriden from RasterizerClient: |
| @@ -262,11 +253,29 @@ class CC_EXPORT TileManager : public RasterizerClient, |
| virtual void ScheduleTasks( |
| const TileVector& tiles_that_need_to_be_rasterized); |
| - void AssignGpuMemoryToTiles(PrioritizedTileSet* tiles, |
| - TileVector* tiles_that_need_to_be_rasterized); |
| - void GetTilesWithAssignedBins(PrioritizedTileSet* tiles); |
| + void AssignGpuMemoryToTiles(TileVector* tiles_that_need_to_be_rasterized); |
| private: |
| + class MemoryUsage { |
| + public: |
| + MemoryUsage(); |
| + MemoryUsage(int64 memory_bytes, int resource_count); |
| + |
| + MemoryUsage& operator+=(const MemoryUsage& other); |
|
vmpstr
2014/06/17 08:11:57
I decided to go with operators, since it is kind o
|
| + MemoryUsage& operator-=(const MemoryUsage& other); |
| + MemoryUsage operator-(const MemoryUsage& other); |
| + |
| + bool Exceeds(const MemoryUsage& limit) const; |
| + |
| + int64 memory_bytes() const { return memory_bytes_; } |
| + |
| + private: |
| + int64 memory_bytes_; |
| + int resource_count_; |
| + }; |
| + |
| + MemoryUsage TileMemoryUsage(Tile* tile); |
|
reveman
2014/06/17 17:15:08
I don't think this needs to be a member of the Til
vmpstr
2014/06/17 18:23:22
Done.
|
| + |
| void OnImageDecodeTaskCompleted(int layer_id, |
| SkPixelRef* pixel_ref, |
| bool was_canceled); |
| @@ -289,8 +298,14 @@ class CC_EXPORT TileManager : public RasterizerClient, |
| SkPixelRef* pixel_ref); |
| scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); |
| scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; |
| - void UpdatePrioritizedTileSetIfNeeded(); |
| + bool FreeTileResourcesUntilUsageIsWithinLimit( |
| + EvictionTileIterator* eviction_iterator, |
| + const MemoryUsage& limit, |
| + const TilePriority& max_priority, |
| + bool evict_unconditionally, |
| + MemoryUsage* usage); |
| + bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); |
| bool IsReadyToActivate() const; |
| void CheckIfReadyToActivate(); |
| @@ -303,17 +318,12 @@ class CC_EXPORT TileManager : public RasterizerClient, |
| typedef base::hash_map<Tile::Id, Tile*> TileMap; |
| TileMap tiles_; |
| - PrioritizedTileSet prioritized_tiles_; |
| - bool prioritized_tiles_dirty_; |
| - |
| bool all_tiles_that_need_to_be_rasterized_have_memory_; |
| bool all_tiles_required_for_activation_have_memory_; |
| - size_t memory_required_bytes_; |
| - size_t memory_nice_to_have_bytes_; |
| - |
| size_t bytes_releasable_; |
| size_t resources_releasable_; |
| + size_t bytes_required_but_not_allocated_; |
| bool ever_exceeded_memory_budget_; |
| MemoryHistory::Entry memory_stats_from_last_assign_; |