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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 ALL = 1, | 91 ALL = 1, |
92 // Adding additional values requires increasing kNumberOfTaskSets in | 92 // Adding additional values requires increasing kNumberOfTaskSets in |
93 // rasterizer.h | 93 // rasterizer.h |
94 }; | 94 }; |
95 | 95 |
96 static scoped_ptr<TileManager> Create( | 96 static scoped_ptr<TileManager> Create( |
97 TileManagerClient* client, | 97 TileManagerClient* client, |
98 base::SequencedTaskRunner* task_runner, | 98 base::SequencedTaskRunner* task_runner, |
99 ResourcePool* resource_pool, | 99 ResourcePool* resource_pool, |
100 Rasterizer* rasterizer, | 100 Rasterizer* rasterizer, |
101 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 101 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 102 size_t scheduled_raster_task_limit); |
102 ~TileManager() override; | 103 ~TileManager() override; |
103 | 104 |
104 void ManageTiles(const GlobalStateThatImpactsTilePriority& state); | 105 void ManageTiles(const GlobalStateThatImpactsTilePriority& state); |
105 | 106 |
106 // Returns true when visible tiles have been initialized. | 107 // Returns true when visible tiles have been initialized. |
107 bool UpdateVisibleTiles(); | 108 bool UpdateVisibleTiles(); |
108 | 109 |
109 scoped_refptr<Tile> CreateTile(PicturePileImpl* picture_pile, | 110 scoped_refptr<Tile> CreateTile(PicturePileImpl* picture_pile, |
110 const gfx::Size& tile_size, | 111 const gfx::Size& tile_size, |
111 const gfx::Rect& content_rect, | 112 const gfx::Rect& content_rect, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 tiles.push_back(it->second); | 157 tiles.push_back(it->second); |
157 } | 158 } |
158 return tiles; | 159 return tiles; |
159 } | 160 } |
160 | 161 |
161 protected: | 162 protected: |
162 TileManager(TileManagerClient* client, | 163 TileManager(TileManagerClient* client, |
163 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 164 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
164 ResourcePool* resource_pool, | 165 ResourcePool* resource_pool, |
165 Rasterizer* rasterizer, | 166 Rasterizer* rasterizer, |
166 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 167 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 168 size_t scheduled_raster_task_limit); |
167 | 169 |
168 void FreeResourcesForReleasedTiles(); | 170 void FreeResourcesForReleasedTiles(); |
169 void CleanUpReleasedTiles(); | 171 void CleanUpReleasedTiles(); |
170 | 172 |
171 // Overriden from RefCountedManager<Tile>: | 173 // Overriden from RefCountedManager<Tile>: |
172 friend class Tile; | 174 friend class Tile; |
173 void Release(Tile* tile) override; | 175 void Release(Tile* tile) override; |
174 | 176 |
175 // Overriden from RasterizerClient: | 177 // Overriden from RasterizerClient: |
176 void DidFinishRunningTasks(TaskSet task_set) override; | 178 void DidFinishRunningTasks(TaskSet task_set) override; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 MemoryUsage* usage); | 231 MemoryUsage* usage); |
230 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); | 232 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); |
231 bool IsReadyToActivate() const; | 233 bool IsReadyToActivate() const; |
232 void CheckIfReadyToActivate(); | 234 void CheckIfReadyToActivate(); |
233 | 235 |
234 TileManagerClient* client_; | 236 TileManagerClient* client_; |
235 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 237 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
236 ResourcePool* resource_pool_; | 238 ResourcePool* resource_pool_; |
237 Rasterizer* rasterizer_; | 239 Rasterizer* rasterizer_; |
238 GlobalStateThatImpactsTilePriority global_state_; | 240 GlobalStateThatImpactsTilePriority global_state_; |
| 241 const size_t scheduled_raster_task_limit_; |
239 | 242 |
240 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 243 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
241 TileMap tiles_; | 244 TileMap tiles_; |
242 | 245 |
243 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; | 246 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; |
244 MemoryHistory::Entry memory_stats_from_last_assign_; | 247 MemoryHistory::Entry memory_stats_from_last_assign_; |
245 | 248 |
246 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 249 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
247 | 250 |
248 bool did_initialize_visible_tile_; | 251 bool did_initialize_visible_tile_; |
(...skipping 24 matching lines...) Expand all Loading... |
273 RasterTilePriorityQueue raster_priority_queue_; | 276 RasterTilePriorityQueue raster_priority_queue_; |
274 EvictionTilePriorityQueue eviction_priority_queue_; | 277 EvictionTilePriorityQueue eviction_priority_queue_; |
275 bool eviction_priority_queue_is_up_to_date_; | 278 bool eviction_priority_queue_is_up_to_date_; |
276 | 279 |
277 DISALLOW_COPY_AND_ASSIGN(TileManager); | 280 DISALLOW_COPY_AND_ASSIGN(TileManager); |
278 }; | 281 }; |
279 | 282 |
280 } // namespace cc | 283 } // namespace cc |
281 | 284 |
282 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 285 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |