| 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_TILES_TILE_MANAGER_H_ | 5 #ifndef CC_TILES_TILE_MANAGER_H_ |
| 6 #define CC_TILES_TILE_MANAGER_H_ | 6 #define CC_TILES_TILE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 BasicStateAsValue() const; | 141 BasicStateAsValue() const; |
| 142 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const; | 142 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const; |
| 143 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 143 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
| 144 return memory_stats_from_last_assign_; | 144 return memory_stats_from_last_assign_; |
| 145 } | 145 } |
| 146 | 146 |
| 147 // Public methods for testing. | 147 // Public methods for testing. |
| 148 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { | 148 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { |
| 149 for (size_t i = 0; i < tiles.size(); ++i) { | 149 for (size_t i = 0; i < tiles.size(); ++i) { |
| 150 TileDrawInfo& draw_info = tiles[i]->draw_info(); | 150 TileDrawInfo& draw_info = tiles[i]->draw_info(); |
| 151 draw_info.resource_ = resource_pool_->AcquireResource( | 151 draw_info.set_resource(resource_pool_->AcquireResource( |
| 152 tiles[i]->desired_texture_size(), | 152 tiles[i]->desired_texture_size(), |
| 153 raster_buffer_provider_->GetResourceFormat(false), | 153 raster_buffer_provider_->GetResourceFormat(false), |
| 154 client_->GetTileColorSpace()); | 154 client_->GetTileColorSpace())); |
| 155 draw_info.set_resource_ready_for_draw(); |
| 155 } | 156 } |
| 156 } | 157 } |
| 157 | 158 |
| 158 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { | 159 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { |
| 159 for (size_t i = 0; i < tiles.size(); ++i) { | 160 for (size_t i = 0; i < tiles.size(); ++i) { |
| 160 Tile* tile = tiles[i]; | 161 Tile* tile = tiles[i]; |
| 161 FreeResourcesForTile(tile); | 162 FreeResourcesForTile(tile); |
| 162 } | 163 } |
| 163 } | 164 } |
| 164 | 165 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 scoped_refptr<TileTask> CreateTaskSetFinishedTask( | 297 scoped_refptr<TileTask> CreateTaskSetFinishedTask( |
| 297 void (TileManager::*callback)()); | 298 void (TileManager::*callback)()); |
| 298 PrioritizedWorkToSchedule AssignGpuMemoryToTiles(); | 299 PrioritizedWorkToSchedule AssignGpuMemoryToTiles(); |
| 299 void ScheduleTasks(const PrioritizedWorkToSchedule& work_to_schedule); | 300 void ScheduleTasks(const PrioritizedWorkToSchedule& work_to_schedule); |
| 300 | 301 |
| 301 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 302 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 302 ScheduledTasksStateAsValue() const; | 303 ScheduledTasksStateAsValue() const; |
| 303 | 304 |
| 304 bool UsePartialRaster() const; | 305 bool UsePartialRaster() const; |
| 305 | 306 |
| 307 void CheckPendingReadyToDrawTiles(bool issue_signals); |
| 308 |
| 306 TileManagerClient* client_; | 309 TileManagerClient* client_; |
| 307 base::SequencedTaskRunner* task_runner_; | 310 base::SequencedTaskRunner* task_runner_; |
| 308 ResourcePool* resource_pool_; | 311 ResourcePool* resource_pool_; |
| 309 std::unique_ptr<TileTaskManager> tile_task_manager_; | 312 std::unique_ptr<TileTaskManager> tile_task_manager_; |
| 310 RasterBufferProvider* raster_buffer_provider_; | 313 RasterBufferProvider* raster_buffer_provider_; |
| 311 GlobalStateThatImpactsTilePriority global_state_; | 314 GlobalStateThatImpactsTilePriority global_state_; |
| 312 size_t scheduled_raster_task_limit_; | 315 size_t scheduled_raster_task_limit_; |
| 313 const bool use_partial_raster_; | 316 const bool use_partial_raster_; |
| 314 bool use_gpu_rasterization_; | 317 bool use_gpu_rasterization_; |
| 315 | 318 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 333 | 336 |
| 334 Signals signals_; | 337 Signals signals_; |
| 335 | 338 |
| 336 UniqueNotifier signals_check_notifier_; | 339 UniqueNotifier signals_check_notifier_; |
| 337 | 340 |
| 338 bool has_scheduled_tile_tasks_; | 341 bool has_scheduled_tile_tasks_; |
| 339 | 342 |
| 340 uint64_t prepare_tiles_count_; | 343 uint64_t prepare_tiles_count_; |
| 341 uint64_t next_tile_id_; | 344 uint64_t next_tile_id_; |
| 342 | 345 |
| 346 std::vector<Tile*> pending_ready_for_draw_tiles_; |
| 347 uint64_t pending_required_for_activation_callback_id_ = 0; |
| 348 uint64_t pending_required_for_draw_callback_id_ = 0; |
| 349 // If true, we should re-compute tile requirements in |
| 350 // CheckPendingReadyToDrawTiles. |
| 351 bool pending_tile_requirements_dirty_ = false; |
| 352 |
| 343 std::unordered_map<Tile::Id, std::vector<DrawImage>> scheduled_draw_images_; | 353 std::unordered_map<Tile::Id, std::vector<DrawImage>> scheduled_draw_images_; |
| 344 std::vector<scoped_refptr<TileTask>> locked_image_tasks_; | 354 std::vector<scoped_refptr<TileTask>> locked_image_tasks_; |
| 345 | 355 |
| 356 // We need two WeakPtrFactory objects as the invalidation pattern of each is |
| 357 // different. The |task_set_finished_weak_ptr_factory_| is invalidated any |
| 358 // time new tasks are scheduled, preventing a race when the callback has |
| 359 // been scheduled but not yet executed. |
| 346 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 360 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
| 361 // The |ready_to_draw_callback_weak_ptr_factory_| is never invalidated. |
| 362 base::WeakPtrFactory<TileManager> ready_to_draw_callback_weak_ptr_factory_; |
| 347 | 363 |
| 348 DISALLOW_COPY_AND_ASSIGN(TileManager); | 364 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 349 }; | 365 }; |
| 350 | 366 |
| 351 } // namespace cc | 367 } // namespace cc |
| 352 | 368 |
| 353 #endif // CC_TILES_TILE_MANAGER_H_ | 369 #endif // CC_TILES_TILE_MANAGER_H_ |
| OLD | NEW |