| 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 16 matching lines...) Expand all Loading... |
| 27 int flags) | 27 int flags) |
| 28 : RefCountedManaged<Tile>(tile_manager), | 28 : RefCountedManaged<Tile>(tile_manager), |
| 29 tile_manager_(tile_manager), | 29 tile_manager_(tile_manager), |
| 30 tile_size_(tile_size), | 30 tile_size_(tile_size), |
| 31 content_rect_(content_rect), | 31 content_rect_(content_rect), |
| 32 contents_scale_(contents_scale), | 32 contents_scale_(contents_scale), |
| 33 opaque_rect_(opaque_rect), | 33 opaque_rect_(opaque_rect), |
| 34 layer_id_(layer_id), | 34 layer_id_(layer_id), |
| 35 source_frame_number_(source_frame_number), | 35 source_frame_number_(source_frame_number), |
| 36 flags_(flags), | 36 flags_(flags), |
| 37 tiling_i_index_(-1), |
| 38 tiling_j_index_(-1), |
| 39 required_for_activation_(false), |
| 37 id_(s_next_id_++) { | 40 id_(s_next_id_++) { |
| 38 set_picture_pile(picture_pile); | 41 set_picture_pile(picture_pile); |
| 39 for (int i = 0; i < NUM_TREES; i++) | 42 for (int i = 0; i < NUM_TREES; i++) |
| 40 is_occluded_[i] = false; | 43 is_occluded_[i] = false; |
| 41 } | 44 } |
| 42 | 45 |
| 43 Tile::~Tile() { | 46 Tile::~Tile() { |
| 44 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 47 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 45 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 48 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 46 "cc::Tile", this); | 49 "cc::Tile", this); |
| 47 } | 50 } |
| 48 | 51 |
| 49 void Tile::SetPriority(WhichTree tree, const TilePriority& priority) { | 52 void Tile::SetPriority(WhichTree tree, const TilePriority& priority) { |
| 50 if (priority == priority_[tree]) | 53 if (priority == priority_[tree]) |
| 51 return; | 54 return; |
| 52 | 55 |
| 53 priority_[tree] = priority; | 56 priority_[tree] = priority; |
| 54 tile_manager_->DidChangeTilePriority(this); | |
| 55 } | |
| 56 | |
| 57 void Tile::MarkRequiredForActivation() { | |
| 58 if (priority_[PENDING_TREE].required_for_activation) | |
| 59 return; | |
| 60 | |
| 61 priority_[PENDING_TREE].required_for_activation = true; | |
| 62 tile_manager_->DidChangeTilePriority(this); | |
| 63 } | 57 } |
| 64 | 58 |
| 65 void Tile::AsValueInto(base::debug::TracedValue* res) const { | 59 void Tile::AsValueInto(base::debug::TracedValue* res) const { |
| 66 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 60 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
| 67 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res, "cc::Tile", this); | 61 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res, "cc::Tile", this); |
| 68 TracedValue::SetIDRef(picture_pile_.get(), res, "picture_pile"); | 62 TracedValue::SetIDRef(picture_pile_.get(), res, "picture_pile"); |
| 69 res->SetDouble("contents_scale", contents_scale_); | 63 res->SetDouble("contents_scale", contents_scale_); |
| 70 | 64 |
| 71 res->BeginArray("content_rect"); | 65 res->BeginArray("content_rect"); |
| 72 MathUtil::AddToTracedValue(content_rect_, res); | 66 MathUtil::AddToTracedValue(content_rect_, res); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 111 |
| 118 bool Tile::HasRasterTask() const { | 112 bool Tile::HasRasterTask() const { |
| 119 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { | 113 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { |
| 120 if (managed_state_.tile_versions[mode].raster_task_) | 114 if (managed_state_.tile_versions[mode].raster_task_) |
| 121 return true; | 115 return true; |
| 122 } | 116 } |
| 123 return false; | 117 return false; |
| 124 } | 118 } |
| 125 | 119 |
| 126 } // namespace cc | 120 } // namespace cc |
| OLD | NEW |