Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 1455023002: cc: Replace Pass() with std::move() in some subdirs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-cc
Patch Set: pass-cc2: . Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 layer_tree_impl_->UnregisterScrollLayer(this); 120 layer_tree_impl_->UnregisterScrollLayer(this);
121 layer_tree_impl_->UnregisterLayer(this); 121 layer_tree_impl_->UnregisterLayer(this);
122 122
123 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 123 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
124 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); 124 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this);
125 } 125 }
126 126
127 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) { 127 void LayerImpl::AddChild(scoped_ptr<LayerImpl> child) {
128 child->SetParent(this); 128 child->SetParent(this);
129 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); 129 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl());
130 children_.push_back(child.Pass()); 130 children_.push_back(std::move(child));
131 layer_tree_impl()->set_needs_update_draw_properties(); 131 layer_tree_impl()->set_needs_update_draw_properties();
132 } 132 }
133 133
134 scoped_ptr<LayerImpl> LayerImpl::RemoveChild(LayerImpl* child) { 134 scoped_ptr<LayerImpl> LayerImpl::RemoveChild(LayerImpl* child) {
135 for (OwnedLayerImplList::iterator it = children_.begin(); 135 for (OwnedLayerImplList::iterator it = children_.begin();
136 it != children_.end(); 136 it != children_.end();
137 ++it) { 137 ++it) {
138 if (it->get() == child) { 138 if (it->get() == child) {
139 scoped_ptr<LayerImpl> ret = it->Pass(); 139 scoped_ptr<LayerImpl> ret = it->Pass();
140 children_.erase(it); 140 children_.erase(it);
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 void LayerImpl::SetMaskLayer(scoped_ptr<LayerImpl> mask_layer) { 1016 void LayerImpl::SetMaskLayer(scoped_ptr<LayerImpl> mask_layer) {
1017 int new_layer_id = mask_layer ? mask_layer->id() : -1; 1017 int new_layer_id = mask_layer ? mask_layer->id() : -1;
1018 1018
1019 if (mask_layer) { 1019 if (mask_layer) {
1020 DCHECK_EQ(layer_tree_impl(), mask_layer->layer_tree_impl()); 1020 DCHECK_EQ(layer_tree_impl(), mask_layer->layer_tree_impl());
1021 DCHECK_NE(new_layer_id, mask_layer_id_); 1021 DCHECK_NE(new_layer_id, mask_layer_id_);
1022 } else if (new_layer_id == mask_layer_id_) { 1022 } else if (new_layer_id == mask_layer_id_) {
1023 return; 1023 return;
1024 } 1024 }
1025 1025
1026 mask_layer_ = mask_layer.Pass(); 1026 mask_layer_ = std::move(mask_layer);
1027 mask_layer_id_ = new_layer_id; 1027 mask_layer_id_ = new_layer_id;
1028 if (mask_layer_) 1028 if (mask_layer_)
1029 mask_layer_->SetParent(this); 1029 mask_layer_->SetParent(this);
1030 NoteLayerPropertyChangedForSubtree(); 1030 NoteLayerPropertyChangedForSubtree();
1031 } 1031 }
1032 1032
1033 scoped_ptr<LayerImpl> LayerImpl::TakeMaskLayer() { 1033 scoped_ptr<LayerImpl> LayerImpl::TakeMaskLayer() {
1034 mask_layer_id_ = -1; 1034 mask_layer_id_ = -1;
1035 return mask_layer_.Pass(); 1035 return std::move(mask_layer_);
1036 } 1036 }
1037 1037
1038 void LayerImpl::SetReplicaLayer(scoped_ptr<LayerImpl> replica_layer) { 1038 void LayerImpl::SetReplicaLayer(scoped_ptr<LayerImpl> replica_layer) {
1039 int new_layer_id = replica_layer ? replica_layer->id() : -1; 1039 int new_layer_id = replica_layer ? replica_layer->id() : -1;
1040 1040
1041 if (replica_layer) { 1041 if (replica_layer) {
1042 DCHECK_EQ(layer_tree_impl(), replica_layer->layer_tree_impl()); 1042 DCHECK_EQ(layer_tree_impl(), replica_layer->layer_tree_impl());
1043 DCHECK_NE(new_layer_id, replica_layer_id_); 1043 DCHECK_NE(new_layer_id, replica_layer_id_);
1044 } else if (new_layer_id == replica_layer_id_) { 1044 } else if (new_layer_id == replica_layer_id_) {
1045 return; 1045 return;
1046 } 1046 }
1047 1047
1048 replica_layer_ = replica_layer.Pass(); 1048 replica_layer_ = std::move(replica_layer);
1049 replica_layer_id_ = new_layer_id; 1049 replica_layer_id_ = new_layer_id;
1050 if (replica_layer_) 1050 if (replica_layer_)
1051 replica_layer_->SetParent(this); 1051 replica_layer_->SetParent(this);
1052 NoteLayerPropertyChangedForSubtree(); 1052 NoteLayerPropertyChangedForSubtree();
1053 } 1053 }
1054 1054
1055 scoped_ptr<LayerImpl> LayerImpl::TakeReplicaLayer() { 1055 scoped_ptr<LayerImpl> LayerImpl::TakeReplicaLayer() {
1056 replica_layer_id_ = -1; 1056 replica_layer_id_ = -1;
1057 return replica_layer_.Pass(); 1057 return std::move(replica_layer_);
1058 } 1058 }
1059 1059
1060 ScrollbarLayerImplBase* LayerImpl::ToScrollbarLayer() { 1060 ScrollbarLayerImplBase* LayerImpl::ToScrollbarLayer() {
1061 return nullptr; 1061 return nullptr;
1062 } 1062 }
1063 1063
1064 void LayerImpl::SetDrawsContent(bool draws_content) { 1064 void LayerImpl::SetDrawsContent(bool draws_content) {
1065 if (draws_content_ == draws_content) 1065 if (draws_content_ == draws_content)
1066 return; 1066 return;
1067 1067
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 } 1801 }
1802 1802
1803 // TODO(enne): the transform needs to come from property trees instead of 1803 // TODO(enne): the transform needs to come from property trees instead of
1804 // draw properties. 1804 // draw properties.
1805 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1805 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1806 draw_properties().target_space_transform, default_scale); 1806 draw_properties().target_space_transform, default_scale);
1807 return std::max(transform_scales.x(), transform_scales.y()); 1807 return std::max(transform_scales.x(), transform_scales.y());
1808 } 1808 }
1809 1809
1810 } // namespace cc 1810 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698