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 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 { |
| 835 draw_info.set_use_resource(); | 836 draw_info.set_use_resource(); |
| 836 draw_info.resource_ = resource.Pass(); | 837 draw_info.resource_ = resource.Pass(); |
|
vmpstr
2015/01/27 18:33:27
DCHECK(resource) for the else case please.
| |
| 837 } | 838 } |
| 838 | 839 |
| 839 client_->NotifyTileStateChanged(tile); | 840 client_->NotifyTileStateChanged(tile); |
| 840 } | 841 } |
| 841 | 842 |
| 842 scoped_refptr<Tile> TileManager::CreateTile( | 843 scoped_refptr<Tile> TileManager::CreateTile( |
| 843 RasterSource* raster_source, | 844 RasterSource* raster_source, |
| 844 const gfx::Size& desired_texture_size, | 845 const gfx::Size& desired_texture_size, |
| 845 const gfx::Rect& content_rect, | 846 const gfx::Rect& content_rect, |
| 846 float contents_scale, | 847 float contents_scale, |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1041 result -= other; | 1042 result -= other; |
| 1042 return result; | 1043 return result; |
| 1043 } | 1044 } |
| 1044 | 1045 |
| 1045 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { | 1046 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { |
| 1046 return memory_bytes_ > limit.memory_bytes_ || | 1047 return memory_bytes_ > limit.memory_bytes_ || |
| 1047 resource_count_ > limit.resource_count_; | 1048 resource_count_ > limit.resource_count_; |
| 1048 } | 1049 } |
| 1049 | 1050 |
| 1050 } // namespace cc | 1051 } // namespace cc |
| OLD | NEW |