Index: cc/resources/tile_manager.h |
diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h |
index ea22fd8dae27718ebaef0cc4c064eead45adf751..9dc74449d159819d94103011e8ba15cb9df22c84 100644 |
--- a/cc/resources/tile_manager.h |
+++ b/cc/resources/tile_manager.h |
@@ -20,7 +20,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/rasterizer_delegate.h" |
#include "cc/resources/resource_pool.h" |
@@ -72,6 +71,8 @@ class CC_EXPORT TileManager : public RasterizerClient, |
operator bool() const; |
Tile* operator*(); |
+ bool HasTilesRequiredForActivation() const; |
+ |
private: |
struct PairedPictureLayerIterator { |
PairedPictureLayerIterator(); |
@@ -115,7 +116,7 @@ class CC_EXPORT TileManager : public RasterizerClient, |
~EvictionTileIterator(); |
EvictionTileIterator& operator++(); |
- operator bool() const; |
+ operator bool(); |
Tile* operator*(); |
private: |
@@ -146,6 +147,10 @@ class CC_EXPORT TileManager : public RasterizerClient, |
TreePriority tree_priority_; |
}; |
+ void Initialize(); |
+ |
+ bool initialized_; |
+ TileManager* tile_manager_; |
std::vector<PairedPictureLayerIterator> paired_iterators_; |
std::vector<PairedPictureLayerIterator*> iterator_heap_; |
TreePriority tree_priority_; |
@@ -219,10 +224,7 @@ class CC_EXPORT TileManager : public RasterizerClient, |
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 SetRasterizersForTesting(Rasterizer* rasterizer, |
@@ -238,13 +240,10 @@ class CC_EXPORT TileManager : public RasterizerClient, |
bool use_rasterize_on_demand, |
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: |
@@ -259,9 +258,7 @@ 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: |
enum RasterizerType { |
@@ -270,6 +267,18 @@ class CC_EXPORT TileManager : public RasterizerClient, |
NUM_RASTERIZER_TYPES |
}; |
+ struct MemoryBudget { |
+ 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); |
@@ -291,7 +300,11 @@ class CC_EXPORT TileManager : public RasterizerClient, |
SkPixelRef* pixel_ref); |
scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); |
scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; |
- void UpdatePrioritizedTileSetIfNeeded(); |
+ bool EvictTiles(EvictionTileIterator* eviction_iterator, |
+ const MemoryBudget& required_budget, |
+ MemoryBudget* current_budget, |
+ const TilePriority& raster_priority, |
+ bool evict_unconditionally); |
void CleanUpLayers(); |
TileManagerClient* client_; |
@@ -302,15 +315,9 @@ 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_; |