| 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/debug/trace_event_argument.h" | 9 #include "base/debug/trace_event_argument.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 content_rect_(content_rect), | 30 content_rect_(content_rect), |
| 31 contents_scale_(contents_scale), | 31 contents_scale_(contents_scale), |
| 32 layer_id_(layer_id), | 32 layer_id_(layer_id), |
| 33 source_frame_number_(source_frame_number), | 33 source_frame_number_(source_frame_number), |
| 34 flags_(flags), | 34 flags_(flags), |
| 35 is_shared_(false), | 35 is_shared_(false), |
| 36 tiling_i_index_(-1), | 36 tiling_i_index_(-1), |
| 37 tiling_j_index_(-1), | 37 tiling_j_index_(-1), |
| 38 required_for_activation_(false), | 38 required_for_activation_(false), |
| 39 required_for_draw_(false), | 39 required_for_draw_(false), |
| 40 id_(s_next_id_++) { | 40 id_(s_next_id_++), |
| 41 scheduled_priority_(0) { |
| 41 set_raster_source(raster_source); | 42 set_raster_source(raster_source); |
| 42 for (int i = 0; i < NUM_TREES; i++) | 43 for (int i = 0; i < NUM_TREES; i++) |
| 43 is_occluded_[i] = false; | 44 is_occluded_[i] = false; |
| 44 } | 45 } |
| 45 | 46 |
| 46 Tile::~Tile() { | 47 Tile::~Tile() { |
| 47 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 48 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 48 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 49 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 49 "cc::Tile", this); | 50 "cc::Tile", this); |
| 50 } | 51 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 62 res->SetInteger("layer_id", layer_id_); | 63 res->SetInteger("layer_id", layer_id_); |
| 63 | 64 |
| 64 res->BeginDictionary("active_priority"); | 65 res->BeginDictionary("active_priority"); |
| 65 priority_[ACTIVE_TREE].AsValueInto(res); | 66 priority_[ACTIVE_TREE].AsValueInto(res); |
| 66 res->EndDictionary(); | 67 res->EndDictionary(); |
| 67 | 68 |
| 68 res->BeginDictionary("pending_priority"); | 69 res->BeginDictionary("pending_priority"); |
| 69 priority_[PENDING_TREE].AsValueInto(res); | 70 priority_[PENDING_TREE].AsValueInto(res); |
| 70 res->EndDictionary(); | 71 res->EndDictionary(); |
| 71 | 72 |
| 72 res->BeginDictionary("managed_state"); | 73 res->BeginDictionary("draw_info"); |
| 73 managed_state_.AsValueInto(res); | 74 draw_info_.AsValueInto(res); |
| 74 res->EndDictionary(); | 75 res->EndDictionary(); |
| 75 | 76 |
| 77 res->SetBoolean("has_resource", HasResource()); |
| 78 res->SetBoolean("is_using_gpu_memory", HasResource() || HasRasterTask()); |
| 79 res->SetString("resolution", |
| 80 TileResolutionToString(combined_priority().resolution)); |
| 81 |
| 82 res->SetInteger("scheduled_priority", scheduled_priority_); |
| 83 |
| 76 res->SetBoolean("use_picture_analysis", use_picture_analysis()); | 84 res->SetBoolean("use_picture_analysis", use_picture_analysis()); |
| 77 | 85 |
| 78 res->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); | 86 res->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
| 79 } | 87 } |
| 80 | 88 |
| 81 size_t Tile::GPUMemoryUsageInBytes() const { | 89 size_t Tile::GPUMemoryUsageInBytes() const { |
| 82 if (managed_state_.draw_info.resource_) | 90 if (draw_info_.resource_) |
| 83 return managed_state_.draw_info.resource_->bytes(); | 91 return draw_info_.resource_->bytes(); |
| 84 return 0; | 92 return 0; |
| 85 } | 93 } |
| 86 | 94 |
| 87 bool Tile::HasRasterTask() const { | |
| 88 return !!managed_state_.raster_task.get(); | |
| 89 } | |
| 90 | |
| 91 } // namespace cc | 95 } // namespace cc |
| OLD | NEW |