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 #include "cc/tile_manager.h" | 5 #include "cc/tile_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 82 } |
83 | 83 |
84 TileManager::~TileManager() { | 84 TileManager::~TileManager() { |
85 // Reset global state and manage. This should cause | 85 // Reset global state and manage. This should cause |
86 // our memory usage to drop to zero. | 86 // our memory usage to drop to zero. |
87 global_state_ = GlobalStateThatImpactsTilePriority(); | 87 global_state_ = GlobalStateThatImpactsTilePriority(); |
88 AssignGpuMemoryToTiles(); | 88 AssignGpuMemoryToTiles(); |
89 // This should finish all pending tasks and release any uninitialized | 89 // This should finish all pending tasks and release any uninitialized |
90 // resources. | 90 // resources. |
91 raster_worker_pool_.reset(); | 91 raster_worker_pool_.reset(); |
92 CheckForCompletedTextures(); | 92 CheckForCompletedTileUploads(); |
93 DCHECK(tiles_with_pending_set_pixels_.size() == 0); | 93 DCHECK(tiles_with_pending_set_pixels_.size() == 0); |
94 DCHECK(tiles_.size() == 0); | 94 DCHECK(tiles_.size() == 0); |
95 } | 95 } |
96 | 96 |
97 void TileManager::SetGlobalState( | 97 void TileManager::SetGlobalState( |
98 const GlobalStateThatImpactsTilePriority& global_state) { | 98 const GlobalStateThatImpactsTilePriority& global_state) { |
99 global_state_ = global_state; | 99 global_state_ = global_state; |
100 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); | 100 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); |
101 ScheduleManageTiles(); | 101 ScheduleManageTiles(); |
102 } | 102 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 SortTiles(); | 238 SortTiles(); |
239 | 239 |
240 // Assign gpu memory and determine what tiles need to be rasterized. | 240 // Assign gpu memory and determine what tiles need to be rasterized. |
241 AssignGpuMemoryToTiles(); | 241 AssignGpuMemoryToTiles(); |
242 | 242 |
243 // Finally, kick the rasterizer. | 243 // Finally, kick the rasterizer. |
244 DispatchMoreTasks(); | 244 DispatchMoreTasks(); |
245 } | 245 } |
246 | 246 |
247 void TileManager::CheckForCompletedTextures() { | 247 void TileManager::CheckForCompletedTileUploads() { |
248 while (!tiles_with_pending_set_pixels_.empty()) { | 248 while (!tiles_with_pending_set_pixels_.empty()) { |
249 Tile* tile = tiles_with_pending_set_pixels_.front(); | 249 Tile* tile = tiles_with_pending_set_pixels_.front(); |
250 DCHECK(tile->managed_state().resource); | 250 DCHECK(tile->managed_state().resource); |
251 | 251 |
252 // Set pixel tasks complete in the order they are posted. | 252 // Set pixel tasks complete in the order they are posted. |
253 if (!resource_pool_->resource_provider()->didSetPixelsComplete( | 253 if (!resource_pool_->resource_provider()->didSetPixelsComplete( |
254 tile->managed_state().resource->id())) { | 254 tile->managed_state().resource->id())) { |
255 break; | 255 break; |
256 } | 256 } |
257 | 257 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 } | 537 } |
538 | 538 |
539 void TileManager::DidFinishTileInitialization(Tile* tile) { | 539 void TileManager::DidFinishTileInitialization(Tile* tile) { |
540 ManagedTileState& managed_tile_state = tile->managed_state(); | 540 ManagedTileState& managed_tile_state = tile->managed_state(); |
541 DCHECK(managed_tile_state.resource); | 541 DCHECK(managed_tile_state.resource); |
542 managed_tile_state.resource_is_being_initialized = false; | 542 managed_tile_state.resource_is_being_initialized = false; |
543 managed_tile_state.can_be_freed = true; | 543 managed_tile_state.can_be_freed = true; |
544 } | 544 } |
545 | 545 |
546 } // namespace cc | 546 } // namespace cc |
OLD | NEW |