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 13 matching lines...) Expand all Loading... |
24 #include "cc/resources/prioritized_tile_set.h" | 24 #include "cc/resources/prioritized_tile_set.h" |
25 #include "cc/resources/rasterizer.h" | 25 #include "cc/resources/rasterizer.h" |
26 #include "cc/resources/resource_pool.h" | 26 #include "cc/resources/resource_pool.h" |
27 #include "cc/resources/tile.h" | 27 #include "cc/resources/tile.h" |
28 | 28 |
29 namespace cc { | 29 namespace cc { |
30 class ResourceProvider; | 30 class ResourceProvider; |
31 | 31 |
32 class CC_EXPORT TileManagerClient { | 32 class CC_EXPORT TileManagerClient { |
33 public: | 33 public: |
| 34 // Returns the set of layers that the tile manager should consider for raster. |
| 35 virtual const std::vector<PictureLayerImpl*>& GetPictureLayers() = 0; |
| 36 |
34 // Called when all tiles marked as required for activation are ready to draw. | 37 // Called when all tiles marked as required for activation are ready to draw. |
35 virtual void NotifyReadyToActivate() = 0; | 38 virtual void NotifyReadyToActivate() = 0; |
36 | 39 |
37 // Called when the visible representation of a tile might have changed. Some | 40 // Called when the visible representation of a tile might have changed. Some |
38 // examples are: | 41 // examples are: |
39 // - Tile version initialized. | 42 // - Tile version initialized. |
40 // - Tile resources freed. | 43 // - Tile resources freed. |
41 // - Tile marked for on-demand raster. | 44 // - Tile marked for on-demand raster. |
42 virtual void NotifyTileStateChanged(const Tile* tile) = 0; | 45 virtual void NotifyTileStateChanged(const Tile* tile) = 0; |
43 | 46 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 178 |
176 scoped_refptr<Tile> CreateTile(PicturePileImpl* picture_pile, | 179 scoped_refptr<Tile> CreateTile(PicturePileImpl* picture_pile, |
177 const gfx::Size& tile_size, | 180 const gfx::Size& tile_size, |
178 const gfx::Rect& content_rect, | 181 const gfx::Rect& content_rect, |
179 const gfx::Rect& opaque_rect, | 182 const gfx::Rect& opaque_rect, |
180 float contents_scale, | 183 float contents_scale, |
181 int layer_id, | 184 int layer_id, |
182 int source_frame_number, | 185 int source_frame_number, |
183 int flags); | 186 int flags); |
184 | 187 |
185 void RegisterPictureLayerImpl(PictureLayerImpl* layer); | |
186 void UnregisterPictureLayerImpl(PictureLayerImpl* layer); | |
187 | |
188 scoped_ptr<base::Value> BasicStateAsValue() const; | 188 scoped_ptr<base::Value> BasicStateAsValue() const; |
189 scoped_ptr<base::Value> AllTilesAsValue() const; | 189 scoped_ptr<base::Value> AllTilesAsValue() const; |
190 void GetMemoryStats(size_t* memory_required_bytes, | 190 void GetMemoryStats(size_t* memory_required_bytes, |
191 size_t* memory_nice_to_have_bytes, | 191 size_t* memory_nice_to_have_bytes, |
192 size_t* memory_allocated_bytes, | 192 size_t* memory_allocated_bytes, |
193 size_t* memory_used_bytes) const; | 193 size_t* memory_used_bytes) const; |
194 | 194 |
195 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 195 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
196 return memory_stats_from_last_assign_; | 196 return memory_stats_from_last_assign_; |
197 } | 197 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 283 |
284 void FreeResourceForTile(Tile* tile, RasterMode mode); | 284 void FreeResourceForTile(Tile* tile, RasterMode mode); |
285 void FreeResourcesForTile(Tile* tile); | 285 void FreeResourcesForTile(Tile* tile); |
286 void FreeUnusedResourcesForTile(Tile* tile); | 286 void FreeUnusedResourcesForTile(Tile* tile); |
287 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); | 287 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); |
288 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, | 288 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, |
289 SkPixelRef* pixel_ref); | 289 SkPixelRef* pixel_ref); |
290 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); | 290 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); |
291 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; | 291 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; |
292 void UpdatePrioritizedTileSetIfNeeded(); | 292 void UpdatePrioritizedTileSetIfNeeded(); |
293 void CleanUpLayers(); | |
294 | 293 |
295 bool IsReadyToActivate() const; | 294 bool IsReadyToActivate() const; |
296 void CheckIfReadyToActivate(); | 295 void CheckIfReadyToActivate(); |
297 | 296 |
298 TileManagerClient* client_; | 297 TileManagerClient* client_; |
299 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 298 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
300 ResourcePool* resource_pool_; | 299 ResourcePool* resource_pool_; |
301 Rasterizer* rasterizer_; | 300 Rasterizer* rasterizer_; |
302 GlobalStateThatImpactsTilePriority global_state_; | 301 GlobalStateThatImpactsTilePriority global_state_; |
303 | 302 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 335 |
337 std::vector<Tile*> released_tiles_; | 336 std::vector<Tile*> released_tiles_; |
338 | 337 |
339 ResourceFormat resource_format_; | 338 ResourceFormat resource_format_; |
340 | 339 |
341 // Queue used when scheduling raster tasks. | 340 // Queue used when scheduling raster tasks. |
342 RasterTaskQueue raster_queue_; | 341 RasterTaskQueue raster_queue_; |
343 | 342 |
344 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; | 343 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; |
345 | 344 |
346 std::vector<PictureLayerImpl*> layers_; | |
347 | |
348 UniqueNotifier ready_to_activate_check_notifier_; | 345 UniqueNotifier ready_to_activate_check_notifier_; |
349 | 346 |
350 DISALLOW_COPY_AND_ASSIGN(TileManager); | 347 DISALLOW_COPY_AND_ASSIGN(TileManager); |
351 }; | 348 }; |
352 | 349 |
353 } // namespace cc | 350 } // namespace cc |
354 | 351 |
355 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 352 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |