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_TILES_TILE_MANAGER_H_ | 5 #ifndef CC_TILES_TILE_MANAGER_H_ |
6 #define CC_TILES_TILE_MANAGER_H_ | 6 #define CC_TILES_TILE_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // Adding additional values requires increasing kNumberOfTaskSets in | 100 // Adding additional values requires increasing kNumberOfTaskSets in |
101 // tile_task_runner.h | 101 // tile_task_runner.h |
102 }; | 102 }; |
103 | 103 |
104 static_assert(NamedTaskSet::ALL == (kNumberOfTaskSets - 1), | 104 static_assert(NamedTaskSet::ALL == (kNumberOfTaskSets - 1), |
105 "NamedTaskSet::ALL should be equal to kNumberOfTaskSets" | 105 "NamedTaskSet::ALL should be equal to kNumberOfTaskSets" |
106 "minus 1"); | 106 "minus 1"); |
107 | 107 |
108 static scoped_ptr<TileManager> Create(TileManagerClient* client, | 108 static scoped_ptr<TileManager> Create(TileManagerClient* client, |
109 base::SequencedTaskRunner* task_runner, | 109 base::SequencedTaskRunner* task_runner, |
110 size_t scheduled_raster_task_limit); | 110 size_t scheduled_raster_task_limit, |
| 111 bool use_partial_raster); |
111 ~TileManager() override; | 112 ~TileManager() override; |
112 | 113 |
113 // Assigns tile memory and schedules work to prepare tiles for drawing. | 114 // Assigns tile memory and schedules work to prepare tiles for drawing. |
114 // - Runs client_->NotifyReadyToActivate() when all tiles required for | 115 // - Runs client_->NotifyReadyToActivate() when all tiles required for |
115 // activation are prepared, or failed to prepare due to OOM. | 116 // activation are prepared, or failed to prepare due to OOM. |
116 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are | 117 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are |
117 // prepared, or failed to prepare due to OOM. | 118 // prepared, or failed to prepare due to OOM. |
118 bool PrepareTiles(const GlobalStateThatImpactsTilePriority& state); | 119 bool PrepareTiles(const GlobalStateThatImpactsTilePriority& state); |
119 | 120 |
120 // Synchronously finish any in progress work, cancel the rest, and clean up as | 121 // Synchronously finish any in progress work, cancel the rest, and clean up as |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; | 199 all_tiles_that_need_to_be_rasterized_are_scheduled_ = false; |
199 } | 200 } |
200 | 201 |
201 bool HasScheduledTileTasksForTesting() const { | 202 bool HasScheduledTileTasksForTesting() const { |
202 return has_scheduled_tile_tasks_; | 203 return has_scheduled_tile_tasks_; |
203 } | 204 } |
204 | 205 |
205 protected: | 206 protected: |
206 TileManager(TileManagerClient* client, | 207 TileManager(TileManagerClient* client, |
207 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 208 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
208 size_t scheduled_raster_task_limit); | 209 size_t scheduled_raster_task_limit, |
| 210 bool use_partial_raster); |
209 | 211 |
210 void FreeResourcesForReleasedTiles(); | 212 void FreeResourcesForReleasedTiles(); |
211 void CleanUpReleasedTiles(); | 213 void CleanUpReleasedTiles(); |
212 | 214 |
213 friend class Tile; | 215 friend class Tile; |
214 // Virtual for testing. | 216 // Virtual for testing. |
215 virtual void Release(Tile* tile); | 217 virtual void Release(Tile* tile); |
216 Tile::Id GetUniqueTileId() { return ++next_tile_id_; } | 218 Tile::Id GetUniqueTileId() { return ++next_tile_id_; } |
217 | 219 |
218 // Overriden from TileTaskRunnerClient: | 220 // Overriden from TileTaskRunnerClient: |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 284 |
283 ResourceFormat DetermineResourceFormat(const Tile* tile) const; | 285 ResourceFormat DetermineResourceFormat(const Tile* tile) const; |
284 bool DetermineResourceRequiresSwizzle(const Tile* tile) const; | 286 bool DetermineResourceRequiresSwizzle(const Tile* tile) const; |
285 | 287 |
286 TileManagerClient* client_; | 288 TileManagerClient* client_; |
287 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 289 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
288 ResourcePool* resource_pool_; | 290 ResourcePool* resource_pool_; |
289 TileTaskRunner* tile_task_runner_; | 291 TileTaskRunner* tile_task_runner_; |
290 GlobalStateThatImpactsTilePriority global_state_; | 292 GlobalStateThatImpactsTilePriority global_state_; |
291 size_t scheduled_raster_task_limit_; | 293 size_t scheduled_raster_task_limit_; |
| 294 const bool use_partial_raster_; |
292 | 295 |
293 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 296 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
294 TileMap tiles_; | 297 TileMap tiles_; |
295 | 298 |
296 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; | 299 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; |
297 MemoryHistory::Entry memory_stats_from_last_assign_; | 300 MemoryHistory::Entry memory_stats_from_last_assign_; |
298 | 301 |
299 bool did_check_for_completed_tasks_since_last_schedule_tasks_; | 302 bool did_check_for_completed_tasks_since_last_schedule_tasks_; |
300 bool did_oom_on_last_assign_; | 303 bool did_oom_on_last_assign_; |
301 | 304 |
(...skipping 29 matching lines...) Expand all Loading... |
331 | 334 |
332 uint64_t prepare_tiles_count_; | 335 uint64_t prepare_tiles_count_; |
333 uint64_t next_tile_id_; | 336 uint64_t next_tile_id_; |
334 | 337 |
335 DISALLOW_COPY_AND_ASSIGN(TileManager); | 338 DISALLOW_COPY_AND_ASSIGN(TileManager); |
336 }; | 339 }; |
337 | 340 |
338 } // namespace cc | 341 } // namespace cc |
339 | 342 |
340 #endif // CC_TILES_TILE_MANAGER_H_ | 343 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |