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

Side by Side Diff: cc/tiles/tile.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.h" 5 #include "cc/tiles/tile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 value->SetInteger("scheduled_priority", scheduled_priority_); 64 value->SetInteger("scheduled_priority", scheduled_priority_);
65 value->SetBoolean("use_picture_analysis", use_picture_analysis()); 65 value->SetBoolean("use_picture_analysis", use_picture_analysis());
66 value->SetInteger("gpu_memory_usage", 66 value->SetInteger("gpu_memory_usage",
67 base::saturated_cast<int>(GPUMemoryUsageInBytes())); 67 base::saturated_cast<int>(GPUMemoryUsageInBytes()));
68 } 68 }
69 69
70 size_t Tile::GPUMemoryUsageInBytes() const { 70 size_t Tile::GPUMemoryUsageInBytes() const {
71 if (draw_info_.resource_) { 71 if (draw_info_.resource_) {
72 // We can use UncheckedSizeInBytes, since the tile size is determined by the 72 // We can use UncheckedSizeInBytes, since the tile size is determined by the
73 // compositor. 73 // compositor.
74 return Resource::UncheckedMemorySizeBytes(draw_info_.resource_->size(), 74 return ResourceUtil::UncheckedSizeInBytes(draw_info_.resource_->size(),
75 draw_info_.resource_->format()); 75 draw_info_.resource_->format());
76 } 76 }
77 return 0; 77 return 0;
78 } 78 }
79 79
80 void Tile::Deleter::operator()(Tile* tile) const { 80 void Tile::Deleter::operator()(Tile* tile) const {
81 TileManager* tile_manager = tile->tile_manager_; 81 TileManager* tile_manager = tile->tile_manager_;
82 tile_manager->Release(tile); 82 tile_manager->Release(tile);
83 } 83 }
84 84
85 } // namespace cc 85 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698