| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 const gfx::Size& tile_size, | 180 const gfx::Size& tile_size, |
| 181 const gfx::Rect& content_rect, | 181 const gfx::Rect& content_rect, |
| 182 const gfx::Rect& opaque_rect, | 182 const gfx::Rect& opaque_rect, |
| 183 float contents_scale, | 183 float contents_scale, |
| 184 int layer_id, | 184 int layer_id, |
| 185 int source_frame_number, | 185 int source_frame_number, |
| 186 int flags); | 186 int flags); |
| 187 | 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, | |
| 191 size_t* memory_nice_to_have_bytes, | |
| 192 size_t* memory_allocated_bytes, | |
| 193 size_t* memory_used_bytes) const; | |
| 194 | |
| 195 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 190 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
| 196 return memory_stats_from_last_assign_; | 191 return memory_stats_from_last_assign_; |
| 197 } | 192 } |
| 198 | 193 |
| 199 void GetPairedPictureLayers(std::vector<PairedPictureLayer>* layers) const; | 194 void GetPairedPictureLayers(std::vector<PairedPictureLayer>* layers) const; |
| 200 | 195 |
| 201 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { | 196 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { |
| 202 for (size_t i = 0; i < tiles.size(); ++i) { | 197 for (size_t i = 0; i < tiles.size(); ++i) { |
| 203 ManagedTileState& mts = tiles[i]->managed_state(); | 198 ManagedTileState& mts = tiles[i]->managed_state(); |
| 204 ManagedTileState::TileVersion& tile_version = | 199 ManagedTileState::TileVersion& tile_version = |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 resource_pool_->resource_format()); | 276 resource_pool_->resource_format()); |
| 282 } | 277 } |
| 283 | 278 |
| 284 void FreeResourceForTile(Tile* tile, RasterMode mode); | 279 void FreeResourceForTile(Tile* tile, RasterMode mode); |
| 285 void FreeResourcesForTile(Tile* tile); | 280 void FreeResourcesForTile(Tile* tile); |
| 286 void FreeUnusedResourcesForTile(Tile* tile); | 281 void FreeUnusedResourcesForTile(Tile* tile); |
| 287 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); | 282 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); |
| 288 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, | 283 scoped_refptr<ImageDecodeTask> CreateImageDecodeTask(Tile* tile, |
| 289 SkPixelRef* pixel_ref); | 284 SkPixelRef* pixel_ref); |
| 290 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); | 285 scoped_refptr<RasterTask> CreateRasterTask(Tile* tile); |
| 291 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; | |
| 292 void UpdatePrioritizedTileSetIfNeeded(); | 286 void UpdatePrioritizedTileSetIfNeeded(); |
| 293 | 287 |
| 294 bool IsReadyToActivate() const; | 288 bool IsReadyToActivate() const; |
| 295 void CheckIfReadyToActivate(); | 289 void CheckIfReadyToActivate(); |
| 296 | 290 |
| 297 TileManagerClient* client_; | 291 TileManagerClient* client_; |
| 298 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 292 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 299 ResourcePool* resource_pool_; | 293 ResourcePool* resource_pool_; |
| 300 Rasterizer* rasterizer_; | 294 Rasterizer* rasterizer_; |
| 301 GlobalStateThatImpactsTilePriority global_state_; | 295 GlobalStateThatImpactsTilePriority global_state_; |
| 302 | 296 |
| 303 typedef base::hash_map<Tile::Id, Tile*> TileMap; | 297 typedef base::hash_map<Tile::Id, Tile*> TileMap; |
| 304 TileMap tiles_; | 298 TileMap tiles_; |
| 305 | 299 |
| 306 PrioritizedTileSet prioritized_tiles_; | 300 PrioritizedTileSet prioritized_tiles_; |
| 307 bool prioritized_tiles_dirty_; | 301 bool prioritized_tiles_dirty_; |
| 308 | 302 |
| 309 bool all_tiles_that_need_to_be_rasterized_have_memory_; | 303 bool all_tiles_that_need_to_be_rasterized_have_memory_; |
| 310 bool all_tiles_required_for_activation_have_memory_; | 304 bool all_tiles_required_for_activation_have_memory_; |
| 311 | 305 |
| 312 size_t memory_required_bytes_; | |
| 313 size_t memory_nice_to_have_bytes_; | |
| 314 | |
| 315 size_t bytes_releasable_; | 306 size_t bytes_releasable_; |
| 316 size_t resources_releasable_; | 307 size_t resources_releasable_; |
| 317 | 308 |
| 318 bool ever_exceeded_memory_budget_; | 309 bool ever_exceeded_memory_budget_; |
| 319 MemoryHistory::Entry memory_stats_from_last_assign_; | 310 MemoryHistory::Entry memory_stats_from_last_assign_; |
| 320 | 311 |
| 321 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 312 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
| 322 | 313 |
| 323 bool did_initialize_visible_tile_; | 314 bool did_initialize_visible_tile_; |
| 324 bool did_check_for_completed_tasks_since_last_schedule_tasks_; | 315 bool did_check_for_completed_tasks_since_last_schedule_tasks_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 343 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; | 334 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; |
| 344 | 335 |
| 345 UniqueNotifier ready_to_activate_check_notifier_; | 336 UniqueNotifier ready_to_activate_check_notifier_; |
| 346 | 337 |
| 347 DISALLOW_COPY_AND_ASSIGN(TileManager); | 338 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 348 }; | 339 }; |
| 349 | 340 |
| 350 } // namespace cc | 341 } // namespace cc |
| 351 | 342 |
| 352 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 343 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |