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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 // Soft limit is used for resource pool such that | 220 // Soft limit is used for resource pool such that |
221 // memory returns to soft limit after going over. | 221 // memory returns to soft limit after going over. |
222 if (state != global_state_) { | 222 if (state != global_state_) { |
223 global_state_ = state; | 223 global_state_ = state; |
224 prioritized_tiles_dirty_ = true; | 224 prioritized_tiles_dirty_ = true; |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
228 void SetRasterizerForTesting(Rasterizer* rasterizer); | 228 void SetRasterizerForTesting(Rasterizer* rasterizer); |
229 | 229 |
230 void CleanUpReleasedTilesForTesting() { CleanUpReleasedTiles(); } | 230 void FreeResourcesAndCleanUpReleasedTilesForTesting() { |
231 FreeResourcesForReleasedTiles(); | |
232 CleanUpReleasedTiles(); | |
233 } | |
231 | 234 |
232 protected: | 235 protected: |
233 TileManager(TileManagerClient* client, | 236 TileManager(TileManagerClient* client, |
234 base::SequencedTaskRunner* task_runner, | 237 base::SequencedTaskRunner* task_runner, |
235 ResourcePool* resource_pool, | 238 ResourcePool* resource_pool, |
236 Rasterizer* rasterizer, | 239 Rasterizer* rasterizer, |
237 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 240 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
238 | 241 |
239 // Methods called by Tile | 242 // Methods called by Tile |
240 friend class Tile; | 243 friend class Tile; |
241 void DidChangeTilePriority(Tile* tile); | 244 void DidChangeTilePriority(Tile* tile); |
242 | 245 |
246 void FreeResourcesForReleasedTiles(); | |
243 void CleanUpReleasedTiles(); | 247 void CleanUpReleasedTiles(); |
244 | 248 |
245 // Overriden from RefCountedManager<Tile>: | 249 // Overriden from RefCountedManager<Tile>: |
246 virtual void Release(Tile* tile) OVERRIDE; | 250 virtual void Release(Tile* tile) OVERRIDE; |
247 | 251 |
248 // Overriden from RasterizerClient: | 252 // Overriden from RasterizerClient: |
249 virtual bool ShouldForceTasksRequiredForActivationToComplete() const OVERRIDE; | 253 virtual bool ShouldForceTasksRequiredForActivationToComplete() const OVERRIDE; |
250 virtual void DidFinishRunningTasks() OVERRIDE; | 254 virtual void DidFinishRunningTasks() OVERRIDE; |
251 virtual void DidFinishRunningTasksRequiredForActivation() OVERRIDE; | 255 virtual void DidFinishRunningTasksRequiredForActivation() OVERRIDE; |
252 | 256 |
(...skipping 28 matching lines...) Expand all Loading... | |
281 void FreeUnusedResourcesForTile(Tile* tile); | 285 void FreeUnusedResourcesForTile(Tile* tile); |
282 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); | 286 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); |
283 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, | 287 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, |
284 SkPixelRef* pixel_ref); | 288 SkPixelRef* pixel_ref); |
285 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); | 289 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); |
286 void UpdatePrioritizedTileSetIfNeeded(); | 290 void UpdatePrioritizedTileSetIfNeeded(); |
287 | 291 |
288 bool IsReadyToActivate() const; | 292 bool IsReadyToActivate() const; |
289 void CheckIfReadyToActivate(); | 293 void CheckIfReadyToActivate(); |
290 | 294 |
295 static bool TileHasRasterTask(Tile* tile); | |
reveman
2014/07/15 05:46:47
can you make it "const Tile*" instead?
sohanjg
2014/07/15 06:20:05
Done.
| |
296 | |
291 TileManagerClient* client_; | 297 TileManagerClient* client_; |
292 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 298 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
293 ResourcePool* resource_pool_; | 299 ResourcePool* resource_pool_; |
294 Rasterizer* rasterizer_; | 300 Rasterizer* rasterizer_; |
295 GlobalStateThatImpactsTilePriority global_state_; | 301 GlobalStateThatImpactsTilePriority global_state_; |
296 | 302 |
297 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 303 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
298 TileMap tiles_; | 304 TileMap tiles_; |
299 | 305 |
300 PrioritizedTileSet prioritized_tiles_; | 306 PrioritizedTileSet prioritized_tiles_; |
(...skipping 23 matching lines...) Expand all Loading... | |
324 | 330 |
325 RasterTaskCompletionStats update_visible_tiles_stats_; | 331 RasterTaskCompletionStats update_visible_tiles_stats_; |
326 | 332 |
327 std::vector<Tile*> released_tiles_; | 333 std::vector<Tile*> released_tiles_; |
328 | 334 |
329 ResourceFormat resource_format_; | 335 ResourceFormat resource_format_; |
330 | 336 |
331 // Queue used when scheduling raster tasks. | 337 // Queue used when scheduling raster tasks. |
332 RasterTaskQueue raster_queue_; | 338 RasterTaskQueue raster_queue_; |
333 | 339 |
334 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; | |
335 | |
336 UniqueNotifier ready_to_activate_check_notifier_; | 340 UniqueNotifier ready_to_activate_check_notifier_; |
337 | 341 |
338 DISALLOW_COPY_AND_ASSIGN(TileManager); | 342 DISALLOW_COPY_AND_ASSIGN(TileManager); |
339 }; | 343 }; |
340 | 344 |
341 } // namespace cc | 345 } // namespace cc |
342 | 346 |
343 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 347 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |