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