OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/compositor/layer_owner.h" | 5 #include "ui/compositor/layer_owner.h" |
6 | 6 |
7 #include "ui/compositor/layer_owner_delegate.h" | 7 #include "ui/compositor/layer_owner_delegate.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 ui::Layer* child = *it; | 65 ui::Layer* child = *it; |
66 new_layer->Add(child); | 66 new_layer->Add(child); |
67 } | 67 } |
68 | 68 |
69 // Install the delegate last so that the delegate isn't notified as we copy | 69 // Install the delegate last so that the delegate isn't notified as we copy |
70 // state to the new layer. | 70 // state to the new layer. |
71 new_layer->set_delegate(old_delegate); | 71 new_layer->set_delegate(old_delegate); |
72 | 72 |
73 if (layer_owner_delegate_) | 73 if (layer_owner_delegate_) |
74 layer_owner_delegate_->OnLayerRecreated(old_layer.get(), new_layer); | 74 layer_owner_delegate_->OnLayerRecreated(old_layer.get(), new_layer); |
75 | 75 |
bruthig
2015/03/06 16:00:33
This file will NOT be submitted with this CL. It
| |
76 // If old_layer was the layer tree root then we need to move the Compositor | |
77 // over to the new root. | |
78 const bool is_root = !old_layer->parent(); | |
79 if (is_root && old_layer->GetCompositor()) | |
80 old_layer->GetCompositor()->SetRootLayer(new_layer); | |
81 | |
76 return old_layer.Pass(); | 82 return old_layer.Pass(); |
77 } | 83 } |
78 | 84 |
79 void LayerOwner::DestroyLayer() { | 85 void LayerOwner::DestroyLayer() { |
80 layer_ = NULL; | 86 layer_ = NULL; |
81 layer_owner_.reset(); | 87 layer_owner_.reset(); |
82 } | 88 } |
83 | 89 |
84 bool LayerOwner::OwnsLayer() const { | 90 bool LayerOwner::OwnsLayer() const { |
85 return !!layer_owner_; | 91 return !!layer_owner_; |
86 } | 92 } |
87 | 93 |
88 } // namespace ui | 94 } // namespace ui |
OLD | NEW |