OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 if (replica_layer_.get()) { | 109 if (replica_layer_.get()) { |
110 DCHECK_EQ(this, replica_layer_->parent()); | 110 DCHECK_EQ(this, replica_layer_->parent()); |
111 replica_layer_->RemoveFromParent(); | 111 replica_layer_->RemoveFromParent(); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 void Layer::SetLayerTreeHost(LayerTreeHost* host) { | 115 void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
116 if (layer_tree_host_ == host) | 116 if (layer_tree_host_ == host) |
117 return; | 117 return; |
118 | 118 |
| 119 if (layer_tree_host_) |
| 120 layer_tree_host_->UnregisterLayer(this); |
119 layer_tree_host_ = host; | 121 layer_tree_host_ = host; |
| 122 if (layer_tree_host_) |
| 123 layer_tree_host_->RegisterLayer(this); |
120 | 124 |
121 // When changing hosts, the layer needs to commit its properties to the impl | 125 // When changing hosts, the layer needs to commit its properties to the impl |
122 // side for the new host. | 126 // side for the new host. |
123 SetNeedsPushProperties(); | 127 SetNeedsPushProperties(); |
124 | 128 |
125 for (size_t i = 0; i < children_.size(); ++i) | 129 for (size_t i = 0; i < children_.size(); ++i) |
126 children_[i]->SetLayerTreeHost(host); | 130 children_[i]->SetLayerTreeHost(host); |
127 | 131 |
128 if (mask_layer_.get()) | 132 if (mask_layer_.get()) |
129 mask_layer_->SetLayerTreeHost(host); | 133 mask_layer_->SetLayerTreeHost(host); |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 } | 1327 } |
1324 | 1328 |
1325 void Layer::SetFrameTimingRequests( | 1329 void Layer::SetFrameTimingRequests( |
1326 const std::vector<FrameTimingRequest>& requests) { | 1330 const std::vector<FrameTimingRequest>& requests) { |
1327 frame_timing_requests_ = requests; | 1331 frame_timing_requests_ = requests; |
1328 frame_timing_requests_dirty_ = true; | 1332 frame_timing_requests_dirty_ = true; |
1329 SetNeedsCommit(); | 1333 SetNeedsCommit(); |
1330 } | 1334 } |
1331 | 1335 |
1332 } // namespace cc | 1336 } // namespace cc |
OLD | NEW |