| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 bytes_releasable_ += BytesConsumedIfAllocated(tiles[i]); | 99 bytes_releasable_ += BytesConsumedIfAllocated(tiles[i]); |
| 100 ++resources_releasable_; | 100 ++resources_releasable_; |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 RasterWorkerPool* RasterWorkerPoolForTesting() { | 103 RasterWorkerPool* RasterWorkerPoolForTesting() { |
| 104 return raster_worker_pool_.get(); | 104 return raster_worker_pool_.get(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void SetGlobalStateForTesting( | 107 void SetGlobalStateForTesting( |
| 108 const GlobalStateThatImpactsTilePriority& state) { | 108 const GlobalStateThatImpactsTilePriority& state) { |
| 109 // Soft limit is used for resource pool such that |
| 110 // memory returns to soft limit after going over. |
| 109 if (state != global_state_) { | 111 if (state != global_state_) { |
| 110 global_state_ = state; | 112 global_state_ = state; |
| 111 prioritized_tiles_dirty_ = true; | 113 prioritized_tiles_dirty_ = true; |
| 112 resource_pool_->SetResourceUsageLimits( | 114 resource_pool_->SetResourceUsageLimits( |
| 113 global_state_.memory_limit_in_bytes, | 115 global_state_.soft_memory_limit_in_bytes, |
| 114 global_state_.unused_memory_limit_in_bytes, | 116 global_state_.unused_memory_limit_in_bytes, |
| 115 global_state_.num_resources_limit); | 117 global_state_.num_resources_limit); |
| 116 } | 118 } |
| 117 } | 119 } |
| 118 | 120 |
| 119 protected: | 121 protected: |
| 120 TileManager(TileManagerClient* client, | 122 TileManager(TileManagerClient* client, |
| 121 ResourceProvider* resource_provider, | 123 ResourceProvider* resource_provider, |
| 122 scoped_ptr<RasterWorkerPool> raster_worker_pool, | 124 scoped_ptr<RasterWorkerPool> raster_worker_pool, |
| 123 size_t max_raster_usage_bytes, | 125 size_t max_raster_usage_bytes, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 220 |
| 219 // Queue used when scheduling raster tasks. | 221 // Queue used when scheduling raster tasks. |
| 220 RasterWorkerPool::RasterTask::Queue raster_tasks_; | 222 RasterWorkerPool::RasterTask::Queue raster_tasks_; |
| 221 | 223 |
| 222 DISALLOW_COPY_AND_ASSIGN(TileManager); | 224 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 223 }; | 225 }; |
| 224 | 226 |
| 225 } // namespace cc | 227 } // namespace cc |
| 226 | 228 |
| 227 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 229 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |