Chromium Code Reviews| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 | 135 |
| 136 TileManager::~TileManager() { | 136 TileManager::~TileManager() { |
| 137 // Reset global state and manage. This should cause | 137 // Reset global state and manage. This should cause |
| 138 // our memory usage to drop to zero. | 138 // our memory usage to drop to zero. |
| 139 global_state_ = GlobalStateThatImpactsTilePriority(); | 139 global_state_ = GlobalStateThatImpactsTilePriority(); |
| 140 AssignGpuMemoryToTiles(); | 140 AssignGpuMemoryToTiles(); |
| 141 // This should finish all pending tasks and release any uninitialized | 141 // This should finish all pending tasks and release any uninitialized |
| 142 // resources. | 142 // resources. |
| 143 raster_worker_pool_.reset(); | 143 raster_worker_pool_.reset(); |
| 144 CheckForCompletedTileUploads(); | 144 CheckForCompletedTileUploads(); |
| 145 DCHECK(tiles_with_pending_set_pixels_.size() == 0); | 145 DCHECK_EQ(tiles_with_pending_set_pixels_.size(), 0); |
| 146 DCHECK(tiles_.size() == 0); | 146 DCHECK_EQ(all_tiles_.size(), 0); |
| 147 DCHECK_EQ(live_tiles_.size(), 0); | |
| 147 } | 148 } |
| 148 | 149 |
| 149 void TileManager::SetGlobalState( | 150 void TileManager::SetGlobalState( |
| 150 const GlobalStateThatImpactsTilePriority& global_state) { | 151 const GlobalStateThatImpactsTilePriority& global_state) { |
| 151 global_state_ = global_state; | 152 global_state_ = global_state; |
| 152 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); | 153 resource_pool_->SetMaxMemoryUsageBytes(global_state_.memory_limit_in_bytes); |
| 153 ScheduleManageTiles(); | 154 ScheduleManageTiles(); |
| 154 } | 155 } |
| 155 | 156 |
| 156 void TileManager::RegisterTile(Tile* tile) { | 157 void TileManager::RegisterTile(Tile* tile) { |
| 157 tiles_.push_back(tile); | 158 all_tiles_.push_back(tile); |
| 158 | 159 |
| 159 const ManagedTileState& mts = tile->managed_state(); | 160 const ManagedTileState& mts = tile->managed_state(); |
| 160 for (int i = 0; i < NUM_TREES; ++i) | 161 for (int i = 0; i < NUM_TREES; ++i) |
| 161 ++raster_state_count_[mts.raster_state][i][mts.tree_bin[i]]; | 162 ++raster_state_count_[mts.raster_state][i][mts.tree_bin[i]]; |
| 162 | 163 |
| 163 ScheduleManageTiles(); | 164 ScheduleManageTiles(); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void TileManager::UnregisterTile(Tile* tile) { | 167 void TileManager::UnregisterTile(Tile* tile) { |
| 167 for (TileList::iterator it = tiles_with_image_decoding_tasks_.begin(); | 168 for (TileList::iterator it = tiles_with_image_decoding_tasks_.begin(); |
| 168 it != tiles_with_image_decoding_tasks_.end(); it++) { | 169 it != tiles_with_image_decoding_tasks_.end(); it++) { |
| 169 if (*it == tile) { | 170 if (*it == tile) { |
| 170 tiles_with_image_decoding_tasks_.erase(it); | 171 tiles_with_image_decoding_tasks_.erase(it); |
| 171 break; | 172 break; |
| 172 } | 173 } |
| 173 } | 174 } |
| 174 for (TileVector::iterator it = tiles_that_need_to_be_rasterized_.begin(); | 175 for (TileVector::iterator it = tiles_that_need_to_be_rasterized_.begin(); |
| 175 it != tiles_that_need_to_be_rasterized_.end(); it++) { | 176 it != tiles_that_need_to_be_rasterized_.end(); it++) { |
| 176 if (*it == tile) { | 177 if (*it == tile) { |
| 177 tiles_that_need_to_be_rasterized_.erase(it); | 178 tiles_that_need_to_be_rasterized_.erase(it); |
| 178 break; | 179 break; |
| 179 } | 180 } |
| 180 } | 181 } |
| 181 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); it++) { | 182 for (TileVector::iterator it = live_tiles_.begin(); |
| 183 it != live_tiles_.end(); it++) { | |
|
reveman
2013/02/06 03:20:24
nit: test statement should be vertically aligned w
| |
| 184 if (*it == tile) { | |
| 185 live_tiles_.erase(it); | |
| 186 break; | |
| 187 } | |
| 188 } | |
| 189 for (TileVector::iterator it = all_tiles_.begin(); | |
| 190 it != all_tiles_.end(); it++) { | |
|
reveman
2013/02/06 03:20:24
nit: vertical alignment wrong here too
| |
| 182 if (*it == tile) { | 191 if (*it == tile) { |
| 183 const ManagedTileState& mts = tile->managed_state(); | 192 const ManagedTileState& mts = tile->managed_state(); |
| 184 for (int i = 0; i < NUM_TREES; ++i) | 193 for (int i = 0; i < NUM_TREES; ++i) |
| 185 --raster_state_count_[mts.raster_state][i][mts.tree_bin[i]]; | 194 --raster_state_count_[mts.raster_state][i][mts.tree_bin[i]]; |
| 186 FreeResourcesForTile(tile); | 195 FreeResourcesForTile(tile); |
| 187 tiles_.erase(it); | 196 all_tiles_.erase(it); |
| 188 return; | 197 return; |
| 189 } | 198 } |
| 190 } | 199 } |
| 191 DCHECK(false) << "Could not find tile version."; | 200 DCHECK(false) << "Could not find tile version."; |
| 192 } | 201 } |
| 193 | 202 |
| 194 class BinComparator { | 203 class BinComparator { |
| 195 public: | 204 public: |
| 196 bool operator() (const Tile* a, const Tile* b) const { | 205 bool operator() (const Tile* a, const Tile* b) const { |
| 197 const ManagedTileState& ams = a->managed_state(); | 206 const ManagedTileState& ams = a->managed_state(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 213 if (a_rect.y() != b_rect.y()) | 222 if (a_rect.y() != b_rect.y()) |
| 214 return a_rect.y() < b_rect.y(); | 223 return a_rect.y() < b_rect.y(); |
| 215 return a_rect.x() < b_rect.x(); | 224 return a_rect.x() < b_rect.x(); |
| 216 } | 225 } |
| 217 }; | 226 }; |
| 218 | 227 |
| 219 void TileManager::SortTiles() { | 228 void TileManager::SortTiles() { |
| 220 TRACE_EVENT0("cc", "TileManager::SortTiles"); | 229 TRACE_EVENT0("cc", "TileManager::SortTiles"); |
| 221 | 230 |
| 222 // Sort by bin, resolution and time until needed. | 231 // Sort by bin, resolution and time until needed. |
| 223 std::sort(tiles_.begin(), tiles_.end(), BinComparator()); | 232 std::sort(live_tiles_.begin(), live_tiles_.end(), BinComparator()); |
| 224 } | 233 } |
| 225 | 234 |
| 226 void TileManager::ManageTiles() { | 235 void TileManager::ManageTiles() { |
| 227 TRACE_EVENT0("cc", "TileManager::ManageTiles"); | 236 TRACE_EVENT0("cc", "TileManager::ManageTiles"); |
| 228 manage_tiles_pending_ = false; | 237 manage_tiles_pending_ = false; |
| 229 ++manage_tiles_call_count_; | 238 ++manage_tiles_call_count_; |
| 230 | 239 |
| 231 const TreePriority tree_priority = global_state_.tree_priority; | 240 const TreePriority tree_priority = global_state_.tree_priority; |
| 232 TRACE_COUNTER_ID1("cc", "TileCount", this, tiles_.size()); | 241 TRACE_COUNTER_ID1("cc", "AllTileCount", this, all_tiles_.size()); |
| 242 | |
| 243 live_tiles_.clear(); | |
| 244 for (TileVector::iterator it = all_tiles_.begin(); | |
| 245 it != all_tiles_.end(); ++it) { | |
|
reveman
2013/02/06 03:20:24
nit: vertical alignment
| |
| 246 if ((*it)->priority( ACTIVE_TREE).is_live || | |
| 247 (*it)->priority(PENDING_TREE).is_live) | |
| 248 live_tiles_.push_back(*it); | |
| 249 } | |
| 250 | |
| 251 TRACE_COUNTER_ID1("cc", "LiveTileCount", this, live_tiles_.size()); | |
| 233 | 252 |
| 234 // For each tree, bin into different categories of tiles. | 253 // For each tree, bin into different categories of tiles. |
| 235 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 254 for (TileVector::iterator it = live_tiles_.begin(); |
| 255 it != live_tiles_.end(); ++it) { | |
|
reveman
2013/02/06 03:20:24
nit: vertical alignment
| |
| 236 Tile* tile = *it; | 256 Tile* tile = *it; |
| 237 ManagedTileState& mts = tile->managed_state(); | 257 ManagedTileState& mts = tile->managed_state(); |
| 238 | 258 |
| 239 TilePriority prio[NUM_BIN_PRIORITIES]; | 259 TilePriority prio[NUM_BIN_PRIORITIES]; |
| 240 switch (tree_priority) { | 260 switch (tree_priority) { |
| 241 case SAME_PRIORITY_FOR_BOTH_TREES: | 261 case SAME_PRIORITY_FOR_BOTH_TREES: |
| 242 prio[HIGH_PRIORITY_BIN] = prio[LOW_PRIORITY_BIN] = | 262 prio[HIGH_PRIORITY_BIN] = prio[LOW_PRIORITY_BIN] = |
| 243 tile->combined_priority(); | 263 tile->combined_priority(); |
| 244 break; | 264 break; |
| 245 case SMOOTHNESS_TAKES_PRIORITY: | 265 case SMOOTHNESS_TAKES_PRIORITY: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 bin_map[NOW_BIN] = NOW_BIN; | 303 bin_map[NOW_BIN] = NOW_BIN; |
| 284 bin_map[SOON_BIN] = SOON_BIN; | 304 bin_map[SOON_BIN] = SOON_BIN; |
| 285 bin_map[EVENTUALLY_BIN] = NEVER_BIN; | 305 bin_map[EVENTUALLY_BIN] = NEVER_BIN; |
| 286 bin_map[NEVER_BIN] = NEVER_BIN; | 306 bin_map[NEVER_BIN] = NEVER_BIN; |
| 287 } else { | 307 } else { |
| 288 bin_map[NOW_BIN] = NOW_BIN; | 308 bin_map[NOW_BIN] = NOW_BIN; |
| 289 bin_map[SOON_BIN] = SOON_BIN; | 309 bin_map[SOON_BIN] = SOON_BIN; |
| 290 bin_map[EVENTUALLY_BIN] = EVENTUALLY_BIN; | 310 bin_map[EVENTUALLY_BIN] = EVENTUALLY_BIN; |
| 291 bin_map[NEVER_BIN] = NEVER_BIN; | 311 bin_map[NEVER_BIN] = NEVER_BIN; |
| 292 } | 312 } |
| 293 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 313 for (TileVector::iterator it = live_tiles_.begin(); |
| 314 it != live_tiles_.end(); ++it) { | |
|
reveman
2013/02/06 03:20:24
nit: vertical alignment
| |
| 294 Tile* tile = *it; | 315 Tile* tile = *it; |
| 295 ManagedTileState& mts = tile->managed_state(); | 316 ManagedTileState& mts = tile->managed_state(); |
| 296 for (int i = 0; i < NUM_BIN_PRIORITIES; ++i) | 317 for (int i = 0; i < NUM_BIN_PRIORITIES; ++i) |
| 297 mts.bin[i] = bin_map[mts.bin[i]]; | 318 mts.bin[i] = bin_map[mts.bin[i]]; |
| 298 | 319 |
| 299 DidTileBinChange(tile, bin_map[mts.tree_bin[ACTIVE_TREE]], ACTIVE_TREE); | 320 DidTileBinChange(tile, bin_map[mts.tree_bin[ACTIVE_TREE]], ACTIVE_TREE); |
| 300 DidTileBinChange(tile, bin_map[mts.tree_bin[PENDING_TREE]], PENDING_TREE); | 321 DidTileBinChange(tile, bin_map[mts.tree_bin[PENDING_TREE]], PENDING_TREE); |
| 301 } | 322 } |
| 302 | 323 |
| 303 SortTiles(); | 324 SortTiles(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 DispatchMoreTasks(); | 361 DispatchMoreTasks(); |
| 341 } | 362 } |
| 342 | 363 |
| 343 void TileManager::GetMemoryStats( | 364 void TileManager::GetMemoryStats( |
| 344 size_t* memoryRequiredBytes, | 365 size_t* memoryRequiredBytes, |
| 345 size_t* memoryNiceToHaveBytes, | 366 size_t* memoryNiceToHaveBytes, |
| 346 size_t* memoryUsedBytes) const { | 367 size_t* memoryUsedBytes) const { |
| 347 *memoryRequiredBytes = 0; | 368 *memoryRequiredBytes = 0; |
| 348 *memoryNiceToHaveBytes = 0; | 369 *memoryNiceToHaveBytes = 0; |
| 349 *memoryUsedBytes = 0; | 370 *memoryUsedBytes = 0; |
| 350 for(size_t i = 0; i < tiles_.size(); i++) { | 371 for(size_t i = 0; i < all_tiles_.size(); i++) { |
|
reveman
2013/02/06 03:20:24
nit: missing space before ( in for(
| |
| 351 const Tile* tile = tiles_[i]; | 372 const Tile* tile = all_tiles_[i]; |
| 352 const ManagedTileState& mts = tile->managed_state(); | 373 const ManagedTileState& mts = tile->managed_state(); |
| 353 size_t tile_bytes = tile->bytes_consumed_if_allocated(); | 374 size_t tile_bytes = tile->bytes_consumed_if_allocated(); |
| 354 if (mts.gpu_memmgr_stats_bin == NOW_BIN) | 375 if (mts.gpu_memmgr_stats_bin == NOW_BIN) |
| 355 *memoryRequiredBytes += tile_bytes; | 376 *memoryRequiredBytes += tile_bytes; |
| 356 if (mts.gpu_memmgr_stats_bin != NEVER_BIN) | 377 if (mts.gpu_memmgr_stats_bin != NEVER_BIN) |
| 357 *memoryNiceToHaveBytes += tile_bytes; | 378 *memoryNiceToHaveBytes += tile_bytes; |
| 358 if (mts.can_use_gpu_memory) | 379 if (mts.can_use_gpu_memory) |
| 359 *memoryUsedBytes += tile_bytes; | 380 *memoryUsedBytes += tile_bytes; |
| 360 } | 381 } |
| 361 } | 382 } |
| 362 | 383 |
| 363 scoped_ptr<base::Value> TileManager::AsValue() const { | 384 scoped_ptr<base::Value> TileManager::AsValue() const { |
| 364 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 385 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 365 state->SetInteger("tile_count", tiles_.size()); | 386 state->SetInteger("all_tile_count", all_tiles_.size()); |
| 387 state->SetInteger("live_tile_count", live_tiles_.size()); | |
| 366 | 388 |
| 367 state->Set("global_state", global_state_.AsValue().release()); | 389 state->Set("global_state", global_state_.AsValue().release()); |
| 368 | 390 |
| 369 state->Set("memory_requirements", GetMemoryRequirementsAsValue().release()); | 391 state->Set("memory_requirements", GetMemoryRequirementsAsValue().release()); |
| 370 return state.PassAs<base::Value>(); | 392 return state.PassAs<base::Value>(); |
| 371 } | 393 } |
| 372 | 394 |
| 373 scoped_ptr<base::Value> TileManager::GetMemoryRequirementsAsValue() const { | 395 scoped_ptr<base::Value> TileManager::GetMemoryRequirementsAsValue() const { |
| 374 scoped_ptr<base::DictionaryValue> requirements( | 396 scoped_ptr<base::DictionaryValue> requirements( |
| 375 new base::DictionaryValue()); | 397 new base::DictionaryValue()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 } | 440 } |
| 419 } | 441 } |
| 420 | 442 |
| 421 return false; | 443 return false; |
| 422 } | 444 } |
| 423 | 445 |
| 424 void TileManager::AssignGpuMemoryToTiles() { | 446 void TileManager::AssignGpuMemoryToTiles() { |
| 425 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles"); | 447 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles"); |
| 426 // Some memory cannot be released. Figure out which. | 448 // Some memory cannot be released. Figure out which. |
| 427 size_t unreleasable_bytes = 0; | 449 size_t unreleasable_bytes = 0; |
| 428 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 450 for (TileVector::iterator it = all_tiles_.begin(); |
| 451 it != all_tiles_.end(); ++it) { | |
|
reveman
2013/02/06 03:20:24
nit: vertical alignment
| |
| 429 Tile* tile = *it; | 452 Tile* tile = *it; |
| 430 if (!tile->managed_state().can_be_freed) | 453 if (!tile->managed_state().can_be_freed) |
| 431 unreleasable_bytes += tile->bytes_consumed_if_allocated(); | 454 unreleasable_bytes += tile->bytes_consumed_if_allocated(); |
| 432 } | 455 } |
| 433 | 456 |
| 434 // Now give memory out to the tiles until we're out, and build | 457 // Now give memory out to the tiles until we're out, and build |
| 435 // the needs-to-be-rasterized queue. | 458 // the needs-to-be-rasterized queue. |
| 436 tiles_that_need_to_be_rasterized_.erase( | 459 tiles_that_need_to_be_rasterized_.clear(); |
| 437 tiles_that_need_to_be_rasterized_.begin(), | |
| 438 tiles_that_need_to_be_rasterized_.end()); | |
| 439 | 460 |
| 440 // Reset the image decoding list so that we don't mess up with tile | 461 // Reset the image decoding list so that we don't mess up with tile |
| 441 // priorities. Tiles will be added to the image decoding list again | 462 // priorities. Tiles will be added to the image decoding list again |
| 442 // when DispatchMoreTasks() is called. | 463 // when DispatchMoreTasks() is called. |
| 443 tiles_with_image_decoding_tasks_.clear(); | 464 tiles_with_image_decoding_tasks_.clear(); |
| 444 | 465 |
| 445 // By clearing the tiles_that_need_to_be_rasterized_ vector and | 466 // By clearing the tiles_that_need_to_be_rasterized_ vector and |
| 446 // tiles_with_image_decoding_tasks_ list above we move all tiles | 467 // tiles_with_image_decoding_tasks_ list above we move all tiles |
| 447 // currently waiting for raster to idle state. | 468 // currently waiting for raster to idle state. |
| 448 // Call DidTileRasterStateChange() for each of these tiles to | 469 // Call DidTileRasterStateChange() for each of these tiles to |
| 449 // have this state change take effect. | 470 // have this state change take effect. |
| 450 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 471 for (TileVector::iterator it = all_tiles_.begin(); |
| 472 it != all_tiles_.end(); ++it) { | |
|
reveman
2013/02/06 03:20:24
nit: vertical alignment
| |
| 451 Tile* tile = *it; | 473 Tile* tile = *it; |
| 452 if (tile->managed_state().raster_state == WAITING_FOR_RASTER_STATE) | 474 if (tile->managed_state().raster_state == WAITING_FOR_RASTER_STATE) |
| 453 DidTileRasterStateChange(tile, IDLE_STATE); | 475 DidTileRasterStateChange(tile, IDLE_STATE); |
| 454 } | 476 } |
| 455 | 477 |
| 478 for (TileVector::iterator it = all_tiles_.begin(); | |
| 479 it != all_tiles_.end(); ++it) { | |
|
reveman
2013/02/06 03:20:24
nit: vertical alignment
| |
| 480 Tile* tile = *it; | |
| 481 ManagedTileState& managed_tile_state = tile->managed_state(); | |
| 482 if (!managed_tile_state.can_be_freed) | |
| 483 continue; | |
| 484 managed_tile_state.can_use_gpu_memory = false; | |
| 485 } | |
| 486 | |
| 456 size_t bytes_allocatable = global_state_.memory_limit_in_bytes - unreleasable_ bytes; | 487 size_t bytes_allocatable = global_state_.memory_limit_in_bytes - unreleasable_ bytes; |
| 457 size_t bytes_that_exceeded_memory_budget = 0; | 488 size_t bytes_that_exceeded_memory_budget = 0; |
| 458 size_t bytes_left = bytes_allocatable; | 489 size_t bytes_left = bytes_allocatable; |
| 459 for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 490 for (TileVector::iterator it = live_tiles_.begin(); |
| 491 it != live_tiles_.end(); ++it) { | |
|
reveman
2013/02/06 03:20:24
nit: vertical alignment
| |
| 460 Tile* tile = *it; | 492 Tile* tile = *it; |
| 461 size_t tile_bytes = tile->bytes_consumed_if_allocated(); | 493 size_t tile_bytes = tile->bytes_consumed_if_allocated(); |
| 462 ManagedTileState& managed_tile_state = tile->managed_state(); | 494 ManagedTileState& managed_tile_state = tile->managed_state(); |
| 463 if (!managed_tile_state.can_be_freed) | 495 if (!managed_tile_state.can_be_freed) |
| 464 continue; | 496 continue; |
| 465 if (managed_tile_state.bin[HIGH_PRIORITY_BIN] == NEVER_BIN && | 497 if (managed_tile_state.bin[HIGH_PRIORITY_BIN] == NEVER_BIN && |
| 466 managed_tile_state.bin[LOW_PRIORITY_BIN] == NEVER_BIN) { | 498 managed_tile_state.bin[LOW_PRIORITY_BIN] == NEVER_BIN) { |
| 467 managed_tile_state.can_use_gpu_memory = false; | |
| 468 FreeResourcesForTile(tile); | |
| 469 continue; | 499 continue; |
| 470 } | 500 } |
| 471 if (tile_bytes > bytes_left) { | 501 if (tile_bytes > bytes_left) { |
| 472 managed_tile_state.can_use_gpu_memory = false; | |
| 473 bytes_that_exceeded_memory_budget += tile_bytes; | 502 bytes_that_exceeded_memory_budget += tile_bytes; |
| 474 FreeResourcesForTile(tile); | |
| 475 continue; | 503 continue; |
| 476 } | 504 } |
| 477 bytes_left -= tile_bytes; | 505 bytes_left -= tile_bytes; |
| 478 managed_tile_state.can_use_gpu_memory = true; | 506 managed_tile_state.can_use_gpu_memory = true; |
| 479 if (!managed_tile_state.resource && | 507 if (!managed_tile_state.resource && |
| 480 !managed_tile_state.resource_is_being_initialized) { | 508 !managed_tile_state.resource_is_being_initialized) { |
| 481 tiles_that_need_to_be_rasterized_.push_back(tile); | 509 tiles_that_need_to_be_rasterized_.push_back(tile); |
| 482 DidTileRasterStateChange(tile, WAITING_FOR_RASTER_STATE); | 510 DidTileRasterStateChange(tile, WAITING_FOR_RASTER_STATE); |
| 483 } | 511 } |
| 484 } | 512 } |
| 485 | 513 |
| 514 for (TileVector::iterator it = all_tiles_.begin(); | |
| 515 it != all_tiles_.end(); ++it) { | |
|
reveman
2013/02/06 03:20:24
nit: vertical alignment
| |
| 516 Tile* tile = *it; | |
| 517 ManagedTileState& managed_tile_state = tile->managed_state(); | |
| 518 if (!managed_tile_state.can_be_freed) | |
| 519 continue; | |
| 520 if (!managed_tile_state.can_use_gpu_memory) | |
| 521 FreeResourcesForTile(tile); | |
| 522 } | |
| 523 | |
| 524 | |
|
reveman
2013/02/06 03:20:24
nit: extra blank line
| |
| 486 ever_exceeded_memory_budget_ |= bytes_that_exceeded_memory_budget > 0; | 525 ever_exceeded_memory_budget_ |= bytes_that_exceeded_memory_budget > 0; |
| 487 if (ever_exceeded_memory_budget_) { | 526 if (ever_exceeded_memory_budget_) { |
| 488 TRACE_COUNTER_ID2("cc", "over_memory_budget", this, | 527 TRACE_COUNTER_ID2("cc", "over_memory_budget", this, |
| 489 "budget", global_state_.memory_limit_in_bytes, | 528 "budget", global_state_.memory_limit_in_bytes, |
| 490 "over", bytes_that_exceeded_memory_budget); | 529 "over", bytes_that_exceeded_memory_budget); |
| 491 } | 530 } |
| 492 memory_stats_from_last_assign_.bytes_allocated = | 531 memory_stats_from_last_assign_.bytes_allocated = |
| 493 bytes_allocatable - bytes_left; | 532 bytes_allocatable - bytes_left; |
| 494 memory_stats_from_last_assign_.bytes_unreleasable = unreleasable_bytes; | 533 memory_stats_from_last_assign_.bytes_unreleasable = unreleasable_bytes; |
| 495 memory_stats_from_last_assign_.bytes_over = | 534 memory_stats_from_last_assign_.bytes_over = |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 791 decode_begin_time = base::TimeTicks::Now(); | 830 decode_begin_time = base::TimeTicks::Now(); |
| 792 pixel_ref->Decode(); | 831 pixel_ref->Decode(); |
| 793 if (stats) { | 832 if (stats) { |
| 794 stats->totalDeferredImageDecodeCount++; | 833 stats->totalDeferredImageDecodeCount++; |
| 795 stats->totalDeferredImageDecodeTime += | 834 stats->totalDeferredImageDecodeTime += |
| 796 base::TimeTicks::Now() - decode_begin_time; | 835 base::TimeTicks::Now() - decode_begin_time; |
| 797 } | 836 } |
| 798 } | 837 } |
| 799 | 838 |
| 800 } // namespace cc | 839 } // namespace cc |
| OLD | NEW |