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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 91 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
92 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); | 92 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); |
93 | 93 |
94 // This class manages tiles, deciding which should get rasterized and which | 94 // This class manages tiles, deciding which should get rasterized and which |
95 // should no longer have any memory assigned to them. Tile objects are "owned" | 95 // should no longer have any memory assigned to them. Tile objects are "owned" |
96 // by layers; they automatically register with the manager when they are | 96 // by layers; they automatically register with the manager when they are |
97 // created, and unregister from the manager when they are deleted. | 97 // created, and unregister from the manager when they are deleted. |
98 class CC_EXPORT TileManager { | 98 class CC_EXPORT TileManager { |
99 public: | 99 public: |
100 TileManager(TileManagerClient* client, | 100 TileManager(TileManagerClient* client, |
101 base::SequencedTaskRunner* task_runner, | 101 base::SequencedTaskRunner* origin_task_runner, |
| 102 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner, |
102 size_t scheduled_raster_task_limit, | 103 size_t scheduled_raster_task_limit, |
103 bool use_partial_raster); | 104 bool use_partial_raster); |
104 virtual ~TileManager(); | 105 virtual ~TileManager(); |
105 | 106 |
106 // Assigns tile memory and schedules work to prepare tiles for drawing. | 107 // Assigns tile memory and schedules work to prepare tiles for drawing. |
107 // - Runs client_->NotifyReadyToActivate() when all tiles required for | 108 // - Runs client_->NotifyReadyToActivate() when all tiles required for |
108 // activation are prepared, or failed to prepare due to OOM. | 109 // activation are prepared, or failed to prepare due to OOM. |
109 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are | 110 // - Runs client_->NotifyReadyToDraw() when all tiles required draw are |
110 // prepared, or failed to prepare due to OOM. | 111 // prepared, or failed to prepare due to OOM. |
111 bool PrepareTiles(const GlobalStateThatImpactsTilePriority& state); | 112 bool PrepareTiles(const GlobalStateThatImpactsTilePriority& state); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 204 |
204 bool HasScheduledTileTasksForTesting() const { | 205 bool HasScheduledTileTasksForTesting() const { |
205 return has_scheduled_tile_tasks_; | 206 return has_scheduled_tile_tasks_; |
206 } | 207 } |
207 | 208 |
208 void OnRasterTaskCompleted(std::unique_ptr<RasterBuffer> raster_buffer, | 209 void OnRasterTaskCompleted(std::unique_ptr<RasterBuffer> raster_buffer, |
209 Tile* tile, | 210 Tile* tile, |
210 Resource* resource, | 211 Resource* resource, |
211 bool was_canceled); | 212 bool was_canceled); |
212 | 213 |
| 214 void NotifyFrameFinished(); |
| 215 |
213 protected: | 216 protected: |
214 void FreeResourcesForReleasedTiles(); | 217 void FreeResourcesForReleasedTiles(); |
215 void CleanUpReleasedTiles(); | 218 void CleanUpReleasedTiles(); |
216 | 219 |
217 friend class Tile; | 220 friend class Tile; |
218 // Virtual for testing. | 221 // Virtual for testing. |
219 virtual void Release(Tile* tile); | 222 virtual void Release(Tile* tile); |
220 Tile::Id GetUniqueTileId() { return ++next_tile_id_; } | 223 Tile::Id GetUniqueTileId() { return ++next_tile_id_; } |
221 | 224 |
222 private: | 225 private: |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 std::vector<scoped_refptr<TileTask>> locked_image_tasks_; | 347 std::vector<scoped_refptr<TileTask>> locked_image_tasks_; |
345 | 348 |
346 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 349 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
347 | 350 |
348 DISALLOW_COPY_AND_ASSIGN(TileManager); | 351 DISALLOW_COPY_AND_ASSIGN(TileManager); |
349 }; | 352 }; |
350 | 353 |
351 } // namespace cc | 354 } // namespace cc |
352 | 355 |
353 #endif // CC_TILES_TILE_MANAGER_H_ | 356 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |