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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 if (delegate_) | 144 if (delegate_) |
145 delegate_->OnWindowDestroyed(this); | 145 delegate_->OnWindowDestroyed(this); |
146 base::ObserverListBase<WindowObserver>::Iterator iter(&observers_); | 146 base::ObserverListBase<WindowObserver>::Iterator iter(&observers_); |
147 for (WindowObserver* observer = iter.GetNext(); observer; | 147 for (WindowObserver* observer = iter.GetNext(); observer; |
148 observer = iter.GetNext()) { | 148 observer = iter.GetNext()) { |
149 RemoveObserver(observer); | 149 RemoveObserver(observer); |
150 observer->OnWindowDestroyed(this); | 150 observer->OnWindowDestroyed(this); |
151 } | 151 } |
152 | 152 |
| 153 // Delete the LayoutManager before properties. This way if the LayoutManager |
| 154 // depends upon properties existing the properties are still valid. |
| 155 layout_manager_.reset(); |
| 156 |
153 // Clear properties. | 157 // Clear properties. |
154 for (std::map<const void*, Value>::const_iterator iter = prop_map_.begin(); | 158 for (std::map<const void*, Value>::const_iterator iter = prop_map_.begin(); |
155 iter != prop_map_.end(); | 159 iter != prop_map_.end(); |
156 ++iter) { | 160 ++iter) { |
157 if (iter->second.deallocator) | 161 if (iter->second.deallocator) |
158 (*iter->second.deallocator)(iter->second.value); | 162 (*iter->second.deallocator)(iter->second.value); |
159 } | 163 } |
160 prop_map_.clear(); | 164 prop_map_.clear(); |
161 | 165 |
162 // The layer will either be destroyed by |layer_owner_|'s dtor, or by whoever | 166 // The layer will either be destroyed by |layer_owner_|'s dtor, or by whoever |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 layer_name = "Unnamed Window"; | 1115 layer_name = "Unnamed Window"; |
1112 | 1116 |
1113 if (id_ != -1) | 1117 if (id_ != -1) |
1114 layer_name += " " + base::IntToString(id_); | 1118 layer_name += " " + base::IntToString(id_); |
1115 | 1119 |
1116 layer()->set_name(layer_name); | 1120 layer()->set_name(layer_name); |
1117 #endif | 1121 #endif |
1118 } | 1122 } |
1119 | 1123 |
1120 } // namespace aura | 1124 } // namespace aura |
OLD | NEW |