Chromium Code Reviews| 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/aura/window.h" | 5 #include "ui/aura/window.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 // Then destroy the children. | 137 // Then destroy the children. |
| 138 RemoveOrDestroyChildren(); | 138 RemoveOrDestroyChildren(); |
| 139 | 139 |
| 140 // The window needs to be removed from the parent before calling the | 140 // The window needs to be removed from the parent before calling the |
| 141 // WindowDestroyed callbacks of delegate and the observers. | 141 // WindowDestroyed callbacks of delegate and the observers. |
| 142 if (parent_) | 142 if (parent_) |
| 143 parent_->RemoveChild(this); | 143 parent_->RemoveChild(this); |
| 144 | 144 |
| 145 if (delegate_) | 145 if (delegate_) |
| 146 delegate_->OnWindowDestroyed(this); | 146 delegate_->OnWindowDestroyed(this); |
| 147 base::ObserverListBase<WindowObserver>::Iterator iter(&observers_); | 147 for (auto& observer : observers_) { |
|
sky
2016/10/13 02:20:57
It's my understanding observer is a WindowObserver
dcheng
2016/10/13 02:39:22
Dereferencing the iterator currently gives you a r
sky
2016/10/13 02:41:03
If that's the case, then wouldn't the 'observer.'
dcheng
2016/10/13 02:48:42
We have a reference to the underlying object, not
loyso (OOO)
2016/10/13 03:17:40
The range based for statement defined in C++ as:
loyso (OOO)
2016/10/13 07:03:32
Also, in current implementation you are allowed to
| |
| 148 for (WindowObserver* observer = iter.GetNext(); observer; | 148 RemoveObserver(&observer); |
| 149 observer = iter.GetNext()) { | 149 observer.OnWindowDestroyed(this); |
| 150 RemoveObserver(observer); | |
| 151 observer->OnWindowDestroyed(this); | |
| 152 } | 150 } |
| 153 | 151 |
| 154 // Delete the LayoutManager before properties. This way if the LayoutManager | 152 // Delete the LayoutManager before properties. This way if the LayoutManager |
| 155 // depends upon properties existing the properties are still valid. | 153 // depends upon properties existing the properties are still valid. |
| 156 layout_manager_.reset(); | 154 layout_manager_.reset(); |
| 157 | 155 |
| 158 // Clear properties. | 156 // Clear properties. |
| 159 for (std::map<const void*, Value>::const_iterator iter = prop_map_.begin(); | 157 for (std::map<const void*, Value>::const_iterator iter = prop_map_.begin(); |
| 160 iter != prop_map_.end(); | 158 iter != prop_map_.end(); |
| 161 ++iter) { | 159 ++iter) { |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1118 layer_name = "Unnamed Window"; | 1116 layer_name = "Unnamed Window"; |
| 1119 | 1117 |
| 1120 if (id_ != -1) | 1118 if (id_ != -1) |
| 1121 layer_name += " " + base::IntToString(id_); | 1119 layer_name += " " + base::IntToString(id_); |
| 1122 | 1120 |
| 1123 layer()->set_name(layer_name); | 1121 layer()->set_name(layer_name); |
| 1124 #endif | 1122 #endif |
| 1125 } | 1123 } |
| 1126 | 1124 |
| 1127 } // namespace aura | 1125 } // namespace aura |
| OLD | NEW |