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/resources/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 raster_mode = HIGH_QUALITY_NO_LCD_RASTER_MODE; | 588 raster_mode = HIGH_QUALITY_NO_LCD_RASTER_MODE; |
| 589 | 589 |
| 590 return std::min(raster_mode, current_mode); | 590 return std::min(raster_mode, current_mode); |
| 591 } | 591 } |
| 592 | 592 |
| 593 void TileManager::AssignGpuMemoryToTiles( | 593 void TileManager::AssignGpuMemoryToTiles( |
| 594 PrioritizedTileSet* tiles, | 594 PrioritizedTileSet* tiles, |
| 595 TileVector* tiles_that_need_to_be_rasterized) { | 595 TileVector* tiles_that_need_to_be_rasterized) { |
| 596 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles"); | 596 TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles"); |
| 597 | 597 |
| 598 resource_pool_->CheckConsumedResources(); | |
|
piman
2013/10/30 19:35:30
note, if this becomes to expensive to do all the t
reveman
2013/10/30 21:10:28
I think this is good enough for now but a comment
| |
| 599 | |
| 598 // Now give memory out to the tiles until we're out, and build | 600 // Now give memory out to the tiles until we're out, and build |
| 599 // the needs-to-be-rasterized queue. | 601 // the needs-to-be-rasterized queue. |
| 600 all_tiles_that_need_to_be_rasterized_have_memory_ = true; | 602 all_tiles_that_need_to_be_rasterized_have_memory_ = true; |
| 601 all_tiles_required_for_activation_have_memory_ = true; | 603 all_tiles_required_for_activation_have_memory_ = true; |
| 602 | 604 |
| 603 // Cast to prevent overflow. | 605 // Cast to prevent overflow. |
| 604 int64 bytes_available = | 606 int64 bytes_available = |
| 605 static_cast<int64>(bytes_releasable_) + | 607 static_cast<int64>(bytes_releasable_) + |
| 606 static_cast<int64>(global_state_.memory_limit_in_bytes) - | 608 static_cast<int64>(global_state_.memory_limit_in_bytes) - |
| 607 static_cast<int64>(resource_pool_->acquired_memory_usage_bytes()); | 609 static_cast<int64>(resource_pool_->acquired_memory_usage_bytes()); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 950 can_use_lcd_text)); | 952 can_use_lcd_text)); |
| 951 DCHECK(tiles_.find(tile->id()) == tiles_.end()); | 953 DCHECK(tiles_.find(tile->id()) == tiles_.end()); |
| 952 | 954 |
| 953 tiles_[tile->id()] = tile; | 955 tiles_[tile->id()] = tile; |
| 954 used_layer_counts_[tile->layer_id()]++; | 956 used_layer_counts_[tile->layer_id()]++; |
| 955 prioritized_tiles_dirty_ = true; | 957 prioritized_tiles_dirty_ = true; |
| 956 return tile; | 958 return tile; |
| 957 } | 959 } |
| 958 | 960 |
| 959 } // namespace cc | 961 } // namespace cc |
| OLD | NEW |