| 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 // Maintain the list of released resources that can potentially be re-used |
| 599 // or deleted. |
| 600 // If this operation becomes expensive too, only do this after some |
| 601 // resource(s) was returned. Note that in that case, one also need to |
| 602 // invalidate when releasing some resource from the pool. |
| 603 resource_pool_->CheckBusyResources(); |
| 604 |
| 598 // Now give memory out to the tiles until we're out, and build | 605 // Now give memory out to the tiles until we're out, and build |
| 599 // the needs-to-be-rasterized queue. | 606 // the needs-to-be-rasterized queue. |
| 600 all_tiles_that_need_to_be_rasterized_have_memory_ = true; | 607 all_tiles_that_need_to_be_rasterized_have_memory_ = true; |
| 601 all_tiles_required_for_activation_have_memory_ = true; | 608 all_tiles_required_for_activation_have_memory_ = true; |
| 602 | 609 |
| 603 // Cast to prevent overflow. | 610 // Cast to prevent overflow. |
| 604 int64 bytes_available = | 611 int64 bytes_available = |
| 605 static_cast<int64>(bytes_releasable_) + | 612 static_cast<int64>(bytes_releasable_) + |
| 606 static_cast<int64>(global_state_.memory_limit_in_bytes) - | 613 static_cast<int64>(global_state_.memory_limit_in_bytes) - |
| 607 static_cast<int64>(resource_pool_->acquired_memory_usage_bytes()); | 614 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)); | 957 can_use_lcd_text)); |
| 951 DCHECK(tiles_.find(tile->id()) == tiles_.end()); | 958 DCHECK(tiles_.find(tile->id()) == tiles_.end()); |
| 952 | 959 |
| 953 tiles_[tile->id()] = tile; | 960 tiles_[tile->id()] = tile; |
| 954 used_layer_counts_[tile->layer_id()]++; | 961 used_layer_counts_[tile->layer_id()]++; |
| 955 prioritized_tiles_dirty_ = true; | 962 prioritized_tiles_dirty_ = true; |
| 956 return tile; | 963 return tile; |
| 957 } | 964 } |
| 958 | 965 |
| 959 } // namespace cc | 966 } // namespace cc |
| OLD | NEW |