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