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..e405d6c464439f66bcc2fdd1dfe37fd2645ac482 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,21 @@ 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: |
| + struct MemoryBudget { |
|
reveman
2014/06/16 22:06:52
I'm not a fan of this struct. Having a budget inst
vmpstr
2014/06/16 23:26:07
Mostly done. I can't easily have FromTile on the M
|
| + int64 soft_memory_bytes; |
| + int64 hard_memory_bytes; |
| + int resource_count; |
| + |
| + bool Exceeds(const MemoryBudget& other) const { |
| + return soft_memory_bytes > other.soft_memory_bytes || |
| + hard_memory_bytes > other.hard_memory_bytes || |
| + resource_count > other.resource_count; |
| + } |
| + }; |
| + |
| void OnImageDecodeTaskCompleted(int layer_id, |
| SkPixelRef* pixel_ref, |
| bool was_canceled); |
| @@ -289,8 +290,14 @@ class CC_EXPORT TileManager : public RasterizerClient, |
| SkPixelRef* pixel_ref); |
| scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); |
| scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; |
| - void UpdatePrioritizedTileSetIfNeeded(); |
| + void FreeTileResourcesUntilUsageIsWithinBudget( |
| + EvictionTileIterator* eviction_iterator, |
| + const MemoryBudget& required_budget, |
| + MemoryBudget* current_budget, |
| + const TilePriority& max_priority, |
| + bool evict_unconditionally); |
|
reveman
2014/06/16 22:06:52
I would prefer this as:
FreeTileResourcesUntilUsa
vmpstr
2014/06/16 23:26:07
Done.
|
| + bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); |
| bool IsReadyToActivate() const; |
| void CheckIfReadyToActivate(); |
| @@ -303,17 +310,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_; |