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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 BasicStateAsValue() const; | 157 BasicStateAsValue() const; |
158 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const; | 158 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const; |
159 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 159 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
160 return memory_stats_from_last_assign_; | 160 return memory_stats_from_last_assign_; |
161 } | 161 } |
162 | 162 |
163 // Public methods for testing. | 163 // Public methods for testing. |
164 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { | 164 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { |
165 for (size_t i = 0; i < tiles.size(); ++i) { | 165 for (size_t i = 0; i < tiles.size(); ++i) { |
166 TileDrawInfo& draw_info = tiles[i]->draw_info(); | 166 TileDrawInfo& draw_info = tiles[i]->draw_info(); |
167 draw_info.set_resource(resource_pool_->AcquireResource( | 167 draw_info.set_resource( |
168 tiles[i]->desired_texture_size(), | 168 resource_pool_->AcquireResource( |
169 raster_buffer_provider_->GetResourceFormat(false), | 169 tiles[i]->desired_texture_size(), |
170 client_->GetRasterColorSpace())); | 170 raster_buffer_provider_->GetResourceFormat(false), |
| 171 client_->GetRasterColorSpace()), |
| 172 false); |
171 draw_info.set_resource_ready_for_draw(); | 173 draw_info.set_resource_ready_for_draw(); |
172 } | 174 } |
173 } | 175 } |
174 | 176 |
175 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { | 177 void ReleaseTileResourcesForTesting(const std::vector<Tile*>& tiles) { |
176 for (size_t i = 0; i < tiles.size(); ++i) { | 178 for (size_t i = 0; i < tiles.size(); ++i) { |
177 Tile* tile = tiles[i]; | 179 Tile* tile = tiles[i]; |
178 FreeResourcesForTile(tile); | 180 FreeResourcesForTile(tile); |
179 } | 181 } |
180 } | 182 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 bool did_notify_all_tile_tasks_completed; | 271 bool did_notify_all_tile_tasks_completed; |
270 }; | 272 }; |
271 | 273 |
272 struct PrioritizedWorkToSchedule { | 274 struct PrioritizedWorkToSchedule { |
273 PrioritizedWorkToSchedule(); | 275 PrioritizedWorkToSchedule(); |
274 PrioritizedWorkToSchedule(PrioritizedWorkToSchedule&& other); | 276 PrioritizedWorkToSchedule(PrioritizedWorkToSchedule&& other); |
275 ~PrioritizedWorkToSchedule(); | 277 ~PrioritizedWorkToSchedule(); |
276 | 278 |
277 std::vector<PrioritizedTile> tiles_to_raster; | 279 std::vector<PrioritizedTile> tiles_to_raster; |
278 std::vector<PrioritizedTile> tiles_to_process_for_images; | 280 std::vector<PrioritizedTile> tiles_to_process_for_images; |
| 281 CheckerImageTracker::ImageDecodeQueue checker_image_decode_queue; |
279 }; | 282 }; |
280 | 283 |
281 void FreeResourcesForTile(Tile* tile); | 284 void FreeResourcesForTile(Tile* tile); |
282 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); | 285 void FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(Tile* tile); |
283 scoped_refptr<TileTask> CreateRasterTask( | 286 scoped_refptr<TileTask> CreateRasterTask( |
284 const PrioritizedTile& prioritized_tile, | 287 const PrioritizedTile& prioritized_tile, |
285 const gfx::ColorSpace& color_space); | 288 const gfx::ColorSpace& color_space, |
| 289 CheckerImageTracker::ImageDecodeQueue* checker_image_decode_queue); |
286 | 290 |
287 std::unique_ptr<EvictionTilePriorityQueue> | 291 std::unique_ptr<EvictionTilePriorityQueue> |
288 FreeTileResourcesUntilUsageIsWithinLimit( | 292 FreeTileResourcesUntilUsageIsWithinLimit( |
289 std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 293 std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
290 const MemoryUsage& limit, | 294 const MemoryUsage& limit, |
291 MemoryUsage* usage); | 295 MemoryUsage* usage); |
292 std::unique_ptr<EvictionTilePriorityQueue> | 296 std::unique_ptr<EvictionTilePriorityQueue> |
293 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( | 297 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( |
294 std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue, | 298 std::unique_ptr<EvictionTilePriorityQueue> eviction_priority_queue, |
295 const MemoryUsage& limit, | 299 const MemoryUsage& limit, |
(...skipping 11 matching lines...) Expand all Loading... |
307 | 311 |
308 void DidFinishRunningTileTasksRequiredForActivation(); | 312 void DidFinishRunningTileTasksRequiredForActivation(); |
309 void DidFinishRunningTileTasksRequiredForDraw(); | 313 void DidFinishRunningTileTasksRequiredForDraw(); |
310 void DidFinishRunningAllTileTasks(); | 314 void DidFinishRunningAllTileTasks(); |
311 | 315 |
312 scoped_refptr<TileTask> CreateTaskSetFinishedTask( | 316 scoped_refptr<TileTask> CreateTaskSetFinishedTask( |
313 void (TileManager::*callback)()); | 317 void (TileManager::*callback)()); |
314 PrioritizedWorkToSchedule AssignGpuMemoryToTiles(); | 318 PrioritizedWorkToSchedule AssignGpuMemoryToTiles(); |
315 void ScheduleTasks(const PrioritizedWorkToSchedule& work_to_schedule); | 319 void ScheduleTasks(const PrioritizedWorkToSchedule& work_to_schedule); |
316 | 320 |
| 321 void EnsureImageAnalysisPerformed(const PrioritizedTile& prioritized_tile); |
| 322 |
317 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> | 323 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> |
318 ScheduledTasksStateAsValue() const; | 324 ScheduledTasksStateAsValue() const; |
319 | 325 |
320 bool UsePartialRaster() const; | 326 bool UsePartialRaster() const; |
321 | 327 |
322 void CheckPendingGpuWorkTiles(bool issue_signals); | 328 void CheckPendingGpuWorkTiles(bool issue_signals); |
323 | 329 |
324 TileManagerClient* client_; | 330 TileManagerClient* client_; |
325 base::SequencedTaskRunner* task_runner_; | 331 base::SequencedTaskRunner* task_runner_; |
326 ResourcePool* resource_pool_; | 332 ResourcePool* resource_pool_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; | 381 base::WeakPtrFactory<TileManager> task_set_finished_weak_ptr_factory_; |
376 // The |ready_to_draw_callback_weak_ptr_factory_| is never invalidated. | 382 // The |ready_to_draw_callback_weak_ptr_factory_| is never invalidated. |
377 base::WeakPtrFactory<TileManager> ready_to_draw_callback_weak_ptr_factory_; | 383 base::WeakPtrFactory<TileManager> ready_to_draw_callback_weak_ptr_factory_; |
378 | 384 |
379 DISALLOW_COPY_AND_ASSIGN(TileManager); | 385 DISALLOW_COPY_AND_ASSIGN(TileManager); |
380 }; | 386 }; |
381 | 387 |
382 } // namespace cc | 388 } // namespace cc |
383 | 389 |
384 #endif // CC_TILES_TILE_MANAGER_H_ | 390 #endif // CC_TILES_TILE_MANAGER_H_ |
OLD | NEW |