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 "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "cc/debug/traced_value.h" | 10 #include "cc/debug/traced_value.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 set_picture_pile(picture_pile); | 37 set_picture_pile(picture_pile); |
38 } | 38 } |
39 | 39 |
40 Tile::~Tile() { | 40 Tile::~Tile() { |
41 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 41 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
42 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 42 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
43 "cc::Tile", this); | 43 "cc::Tile", this); |
44 } | 44 } |
45 | 45 |
46 void Tile::SetPriority(WhichTree tree, const TilePriority& priority) { | 46 void Tile::SetPriority(WhichTree tree, const TilePriority& priority) { |
47 if (priority == priority_[tree]) | |
48 return; | |
49 | |
50 priority_[tree] = priority; | 47 priority_[tree] = priority; |
51 tile_manager_->DidChangeTilePriority(this); | |
52 } | 48 } |
53 | 49 |
54 void Tile::MarkRequiredForActivation() { | 50 void Tile::MarkRequiredForActivation() { |
55 if (priority_[PENDING_TREE].required_for_activation) | |
56 return; | |
57 | |
58 priority_[PENDING_TREE].required_for_activation = true; | 51 priority_[PENDING_TREE].required_for_activation = true; |
59 tile_manager_->DidChangeTilePriority(this); | |
60 } | 52 } |
61 | 53 |
62 scoped_ptr<base::Value> Tile::AsValue() const { | 54 scoped_ptr<base::Value> Tile::AsValue() const { |
63 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); | 55 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue()); |
64 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 56 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
65 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res.get(), "cc::Tile", this); | 57 TRACE_DISABLED_BY_DEFAULT("cc.debug"), res.get(), "cc::Tile", this); |
66 res->Set("picture_pile", | 58 res->Set("picture_pile", |
67 TracedValue::CreateIDRef(picture_pile_.get()).release()); | 59 TracedValue::CreateIDRef(picture_pile_.get()).release()); |
68 res->SetDouble("contents_scale", contents_scale_); | 60 res->SetDouble("contents_scale", contents_scale_); |
69 res->Set("content_rect", MathUtil::AsValue(content_rect_).release()); | 61 res->Set("content_rect", MathUtil::AsValue(content_rect_).release()); |
(...skipping 23 matching lines...) Expand all Loading... |
93 RasterMode Tile::DetermineRasterModeForResolution( | 85 RasterMode Tile::DetermineRasterModeForResolution( |
94 TileResolution resolution) const { | 86 TileResolution resolution) const { |
95 RasterMode current_mode = managed_state_.raster_mode; | 87 RasterMode current_mode = managed_state_.raster_mode; |
96 RasterMode raster_mode = resolution == LOW_RESOLUTION | 88 RasterMode raster_mode = resolution == LOW_RESOLUTION |
97 ? LOW_QUALITY_RASTER_MODE | 89 ? LOW_QUALITY_RASTER_MODE |
98 : HIGH_QUALITY_RASTER_MODE; | 90 : HIGH_QUALITY_RASTER_MODE; |
99 return std::min(raster_mode, current_mode); | 91 return std::min(raster_mode, current_mode); |
100 } | 92 } |
101 | 93 |
102 } // namespace cc | 94 } // namespace cc |
OLD | NEW |