| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // much resources as possible. Also, prevents any future work until a | 113 // much resources as possible. Also, prevents any future work until a |
| 114 // SetResources call. | 114 // SetResources call. |
| 115 void FinishTasksAndCleanUp(); | 115 void FinishTasksAndCleanUp(); |
| 116 | 116 |
| 117 // Set the new given resource pool and tile task runner. Note that | 117 // Set the new given resource pool and tile task runner. Note that |
| 118 // FinishTasksAndCleanUp must be called in between consecutive calls to | 118 // FinishTasksAndCleanUp must be called in between consecutive calls to |
| 119 // SetResources. | 119 // SetResources. |
| 120 void SetResources(ResourcePool* resource_pool, | 120 void SetResources(ResourcePool* resource_pool, |
| 121 ImageDecodeController* image_decode_controller, | 121 ImageDecodeController* image_decode_controller, |
| 122 TileTaskManager* tile_task_manager, | 122 TileTaskManager* tile_task_manager, |
| 123 RasterBufferProvider* raster_buffer_provider, | |
| 124 size_t scheduled_raster_task_limit, | 123 size_t scheduled_raster_task_limit, |
| 125 bool use_gpu_rasterization); | 124 bool use_gpu_rasterization); |
| 126 | 125 |
| 127 // This causes any completed raster work to finalize, so that tiles get up to | 126 // This causes any completed raster work to finalize, so that tiles get up to |
| 128 // date draw information. | 127 // date draw information. |
| 129 void Flush(); | 128 void Flush(); |
| 130 | 129 |
| 131 ScopedTilePtr CreateTile(const Tile::CreateInfo& info, | 130 ScopedTilePtr CreateTile(const Tile::CreateInfo& info, |
| 132 int layer_id, | 131 int layer_id, |
| 133 int source_frame_number, | 132 int source_frame_number, |
| 134 int flags); | 133 int flags); |
| 135 | 134 |
| 136 bool IsReadyToActivate() const; | 135 bool IsReadyToActivate() const; |
| 137 bool IsReadyToDraw() const; | 136 bool IsReadyToDraw() const; |
| 138 | 137 |
| 139 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 138 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 140 BasicStateAsValue() const; | 139 BasicStateAsValue() const; |
| 141 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const; | 140 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const; |
| 142 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 141 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
| 143 return memory_stats_from_last_assign_; | 142 return memory_stats_from_last_assign_; |
| 144 } | 143 } |
| 145 | 144 |
| 146 // Public methods for testing. | 145 // Public methods for testing. |
| 147 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { | 146 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { |
| 148 for (size_t i = 0; i < tiles.size(); ++i) { | 147 for (size_t i = 0; i < tiles.size(); ++i) { |
| 149 TileDrawInfo& draw_info = tiles[i]->draw_info(); | 148 TileDrawInfo& draw_info = tiles[i]->draw_info(); |
| 150 draw_info.resource_ = resource_pool_->AcquireResource( | 149 draw_info.resource_ = resource_pool_->AcquireResource( |
| 151 tiles[i]->desired_texture_size(), | 150 tiles[i]->desired_texture_size(), |
| 152 raster_buffer_provider_->GetResourceFormat(false)); | 151 tile_task_manager_->GetRasterBufferProvider()->GetResourceFormat( |
| 152 false)); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { | 156 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { |
| 157 for (size_t i = 0; i < tiles.size(); ++i) { | 157 for (size_t i = 0; i < tiles.size(); ++i) { |
| 158 Tile* tile = tiles[i]; | 158 Tile* tile = tiles[i]; |
| 159 FreeResourcesForTile(tile); | 159 FreeResourcesForTile(tile); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 void SetGlobalStateForTesting( | 163 void SetGlobalStateForTesting( |
| 164 const GlobalStateThatImpactsTilePriority& state) { | 164 const GlobalStateThatImpactsTilePriority& state) { |
| 165 global_state_ = state; | 165 global_state_ = state; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void SetTileTaskManagerForTesting(TileTaskManager* tile_task_manager); | 168 void SetTileTaskManagerForTesting(TileTaskManager* tile_task_manager); |
| 169 | 169 |
| 170 void SetRasterBufferProviderForTesting( | |
| 171 RasterBufferProvider* raster_buffer_provider); | |
| 172 | |
| 173 void FreeResourcesAndCleanUpReleasedTilesForTesting() { | 170 void FreeResourcesAndCleanUpReleasedTilesForTesting() { |
| 174 FreeResourcesForReleasedTiles(); | 171 FreeResourcesForReleasedTiles(); |
| 175 CleanUpReleasedTiles(); | 172 CleanUpReleasedTiles(); |
| 176 } | 173 } |
| 177 | 174 |
| 178 std::vector<Tile*> AllTilesForTesting() const { | 175 std::vector<Tile*> AllTilesForTesting() const { |
| 179 std::vector<Tile*> tiles; | 176 std::vector<Tile*> tiles; |
| 180 for (auto& tile_pair : tiles_) | 177 for (auto& tile_pair : tiles_) |
| 181 tiles.push_back(tile_pair.second); | 178 tiles.push_back(tile_pair.second); |
| 182 return tiles; | 179 return tiles; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 PrioritizedWorkToSchedule AssignGpuMemoryToTiles(); | 287 PrioritizedWorkToSchedule AssignGpuMemoryToTiles(); |
| 291 void ScheduleTasks(const PrioritizedWorkToSchedule& work_to_schedule); | 288 void ScheduleTasks(const PrioritizedWorkToSchedule& work_to_schedule); |
| 292 | 289 |
| 293 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 290 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
| 294 ScheduledTasksStateAsValue() const; | 291 ScheduledTasksStateAsValue() const; |
| 295 | 292 |
| 296 TileManagerClient* client_; | 293 TileManagerClient* client_; |
| 297 base::SequencedTaskRunner* task_runner_; | 294 base::SequencedTaskRunner* task_runner_; |
| 298 ResourcePool* resource_pool_; | 295 ResourcePool* resource_pool_; |
| 299 TileTaskManager* tile_task_manager_; | 296 TileTaskManager* tile_task_manager_; |
| 300 RasterBufferProvider* raster_buffer_provider_; | |
| 301 GlobalStateThatImpactsTilePriority global_state_; | 297 GlobalStateThatImpactsTilePriority global_state_; |
| 302 size_t scheduled_raster_task_limit_; | 298 size_t scheduled_raster_task_limit_; |
| 303 const bool use_partial_raster_; | 299 const bool use_partial_raster_; |
| 304 bool use_gpu_rasterization_; | 300 bool use_gpu_rasterization_; |
| 305 | 301 |
| 306 std::unordered_map<Tile::Id, Tile*> tiles_; | 302 std::unordered_map<Tile::Id, Tile*> tiles_; |
| 307 | 303 |
| 308 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; | 304 bool all_tiles_that_need_to_be_rasterized_are_scheduled_; |
| 309 MemoryHistory::Entry memory_stats_from_last_assign_; | 305 MemoryHistory::Entry memory_stats_from_last_assign_; |
| 310 | 306 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 340 std::vector<std::pair<DrawImage, scoped_refptr<TileTask>>> locked_images_; | 336 std::vector<std::pair<DrawImage, scoped_refptr<TileTask>>> locked_images_; |
| 341 | 337 |
| 342 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 338 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
| 343 | 339 |
| 344 DISALLOW_COPY_AND_ASSIGN(TileManager); | 340 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 345 }; | 341 }; |
| 346 | 342 |
| 347 } // namespace cc | 343 } // namespace cc |
| 348 | 344 |
| 349 #endif // CC_TILES_TILE_MANAGER_H_ | 345 #endif // CC_TILES_TILE_MANAGER_H_ |
| OLD | NEW |