| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_RESOURCES_TILE_MANAGER_H_ | 5 #ifndef CC_RESOURCES_TILE_MANAGER_H_ |
| 6 #define CC_RESOURCES_TILE_MANAGER_H_ | 6 #define CC_RESOURCES_TILE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 bytes_releasable_ += BytesConsumedIfAllocated(tiles[i]); | 98 bytes_releasable_ += BytesConsumedIfAllocated(tiles[i]); |
| 99 ++resources_releasable_; | 99 ++resources_releasable_; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 RasterWorkerPool* RasterWorkerPoolForTesting() { | 102 RasterWorkerPool* RasterWorkerPoolForTesting() { |
| 103 return raster_worker_pool_.get(); | 103 return raster_worker_pool_.get(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void SetGlobalStateForTesting( | 106 void SetGlobalStateForTesting( |
| 107 const GlobalStateThatImpactsTilePriority& state) { | 107 const GlobalStateThatImpactsTilePriority& state) { |
| 108 // Soft limit is used for resource pool such that |
| 109 // memory returns to normal after going over. |
| 108 if (state != global_state_) { | 110 if (state != global_state_) { |
| 109 global_state_ = state; | 111 global_state_ = state; |
| 110 prioritized_tiles_dirty_ = true; | 112 prioritized_tiles_dirty_ = true; |
| 111 resource_pool_->SetResourceUsageLimits( | 113 resource_pool_->SetResourceUsageLimits( |
| 112 global_state_.memory_limit_in_bytes, | 114 global_state_.soft_memory_limit_in_bytes, |
| 113 global_state_.unused_memory_limit_in_bytes, | 115 global_state_.unused_memory_limit_in_bytes, |
| 114 global_state_.num_resources_limit); | 116 global_state_.num_resources_limit); |
| 115 } | 117 } |
| 116 } | 118 } |
| 117 | 119 |
| 118 protected: | 120 protected: |
| 119 TileManager(TileManagerClient* client, | 121 TileManager(TileManagerClient* client, |
| 120 ResourceProvider* resource_provider, | 122 ResourceProvider* resource_provider, |
| 121 scoped_ptr<RasterWorkerPool> raster_worker_pool, | 123 scoped_ptr<RasterWorkerPool> raster_worker_pool, |
| 122 size_t max_raster_usage_bytes, | 124 size_t max_raster_usage_bytes, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 RasterTaskCompletionStats update_visible_tiles_stats_; | 213 RasterTaskCompletionStats update_visible_tiles_stats_; |
| 212 | 214 |
| 213 std::vector<Tile*> released_tiles_; | 215 std::vector<Tile*> released_tiles_; |
| 214 | 216 |
| 215 DISALLOW_COPY_AND_ASSIGN(TileManager); | 217 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 216 }; | 218 }; |
| 217 | 219 |
| 218 } // namespace cc | 220 } // namespace cc |
| 219 | 221 |
| 220 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 222 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |