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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 resource_pool_->ReleaseResource(resource.Pass()); | 756 resource_pool_->ReleaseResource(resource.Pass()); |
757 } else { | 757 } else { |
758 DCHECK(resource); | 758 DCHECK(resource); |
759 draw_info.set_use_resource(); | 759 draw_info.set_use_resource(); |
760 draw_info.resource_ = resource.Pass(); | 760 draw_info.resource_ = resource.Pass(); |
761 } | 761 } |
762 | 762 |
763 client_->NotifyTileStateChanged(tile); | 763 client_->NotifyTileStateChanged(tile); |
764 } | 764 } |
765 | 765 |
766 ScopedTilePtr TileManager::CreateTile(RasterSource* raster_source, | 766 scoped_refptr<Tile> TileManager::CreateTile( |
767 const gfx::Size& desired_texture_size, | 767 RasterSource* raster_source, |
768 const gfx::Rect& content_rect, | 768 const gfx::Size& desired_texture_size, |
769 float contents_scale, | 769 const gfx::Rect& content_rect, |
770 int layer_id, | 770 float contents_scale, |
771 int source_frame_number, | 771 int layer_id, |
772 int flags) { | 772 int source_frame_number, |
773 ScopedTilePtr tile(new Tile(this, raster_source, desired_texture_size, | 773 int flags) { |
774 content_rect, contents_scale, layer_id, | 774 scoped_refptr<Tile> tile = make_scoped_refptr( |
775 source_frame_number, flags)); | 775 new Tile(this, raster_source, desired_texture_size, content_rect, |
| 776 contents_scale, layer_id, source_frame_number, flags)); |
776 DCHECK(tiles_.find(tile->id()) == tiles_.end()); | 777 DCHECK(tiles_.find(tile->id()) == tiles_.end()); |
777 | 778 |
778 tiles_[tile->id()] = tile.get(); | 779 tiles_[tile->id()] = tile.get(); |
779 used_layer_counts_[tile->layer_id()]++; | 780 used_layer_counts_[tile->layer_id()]++; |
780 return tile; | 781 return tile; |
781 } | 782 } |
782 | 783 |
783 void TileManager::SetTileTaskRunnerForTesting( | 784 void TileManager::SetTileTaskRunnerForTesting( |
784 TileTaskRunner* tile_task_runner) { | 785 TileTaskRunner* tile_task_runner) { |
785 tile_task_runner_ = tile_task_runner; | 786 tile_task_runner_ = tile_task_runner; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 result -= other; | 979 result -= other; |
979 return result; | 980 return result; |
980 } | 981 } |
981 | 982 |
982 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 983 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
983 return memory_bytes_ > limit.memory_bytes_ || | 984 return memory_bytes_ > limit.memory_bytes_ || |
984 resource_count_ > limit.resource_count_; | 985 resource_count_ > limit.resource_count_; |
985 } | 986 } |
986 | 987 |
987 } // namespace cc | 988 } // namespace cc |
OLD | NEW |