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/resources/tile.h" | 5 #include "cc/resources/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 18 matching lines...) Expand all Loading... |
29 contents_scale_(contents_scale), | 29 contents_scale_(contents_scale), |
30 layer_id_(layer_id), | 30 layer_id_(layer_id), |
31 source_frame_number_(source_frame_number), | 31 source_frame_number_(source_frame_number), |
32 flags_(flags), | 32 flags_(flags), |
33 tiling_i_index_(-1), | 33 tiling_i_index_(-1), |
34 tiling_j_index_(-1), | 34 tiling_j_index_(-1), |
35 required_for_activation_(false), | 35 required_for_activation_(false), |
36 required_for_draw_(false), | 36 required_for_draw_(false), |
37 id_(s_next_id_++), | 37 id_(s_next_id_++), |
38 scheduled_priority_(0) { | 38 scheduled_priority_(0) { |
39 set_raster_source(raster_source); | |
40 } | 39 } |
41 | 40 |
42 Tile::~Tile() { | 41 Tile::~Tile() { |
43 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 42 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
44 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 43 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
45 "cc::Tile", this); | 44 "cc::Tile", this); |
46 } | 45 } |
47 | 46 |
48 void Tile::AsValueWithPriorityInto(const TilePriority& priority, | 47 void Tile::AsValueWithPriorityInto(const PrioritizedTile& prioritized_tile, |
49 base::trace_event::TracedValue* res) const { | 48 base::trace_event::TracedValue* res) const { |
50 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 49 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
51 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res, "cc::Tile", this); | 50 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res, "cc::Tile", this); |
52 TracedValue::SetIDRef(raster_source_.get(), res, "picture_pile"); | 51 TracedValue::SetIDRef(prioritized_tile.raster_source(), res, "picture_pile"); |
53 res->SetDouble("contents_scale", contents_scale_); | 52 res->SetDouble("contents_scale", contents_scale_); |
54 | 53 |
55 MathUtil::AddToTracedValue("content_rect", content_rect_, res); | 54 MathUtil::AddToTracedValue("content_rect", content_rect_, res); |
56 | 55 |
57 res->SetInteger("layer_id", layer_id_); | 56 res->SetInteger("layer_id", layer_id_); |
58 | 57 |
59 res->BeginDictionary("combined_priority"); | 58 res->BeginDictionary("combined_priority"); |
60 priority.AsValueInto(res); | 59 prioritized_tile.priority().AsValueInto(res); |
61 res->EndDictionary(); | 60 res->EndDictionary(); |
62 | 61 |
63 res->BeginDictionary("draw_info"); | 62 res->BeginDictionary("draw_info"); |
64 draw_info_.AsValueInto(res); | 63 draw_info_.AsValueInto(res); |
65 res->EndDictionary(); | 64 res->EndDictionary(); |
66 | 65 |
67 res->SetBoolean("has_resource", HasResource()); | 66 res->SetBoolean("has_resource", HasResource()); |
68 res->SetBoolean("is_using_gpu_memory", HasResource() || HasRasterTask()); | 67 res->SetBoolean("is_using_gpu_memory", HasResource() || HasRasterTask()); |
69 res->SetString("resolution", TileResolutionToString(priority.resolution)); | 68 res->SetString("resolution", TileResolutionToString( |
| 69 prioritized_tile.priority().resolution)); |
70 | 70 |
71 res->SetInteger("scheduled_priority", scheduled_priority_); | 71 res->SetInteger("scheduled_priority", scheduled_priority_); |
72 | 72 |
73 res->SetBoolean("use_picture_analysis", use_picture_analysis()); | 73 res->SetBoolean("use_picture_analysis", use_picture_analysis()); |
74 | 74 |
75 res->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); | 75 res->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
76 } | 76 } |
77 | 77 |
78 size_t Tile::GPUMemoryUsageInBytes() const { | 78 size_t Tile::GPUMemoryUsageInBytes() const { |
79 if (draw_info_.resource_) | 79 if (draw_info_.resource_) |
80 return draw_info_.resource_->bytes(); | 80 return draw_info_.resource_->bytes(); |
81 return 0; | 81 return 0; |
82 } | 82 } |
83 | 83 |
84 void Tile::Deleter::operator()(Tile* tile) const { | 84 void Tile::Deleter::operator()(Tile* tile) const { |
85 TileManager* tile_manager = tile->tile_manager_; | 85 TileManager* tile_manager = tile->tile_manager_; |
86 tile_manager->Release(tile); | 86 tile_manager->Release(tile); |
87 } | 87 } |
88 | 88 |
89 } // namespace cc | 89 } // namespace cc |
OLD | NEW |