Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: cc/resources/tile_manager.cc

Issue 884453003: cc: Prevent resources from being allocated for solid tiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stop creating resources for solid tiles Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/gpu_rasterizer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « cc/resources/gpu_rasterizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698