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/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 Loading... |
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 |
OLD | NEW |