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

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

Issue 1202843008: cc: Fix BytesPerPixel issue and refactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments. Created 5 years, 5 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
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/tiles/tile_manager.h" 5 #include "cc/tiles/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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 DCHECK_LE(memory_bytes, 1018 DCHECK_LE(memory_bytes,
1019 static_cast<size_t>(std::numeric_limits<int64>::max())); 1019 static_cast<size_t>(std::numeric_limits<int64>::max()));
1020 DCHECK_LE(resource_count, 1020 DCHECK_LE(resource_count,
1021 static_cast<size_t>(std::numeric_limits<int>::max())); 1021 static_cast<size_t>(std::numeric_limits<int>::max()));
1022 } 1022 }
1023 1023
1024 // static 1024 // static
1025 TileManager::MemoryUsage TileManager::MemoryUsage::FromConfig( 1025 TileManager::MemoryUsage TileManager::MemoryUsage::FromConfig(
1026 const gfx::Size& size, 1026 const gfx::Size& size,
1027 ResourceFormat format) { 1027 ResourceFormat format) {
1028 // We can use UncheckedMemorySizeBytes here since this is used with a tile 1028 // We can use UncheckedSizeInBytes here since this is used with a tile
1029 // size which is determined by the compositor (it's at most max texture size). 1029 // size which is determined by the compositor (it's at most max texture size).
1030 return MemoryUsage(Resource::UncheckedMemorySizeBytes(size, format), 1); 1030 return MemoryUsage(ResourceUtil::UncheckedSizeInBytes(size, format), 1);
1031 } 1031 }
1032 1032
1033 // static 1033 // static
1034 TileManager::MemoryUsage TileManager::MemoryUsage::FromTile(const Tile* tile) { 1034 TileManager::MemoryUsage TileManager::MemoryUsage::FromTile(const Tile* tile) {
1035 const TileDrawInfo& draw_info = tile->draw_info(); 1035 const TileDrawInfo& draw_info = tile->draw_info();
1036 if (draw_info.resource_) { 1036 if (draw_info.resource_) {
1037 return MemoryUsage::FromConfig(draw_info.resource_->size(), 1037 return MemoryUsage::FromConfig(draw_info.resource_->size(),
1038 draw_info.resource_->format()); 1038 draw_info.resource_->format());
1039 } 1039 }
1040 return MemoryUsage(); 1040 return MemoryUsage();
(...skipping 19 matching lines...) Expand all
1060 result -= other; 1060 result -= other;
1061 return result; 1061 return result;
1062 } 1062 }
1063 1063
1064 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const { 1064 bool TileManager::MemoryUsage::Exceeds(const MemoryUsage& limit) const {
1065 return memory_bytes_ > limit.memory_bytes_ || 1065 return memory_bytes_ > limit.memory_bytes_ ||
1066 resource_count_ > limit.resource_count_; 1066 resource_count_ > limit.resource_count_;
1067 } 1067 }
1068 1068
1069 } // namespace cc 1069 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698