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

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

Issue 1154393003: cc: Use CheckedNumeric for resource size calculations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: initialize var Created 5 years, 6 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/scoped_resource_unittest.cc ('k') | cc/tiles/tile_manager.cc » ('j') | 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/tiles/tile.h" 5 #include "cc/tiles/tile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/trace_event/trace_event_argument.h" 9 #include "base/trace_event/trace_event_argument.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 value->SetBoolean("has_resource", draw_info().has_resource()); 60 value->SetBoolean("has_resource", draw_info().has_resource());
61 value->SetBoolean("is_using_gpu_memory", 61 value->SetBoolean("is_using_gpu_memory",
62 draw_info().has_resource() || HasRasterTask()); 62 draw_info().has_resource() || HasRasterTask());
63 value->SetInteger("scheduled_priority", scheduled_priority_); 63 value->SetInteger("scheduled_priority", scheduled_priority_);
64 value->SetBoolean("use_picture_analysis", use_picture_analysis()); 64 value->SetBoolean("use_picture_analysis", use_picture_analysis());
65 value->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); 65 value->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes());
66 } 66 }
67 67
68 size_t Tile::GPUMemoryUsageInBytes() const { 68 size_t Tile::GPUMemoryUsageInBytes() const {
69 if (draw_info_.resource_) 69 if (draw_info_.resource_) {
70 return draw_info_.resource_->bytes(); 70 // We can use UncheckedSizeInBytes, since the tile size is determined by the
71 // compositor.
72 return Resource::UncheckedMemorySizeBytes(draw_info_.resource_->size(),
73 draw_info_.resource_->format());
74 }
71 return 0; 75 return 0;
72 } 76 }
73 77
74 void Tile::Deleter::operator()(Tile* tile) const { 78 void Tile::Deleter::operator()(Tile* tile) const {
75 TileManager* tile_manager = tile->tile_manager_; 79 TileManager* tile_manager = tile->tile_manager_;
76 tile_manager->Release(tile); 80 tile_manager->Release(tile);
77 } 81 }
78 82
79 } // namespace cc 83 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/scoped_resource_unittest.cc ('k') | cc/tiles/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698