| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/ui/public/cpp/window.h" | 5 #include "services/ui/public/cpp/window.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 parent_->LocalRemoveChild(this); | 546 parent_->LocalRemoveChild(this); |
| 547 | 547 |
| 548 // We may still have children. This can happen if the embedder destroys the | 548 // We may still have children. This can happen if the embedder destroys the |
| 549 // root while we're still alive. | 549 // root while we're still alive. |
| 550 while (!children_.empty()) { | 550 while (!children_.empty()) { |
| 551 Window* child = children_.front(); | 551 Window* child = children_.front(); |
| 552 LocalRemoveChild(child); | 552 LocalRemoveChild(child); |
| 553 DCHECK(children_.empty() || children_.front() != child); | 553 DCHECK(children_.empty() || children_.front() != child); |
| 554 } | 554 } |
| 555 | 555 |
| 556 // Notify observers before clearing properties (order matches aura::Window). |
| 557 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this)); |
| 558 |
| 556 // Clear properties. | 559 // Clear properties. |
| 557 for (auto& pair : prop_map_) { | 560 for (auto& pair : prop_map_) { |
| 558 if (pair.second.deallocator) | 561 if (pair.second.deallocator) |
| 559 (*pair.second.deallocator)(pair.second.value); | 562 (*pair.second.deallocator)(pair.second.value); |
| 560 } | 563 } |
| 561 prop_map_.clear(); | 564 prop_map_.clear(); |
| 562 | 565 |
| 563 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this)); | |
| 564 | |
| 565 // Invoke after observers so that can clean up any internal state observers | 566 // Invoke after observers so that can clean up any internal state observers |
| 566 // may have changed. | 567 // may have changed. |
| 567 if (window_tree()) | 568 if (window_tree()) |
| 568 window_tree()->OnWindowDestroyed(this); | 569 window_tree()->OnWindowDestroyed(this); |
| 569 } | 570 } |
| 570 | 571 |
| 571 //////////////////////////////////////////////////////////////////////////////// | 572 //////////////////////////////////////////////////////////////////////////////// |
| 572 // Window, private: | 573 // Window, private: |
| 573 | 574 |
| 574 Window::Window(WindowTreeClient* client, Id id) | 575 Window::Window(WindowTreeClient* client, Id id) |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 notifier->NotifyWindowReordered(); | 929 notifier->NotifyWindowReordered(); |
| 929 | 930 |
| 930 return true; | 931 return true; |
| 931 } | 932 } |
| 932 | 933 |
| 933 // static | 934 // static |
| 934 Window** Window::GetStackingTarget(Window* window) { | 935 Window** Window::GetStackingTarget(Window* window) { |
| 935 return &window->stacking_target_; | 936 return &window->stacking_target_; |
| 936 } | 937 } |
| 937 } // namespace ui | 938 } // namespace ui |
| OLD | NEW |