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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 89 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
90 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); | 90 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); |
91 | 91 |
92 // This class manages tiles, deciding which should get rasterized and which | 92 // This class manages tiles, deciding which should get rasterized and which |
93 // should no longer have any memory assigned to them. Tile objects are "owned" | 93 // should no longer have any memory assigned to them. Tile objects are "owned" |
94 // by layers; they automatically register with the manager when they are | 94 // by layers; they automatically register with the manager when they are |
95 // created, and unregister from the manager when they are deleted. | 95 // created, and unregister from the manager when they are deleted. |
96 class CC_EXPORT TileManager { | 96 class CC_EXPORT TileManager { |
97 public: | 97 public: |
98 TileManager(TileManagerClient* client, | 98 TileManager(TileManagerClient* client, |
99 scoped_refptr<base::SequencedTaskRunner> task_runner, | 99 base::SequencedTaskRunner* task_runner, |
100 size_t scheduled_raster_task_limit, | 100 size_t scheduled_raster_task_limit, |
101 bool use_partial_raster); | 101 bool use_partial_raster); |
102 virtual ~TileManager(); | 102 virtual ~TileManager(); |
103 | 103 |
104 // Assigns tile memory and schedules work to prepare tiles for drawing. | 104 // Assigns tile memory and schedules work to prepare tiles for drawing. |
105 // - Runs client_->NotifyReadyToActivate() when all tiles required for | 105 // - Runs client_->NotifyReadyToActivate() when all tiles required for |
106 // activation are prepared, or failed to prepare due to OOM. | 106 // activation are prepared, or failed to prepare due to OOM. |
107 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are | 107 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are |
108 // prepared, or failed to prepare due to OOM. | 108 // prepared, or failed to prepare due to OOM. |
109 bool PrepareTiles(const GlobalStateThatImpactsTilePriority& state); | 109 bool PrepareTiles(const GlobalStateThatImpactsTilePriority& state); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 void DidFinishRunningAllTileTasks(); | 264 void DidFinishRunningAllTileTasks(); |
265 | 265 |
266 scoped_refptr<TileTask> CreateTaskSetFinishedTask( | 266 scoped_refptr<TileTask> CreateTaskSetFinishedTask( |
267 void (TileManager::*callback)()); | 267 void (TileManager::*callback)()); |
268 std::vector<PrioritizedTile> AssignGpuMemoryToTiles(); | 268 std::vector<PrioritizedTile> AssignGpuMemoryToTiles(); |
269 | 269 |
270 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 270 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
271 ScheduledTasksStateAsValue() const; | 271 ScheduledTasksStateAsValue() const; |
272 | 272 |
273 TileManagerClient* client_; | 273 TileManagerClient* client_; |
274 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 274 base::SequencedTaskRunner* task_runner_; |
275 ResourcePool* resource_pool_; | 275 ResourcePool* resource_pool_; |
276 TileTaskManager* tile_task_manager_; | 276 TileTaskManager* tile_task_manager_; |
277 GlobalStateThatImpactsTilePriority global_state_; | 277 GlobalStateThatImpactsTilePriority global_state_; |
278 size_t scheduled_raster_task_limit_; | 278 size_t scheduled_raster_task_limit_; |
279 const bool use_partial_raster_; | 279 const bool use_partial_raster_; |
280 bool use_gpu_rasterization_; | 280 bool use_gpu_rasterization_; |
281 | 281 |
282 std::unordered_map<Tile::Id, Tile*> tiles_; | 282 std::unordered_map<Tile::Id, Tile*> tiles_; |
283 | 283 |
284 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; | 284 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 std::unordered_map<Tile::Id, std::vector<DrawImage>> scheduled_draw_images_; | 325 std::unordered_map<Tile::Id, std::vector<DrawImage>> scheduled_draw_images_; |
326 | 326 |
327 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 327 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
328 | 328 |
329 DISALLOW_COPY_AND_ASSIGN(TileManager); | 329 DISALLOW_COPY_AND_ASSIGN(TileManager); |
330 }; | 330 }; |
331 | 331 |
332 } // namespace cc | 332 } // namespace cc |
333 | 333 |
334 #endif // CC_TILES_TILE_MANAGER_H_ | 334 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |