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 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 namespace cc { | 35 namespace cc { |
36 class PictureLayerImpl; | 36 class PictureLayerImpl; |
37 class Rasterizer; | 37 class Rasterizer; |
38 class ResourceProvider; | 38 class ResourceProvider; |
39 | 39 |
40 class CC_EXPORT TileManagerClient { | 40 class CC_EXPORT TileManagerClient { |
41 public: | 41 public: |
42 // Returns the set of layers that the tile manager should consider for raster. | |
43 // TODO(vmpstr): Change the way we determine if we are ready to activate, so | |
44 // that this can be removed. | |
45 virtual const std::vector<PictureLayerImpl*>& GetPictureLayers() const = 0; | |
46 | |
47 // Called when all tiles marked as required for activation are ready to draw. | 42 // Called when all tiles marked as required for activation are ready to draw. |
48 virtual void NotifyReadyToActivate() = 0; | 43 virtual void NotifyReadyToActivate() = 0; |
49 | 44 |
50 // Called when all tiles marked as required for draw are ready to draw. | 45 // Called when all tiles marked as required for draw are ready to draw. |
51 virtual void NotifyReadyToDraw() = 0; | 46 virtual void NotifyReadyToDraw() = 0; |
52 | 47 |
53 // Called when the visible representation of a tile might have changed. Some | 48 // Called when the visible representation of a tile might have changed. Some |
54 // examples are: | 49 // examples are: |
55 // - Tile version initialized. | 50 // - Tile version initialized. |
56 // - Tile resources freed. | 51 // - Tile resources freed. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 ++it) { | 164 ++it) { |
170 tiles.push_back(it->second); | 165 tiles.push_back(it->second); |
171 } | 166 } |
172 return tiles; | 167 return tiles; |
173 } | 168 } |
174 | 169 |
175 void SetScheduledRasterTaskLimitForTesting(size_t limit) { | 170 void SetScheduledRasterTaskLimitForTesting(size_t limit) { |
176 scheduled_raster_task_limit_ = limit; | 171 scheduled_raster_task_limit_ = limit; |
177 } | 172 } |
178 | 173 |
| 174 bool IsReadyToActivate() const; |
| 175 bool IsReadyToDraw() const; |
| 176 |
179 protected: | 177 protected: |
180 TileManager(TileManagerClient* client, | 178 TileManager(TileManagerClient* client, |
181 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 179 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
182 ResourcePool* resource_pool, | 180 ResourcePool* resource_pool, |
183 TileTaskRunner* tile_task_runner, | 181 TileTaskRunner* tile_task_runner, |
184 Rasterizer* rasterizer, | 182 Rasterizer* rasterizer, |
185 size_t scheduled_raster_task_limit); | 183 size_t scheduled_raster_task_limit); |
186 | 184 |
187 void FreeResourcesForReleasedTiles(); | 185 void FreeResourcesForReleasedTiles(); |
188 void CleanUpReleasedTiles(); | 186 void CleanUpReleasedTiles(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 250 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
253 const MemoryUsage& limit, | 251 const MemoryUsage& limit, |
254 MemoryUsage* usage); | 252 MemoryUsage* usage); |
255 scoped_ptr<EvictionTilePriorityQueue> | 253 scoped_ptr<EvictionTilePriorityQueue> |
256 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( | 254 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( |
257 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 255 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
258 const MemoryUsage& limit, | 256 const MemoryUsage& limit, |
259 const TilePriority& oother_priority, | 257 const TilePriority& oother_priority, |
260 MemoryUsage* usage); | 258 MemoryUsage* usage); |
261 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); | 259 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); |
262 bool IsReadyToActivate() const; | 260 bool AreRequiredTilesReadyToDraw(RasterTilePriorityQueue::Type type) const; |
263 bool IsReadyToDraw() const; | |
264 void NotifyReadyToActivate(); | 261 void NotifyReadyToActivate(); |
265 void NotifyReadyToDraw(); | 262 void NotifyReadyToDraw(); |
266 void CheckIfReadyToActivate(); | 263 void CheckIfReadyToActivate(); |
267 void CheckIfReadyToDraw(); | 264 void CheckIfReadyToDraw(); |
268 void CheckIfMoreTilesNeedToBePrepared(); | 265 void CheckIfMoreTilesNeedToBePrepared(); |
269 | 266 |
270 TileManagerClient* client_; | 267 TileManagerClient* client_; |
271 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 268 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
272 ResourcePool* resource_pool_; | 269 ResourcePool* resource_pool_; |
273 TileTaskRunner* tile_task_runner_; | 270 TileTaskRunner* tile_task_runner_; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 308 |
312 bool did_notify_ready_to_activate_; | 309 bool did_notify_ready_to_activate_; |
313 bool did_notify_ready_to_draw_; | 310 bool did_notify_ready_to_draw_; |
314 | 311 |
315 DISALLOW_COPY_AND_ASSIGN(TileManager); | 312 DISALLOW_COPY_AND_ASSIGN(TileManager); |
316 }; | 313 }; |
317 | 314 |
318 } // namespace cc | 315 } // namespace cc |
319 | 316 |
320 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 317 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |