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 30 matching lines...) Expand all Loading... |
41 for (int i = 0; i <= LAST_TREE; i++) | 41 for (int i = 0; i <= LAST_TREE; i++) |
42 is_occluded_[i] = false; | 42 is_occluded_[i] = false; |
43 } | 43 } |
44 | 44 |
45 Tile::~Tile() { | 45 Tile::~Tile() { |
46 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 46 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
47 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 47 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
48 "cc::Tile", this); | 48 "cc::Tile", this); |
49 } | 49 } |
50 | 50 |
51 void Tile::AsValueInto(base::trace_event::TracedValue* res) const { | 51 void Tile::AsValueWithPriorityInto(const TilePriority& priority, |
| 52 base::trace_event::TracedValue* res) const { |
52 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 53 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
53 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res, "cc::Tile", this); | 54 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res, "cc::Tile", this); |
54 TracedValue::SetIDRef(raster_source_.get(), res, "picture_pile"); | 55 TracedValue::SetIDRef(raster_source_.get(), res, "picture_pile"); |
55 res->SetDouble("contents_scale", contents_scale_); | 56 res->SetDouble("contents_scale", contents_scale_); |
56 | 57 |
57 MathUtil::AddToTracedValue("content_rect", content_rect_, res); | 58 MathUtil::AddToTracedValue("content_rect", content_rect_, res); |
58 | 59 |
59 res->SetInteger("layer_id", layer_id_); | 60 res->SetInteger("layer_id", layer_id_); |
60 | 61 |
| 62 // TODO(vmpstr): Remove active and pending priority once tracing is using |
| 63 // combined priority or at least can support both. |
61 res->BeginDictionary("active_priority"); | 64 res->BeginDictionary("active_priority"); |
62 priority_[ACTIVE_TREE].AsValueInto(res); | 65 priority_[ACTIVE_TREE].AsValueInto(res); |
63 res->EndDictionary(); | 66 res->EndDictionary(); |
64 | 67 |
65 res->BeginDictionary("pending_priority"); | 68 res->BeginDictionary("pending_priority"); |
66 priority_[PENDING_TREE].AsValueInto(res); | 69 priority_[PENDING_TREE].AsValueInto(res); |
67 res->EndDictionary(); | 70 res->EndDictionary(); |
68 | 71 |
| 72 res->BeginDictionary("combined_priority"); |
| 73 priority.AsValueInto(res); |
| 74 res->EndDictionary(); |
| 75 |
69 res->BeginDictionary("draw_info"); | 76 res->BeginDictionary("draw_info"); |
70 draw_info_.AsValueInto(res); | 77 draw_info_.AsValueInto(res); |
71 res->EndDictionary(); | 78 res->EndDictionary(); |
72 | 79 |
73 res->SetBoolean("has_resource", HasResource()); | 80 res->SetBoolean("has_resource", HasResource()); |
74 res->SetBoolean("is_using_gpu_memory", HasResource() || HasRasterTask()); | 81 res->SetBoolean("is_using_gpu_memory", HasResource() || HasRasterTask()); |
75 res->SetString("resolution", | 82 res->SetString("resolution", |
76 TileResolutionToString(combined_priority().resolution)); | 83 TileResolutionToString(combined_priority().resolution)); |
77 | 84 |
78 res->SetInteger("scheduled_priority", scheduled_priority_); | 85 res->SetInteger("scheduled_priority", scheduled_priority_); |
79 | 86 |
80 res->SetBoolean("use_picture_analysis", use_picture_analysis()); | 87 res->SetBoolean("use_picture_analysis", use_picture_analysis()); |
81 | 88 |
82 res->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); | 89 res->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
83 } | 90 } |
84 | 91 |
85 size_t Tile::GPUMemoryUsageInBytes() const { | 92 size_t Tile::GPUMemoryUsageInBytes() const { |
86 if (draw_info_.resource_) | 93 if (draw_info_.resource_) |
87 return draw_info_.resource_->bytes(); | 94 return draw_info_.resource_->bytes(); |
88 return 0; | 95 return 0; |
89 } | 96 } |
90 | 97 |
91 } // namespace cc | 98 } // namespace cc |
OLD | NEW |