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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Given an empty raster tile priority queue, this will build a priority queue | 60 // Given an empty raster tile priority queue, this will build a priority queue |
61 // that will return tiles in order in which they should be rasterized. | 61 // that will return tiles in order in which they should be rasterized. |
62 // Note if the queue was previous built, Reset must be called on it. | 62 // Note if the queue was previous built, Reset must be called on it. |
63 virtual scoped_ptr<RasterTilePriorityQueue> BuildRasterQueue( | 63 virtual scoped_ptr<RasterTilePriorityQueue> BuildRasterQueue( |
64 TreePriority tree_priority, | 64 TreePriority tree_priority, |
65 RasterTilePriorityQueue::Type type) = 0; | 65 RasterTilePriorityQueue::Type type) = 0; |
66 | 66 |
67 // Given an empty eviction tile priority queue, this will build a priority | 67 // Given an empty eviction tile priority queue, this will build a priority |
68 // queue that will return tiles in order in which they should be evicted. | 68 // queue that will return tiles in order in which they should be evicted. |
69 // Note if the queue was previous built, Reset must be called on it. | 69 // Note if the queue was previous built, Reset must be called on it. |
70 // TODO(vmpstr): Change this to scoped_ptr<EvictionQueue> Build... | 70 virtual scoped_ptr<EvictionTilePriorityQueue> BuildEvictionQueue( |
71 virtual void BuildEvictionQueue(EvictionTilePriorityQueue* queue, | 71 TreePriority tree_priority) = 0; |
72 TreePriority tree_priority) = 0; | |
73 | 72 |
74 protected: | 73 protected: |
75 virtual ~TileManagerClient() {} | 74 virtual ~TileManagerClient() {} |
76 }; | 75 }; |
77 | 76 |
78 struct RasterTaskCompletionStats { | 77 struct RasterTaskCompletionStats { |
79 RasterTaskCompletionStats(); | 78 RasterTaskCompletionStats(); |
80 | 79 |
81 size_t completed_count; | 80 size_t completed_count; |
82 size_t canceled_count; | 81 size_t canceled_count; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 void UpdateTileDrawInfo(Tile* tile, | 240 void UpdateTileDrawInfo(Tile* tile, |
242 scoped_ptr<ScopedResource> resource, | 241 scoped_ptr<ScopedResource> resource, |
243 const RasterSource::SolidColorAnalysis& analysis); | 242 const RasterSource::SolidColorAnalysis& analysis); |
244 | 243 |
245 void FreeResourcesForTile(Tile* tile); | 244 void FreeResourcesForTile(Tile* tile); |
246 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); | 245 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); |
247 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, | 246 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, |
248 SkPixelRef* pixel_ref); | 247 SkPixelRef* pixel_ref); |
249 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); | 248 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); |
250 | 249 |
251 void RebuildEvictionQueueIfNeeded(); | 250 scoped_ptr<EvictionTilePriorityQueue> |
252 bool FreeTileResourcesUntilUsageIsWithinLimit(const MemoryUsage& limit, | 251 FreeTileResourcesUntilUsageIsWithinLimit( |
253 MemoryUsage* usage); | 252 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
254 bool FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( | 253 const MemoryUsage& limit, |
| 254 MemoryUsage* usage); |
| 255 scoped_ptr<EvictionTilePriorityQueue> |
| 256 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( |
| 257 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
255 const MemoryUsage& limit, | 258 const MemoryUsage& limit, |
256 const TilePriority& oother_priority, | 259 const TilePriority& oother_priority, |
257 MemoryUsage* usage); | 260 MemoryUsage* usage); |
258 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); | 261 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); |
259 bool IsReadyToActivate() const; | 262 bool IsReadyToActivate() const; |
260 bool IsReadyToDraw() const; | 263 bool IsReadyToDraw() const; |
261 void NotifyReadyToActivate(); | 264 void NotifyReadyToActivate(); |
262 void NotifyReadyToDraw(); | 265 void NotifyReadyToDraw(); |
263 void CheckIfReadyToActivate(); | 266 void CheckIfReadyToActivate(); |
264 void CheckIfReadyToDraw(); | 267 void CheckIfReadyToDraw(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 TileTaskQueue raster_queue_; | 302 TileTaskQueue raster_queue_; |
300 | 303 |
301 std::vector<scoped_refptr<RasterTask>> orphan_raster_tasks_; | 304 std::vector<scoped_refptr<RasterTask>> orphan_raster_tasks_; |
302 | 305 |
303 UniqueNotifier ready_to_activate_notifier_; | 306 UniqueNotifier ready_to_activate_notifier_; |
304 UniqueNotifier ready_to_draw_notifier_; | 307 UniqueNotifier ready_to_draw_notifier_; |
305 UniqueNotifier ready_to_activate_check_notifier_; | 308 UniqueNotifier ready_to_activate_check_notifier_; |
306 UniqueNotifier ready_to_draw_check_notifier_; | 309 UniqueNotifier ready_to_draw_check_notifier_; |
307 UniqueNotifier more_tiles_need_prepare_check_notifier_; | 310 UniqueNotifier more_tiles_need_prepare_check_notifier_; |
308 | 311 |
309 EvictionTilePriorityQueue eviction_priority_queue_; | |
310 bool eviction_priority_queue_is_up_to_date_; | |
311 | |
312 bool did_notify_ready_to_activate_; | 312 bool did_notify_ready_to_activate_; |
313 bool did_notify_ready_to_draw_; | 313 bool did_notify_ready_to_draw_; |
314 | 314 |
315 DISALLOW_COPY_AND_ASSIGN(TileManager); | 315 DISALLOW_COPY_AND_ASSIGN(TileManager); |
316 }; | 316 }; |
317 | 317 |
318 } // namespace cc | 318 } // namespace cc |
319 | 319 |
320 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 320 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |