| 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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 resource_pool_->ReleaseResource(resource.Pass()); | 744 resource_pool_->ReleaseResource(resource.Pass()); |
| 745 } else { | 745 } else { |
| 746 DCHECK(resource); | 746 DCHECK(resource); |
| 747 draw_info.set_use_resource(); | 747 draw_info.set_use_resource(); |
| 748 draw_info.resource_ = resource.Pass(); | 748 draw_info.resource_ = resource.Pass(); |
| 749 } | 749 } |
| 750 | 750 |
| 751 client_->NotifyTileStateChanged(tile); | 751 client_->NotifyTileStateChanged(tile); |
| 752 } | 752 } |
| 753 | 753 |
| 754 ScopedTilePtr TileManager::CreateTile(RasterSource* raster_source, | 754 ScopedTilePtr TileManager::CreateTile(const gfx::Size& desired_texture_size, |
| 755 const gfx::Size& desired_texture_size, | |
| 756 const gfx::Rect& content_rect, | 755 const gfx::Rect& content_rect, |
| 757 float contents_scale, | 756 float contents_scale, |
| 758 int layer_id, | 757 int layer_id, |
| 759 int source_frame_number, | 758 int source_frame_number, |
| 760 int flags) { | 759 int flags) { |
| 761 ScopedTilePtr tile(new Tile(this, raster_source, desired_texture_size, | 760 ScopedTilePtr tile(new Tile(this, desired_texture_size, content_rect, |
| 762 content_rect, contents_scale, layer_id, | 761 contents_scale, layer_id, source_frame_number, |
| 763 source_frame_number, flags)); | 762 flags)); |
| 764 DCHECK(tiles_.find(tile->id()) == tiles_.end()); | 763 DCHECK(tiles_.find(tile->id()) == tiles_.end()); |
| 765 | 764 |
| 766 tiles_[tile->id()] = tile.get(); | 765 tiles_[tile->id()] = tile.get(); |
| 767 used_layer_counts_[tile->layer_id()]++; | 766 used_layer_counts_[tile->layer_id()]++; |
| 768 return tile; | 767 return tile; |
| 769 } | 768 } |
| 770 | 769 |
| 771 void TileManager::SetTileTaskRunnerForTesting( | 770 void TileManager::SetTileTaskRunnerForTesting( |
| 772 TileTaskRunner* tile_task_runner) { | 771 TileTaskRunner* tile_task_runner) { |
| 773 tile_task_runner_ = tile_task_runner; | 772 tile_task_runner_ = tile_task_runner; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 result -= other; | 965 result -= other; |
| 967 return result; | 966 return result; |
| 968 } | 967 } |
| 969 | 968 |
| 970 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 969 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
| 971 return memory_bytes_ > limit.memory_bytes_ || | 970 return memory_bytes_ > limit.memory_bytes_ || |
| 972 resource_count_ > limit.resource_count_; | 971 resource_count_ > limit.resource_count_; |
| 973 } | 972 } |
| 974 | 973 |
| 975 } // namespace cc | 974 } // namespace cc |
| OLD | NEW |