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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 void TileManager::UpdateTileDrawInfo( | 823 void TileManager::UpdateTileDrawInfo( |
824 Tile* tile, | 824 Tile* tile, |
825 scoped_ptr<ScopedResource> resource, | 825 scoped_ptr<ScopedResource> resource, |
826 const RasterSource::SolidColorAnalysis& analysis) { | 826 const RasterSource::SolidColorAnalysis& analysis) { |
827 TileDrawInfo& draw_info = tile->draw_info(); | 827 TileDrawInfo& draw_info = tile->draw_info(); |
828 | 828 |
829 ++update_visible_tiles_stats_.completed_count; | 829 ++update_visible_tiles_stats_.completed_count; |
830 | 830 |
831 if (analysis.is_solid_color) { | 831 if (analysis.is_solid_color) { |
832 draw_info.set_solid_color(analysis.solid_color); | 832 draw_info.set_solid_color(analysis.solid_color); |
833 resource_pool_->ReleaseResource(resource.Pass()); | 833 if (resource) |
| 834 resource_pool_->ReleaseResource(resource.Pass()); |
834 } else { | 835 } else { |
| 836 DCHECK(resource); |
835 draw_info.set_use_resource(); | 837 draw_info.set_use_resource(); |
836 draw_info.resource_ = resource.Pass(); | 838 draw_info.resource_ = resource.Pass(); |
837 } | 839 } |
838 | 840 |
839 client_->NotifyTileStateChanged(tile); | 841 client_->NotifyTileStateChanged(tile); |
840 } | 842 } |
841 | 843 |
842 scoped_refptr<Tile> TileManager::CreateTile( | 844 scoped_refptr<Tile> TileManager::CreateTile( |
843 RasterSource* raster_source, | 845 RasterSource* raster_source, |
844 const gfx::Size& desired_texture_size, | 846 const gfx::Size& desired_texture_size, |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 result -= other; | 1043 result -= other; |
1042 return result; | 1044 return result; |
1043 } | 1045 } |
1044 | 1046 |
1045 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 1047 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
1046 return memory_bytes_ > limit.memory_bytes_ || | 1048 return memory_bytes_ > limit.memory_bytes_ || |
1047 resource_count_ > limit.resource_count_; | 1049 resource_count_ > limit.resource_count_; |
1048 } | 1050 } |
1049 | 1051 |
1050 } // namespace cc | 1052 } // namespace cc |
OLD | NEW |