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 <deque> | 8 #include <deque> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 std::vector<Tile*> AllTilesForTesting() const { | 156 std::vector<Tile*> AllTilesForTesting() const { |
157 std::vector<Tile*> tiles; | 157 std::vector<Tile*> tiles; |
158 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); | 158 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); |
159 ++it) { | 159 ++it) { |
160 tiles.push_back(it->second); | 160 tiles.push_back(it->second); |
161 } | 161 } |
162 return tiles; | 162 return tiles; |
163 } | 163 } |
164 | 164 |
| 165 void SetScheduledRasterTaskLimitForTesting(size_t limit) { |
| 166 scheduled_raster_task_limit_ = limit; |
| 167 } |
| 168 |
165 protected: | 169 protected: |
166 TileManager(TileManagerClient* client, | 170 TileManager(TileManagerClient* client, |
167 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 171 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
168 ResourcePool* resource_pool, | 172 ResourcePool* resource_pool, |
169 Rasterizer* rasterizer, | 173 Rasterizer* rasterizer, |
170 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 174 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
171 size_t scheduled_raster_task_limit); | 175 size_t scheduled_raster_task_limit); |
172 | 176 |
173 void FreeResourcesForReleasedTiles(); | 177 void FreeResourcesForReleasedTiles(); |
174 void CleanUpReleasedTiles(); | 178 void CleanUpReleasedTiles(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 bool IsReadyToActivate() const; | 240 bool IsReadyToActivate() const; |
237 bool IsReadyToDraw() const; | 241 bool IsReadyToDraw() const; |
238 void CheckIfReadyToActivate(); | 242 void CheckIfReadyToActivate(); |
239 void CheckIfReadyToDraw(); | 243 void CheckIfReadyToDraw(); |
240 | 244 |
241 TileManagerClient* client_; | 245 TileManagerClient* client_; |
242 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 246 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
243 ResourcePool* resource_pool_; | 247 ResourcePool* resource_pool_; |
244 Rasterizer* rasterizer_; | 248 Rasterizer* rasterizer_; |
245 GlobalStateThatImpactsTilePriority global_state_; | 249 GlobalStateThatImpactsTilePriority global_state_; |
246 const size_t scheduled_raster_task_limit_; | 250 size_t scheduled_raster_task_limit_; |
247 | 251 |
248 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 252 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
249 TileMap tiles_; | 253 TileMap tiles_; |
250 | 254 |
251 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; | 255 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; |
252 MemoryHistory::Entry memory_stats_from_last_assign_; | 256 MemoryHistory::Entry memory_stats_from_last_assign_; |
253 | 257 |
254 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 258 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
255 | 259 |
256 bool did_check_for_completed_tasks_since_last_schedule_tasks_; | 260 bool did_check_for_completed_tasks_since_last_schedule_tasks_; |
(...skipping 18 matching lines...) Expand all Loading... |
275 | 279 |
276 std::vector<scoped_refptr<RasterTask>> orphan_raster_tasks_; | 280 std::vector<scoped_refptr<RasterTask>> orphan_raster_tasks_; |
277 | 281 |
278 UniqueNotifier ready_to_activate_check_notifier_; | 282 UniqueNotifier ready_to_activate_check_notifier_; |
279 UniqueNotifier ready_to_draw_check_notifier_; | 283 UniqueNotifier ready_to_draw_check_notifier_; |
280 | 284 |
281 RasterTilePriorityQueue raster_priority_queue_; | 285 RasterTilePriorityQueue raster_priority_queue_; |
282 EvictionTilePriorityQueue eviction_priority_queue_; | 286 EvictionTilePriorityQueue eviction_priority_queue_; |
283 bool eviction_priority_queue_is_up_to_date_; | 287 bool eviction_priority_queue_is_up_to_date_; |
284 | 288 |
| 289 bool did_notify_ready_to_activate_; |
| 290 bool did_notify_ready_to_draw_; |
| 291 |
285 DISALLOW_COPY_AND_ASSIGN(TileManager); | 292 DISALLOW_COPY_AND_ASSIGN(TileManager); |
286 }; | 293 }; |
287 | 294 |
288 } // namespace cc | 295 } // namespace cc |
289 | 296 |
290 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 297 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |