Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: ash/shell.cc

Issue 101013002: Make sure WindowObservers are removed from window before destruction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix shutdown order Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/drag_drop/drag_drop_controller.cc ('k') | ash/wm/solo_window_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "ash/accelerators/accelerator_controller.h" 10 #include "ash/accelerators/accelerator_controller.h"
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 625
626 // Destroy SystemTrayDelegate before destroying the status area(s). 626 // Destroy SystemTrayDelegate before destroying the status area(s).
627 system_tray_delegate_->Shutdown(); 627 system_tray_delegate_->Shutdown();
628 system_tray_delegate_.reset(); 628 system_tray_delegate_.reset();
629 629
630 locale_notification_controller_.reset(); 630 locale_notification_controller_.reset();
631 631
632 // Drag-and-drop must be canceled prior to close all windows. 632 // Drag-and-drop must be canceled prior to close all windows.
633 drag_drop_controller_.reset(); 633 drag_drop_controller_.reset();
634 634
635 // Controllers who have WindowObserver added must be deleted
636 // before |display_controller_| is deleted.
637
638 #if defined(OS_CHROMEOS)
639 // VideoActivityNotifier must be deleted before |video_detector_| is
640 // deleted because it's observing video activity through
641 // VideoDetectorObserver interface.
642 video_activity_notifier_.reset();
643 #endif // defined(OS_CHROMEOS)
644 video_detector_.reset();
645
646 shadow_controller_.reset();
647 resize_shadow_controller_.reset();
648
649 window_cycle_controller_.reset();
650 mru_window_tracker_.reset();
651
652 // |shelf_window_watcher_| has a weak pointer to |shelf_Model_|
653 // and has window observers.
654 shelf_window_watcher_.reset();
655
635 // Destroy all child windows including widgets. 656 // Destroy all child windows including widgets.
636 display_controller_->CloseChildWindows(); 657 display_controller_->CloseChildWindows();
637 display_controller_->CloseNonDesktopDisplay(); 658 display_controller_->CloseNonDesktopDisplay();
638 659
660 // Chrome implementation of launcher delegate depends on FocusClient,
661 // so must be deleted before |focus_client_|.
662 launcher_delegate_.reset();
663 focus_client_.reset();
664
639 // Destroy SystemTrayNotifier after destroying SystemTray as TrayItems 665 // Destroy SystemTrayNotifier after destroying SystemTray as TrayItems
640 // needs to remove observers from it. 666 // needs to remove observers from it.
641 system_tray_notifier_.reset(); 667 system_tray_notifier_.reset();
642 668
643 #if defined(OS_CHROMEOS)
644 // Destroy VideoActivityNotifier before destroying VideoDetector.
645 video_activity_notifier_.reset();
646 #endif // defined(OS_CHROMEOS)
647
648 // These need a valid Shell instance to clean up properly, so explicitly 669 // These need a valid Shell instance to clean up properly, so explicitly
649 // delete them before invalidating the instance. 670 // delete them before invalidating the instance.
650 // Alphabetical. TODO(oshima): sort. 671 // Alphabetical. TODO(oshima): sort.
651 magnification_controller_.reset(); 672 magnification_controller_.reset();
652 partial_magnification_controller_.reset(); 673 partial_magnification_controller_.reset();
653 resize_shadow_controller_.reset();
654 shadow_controller_.reset();
655 tooltip_controller_.reset(); 674 tooltip_controller_.reset();
656 event_client_.reset(); 675 event_client_.reset();
657 window_cycle_controller_.reset();
658 nested_dispatcher_controller_.reset(); 676 nested_dispatcher_controller_.reset();
659 user_action_client_.reset(); 677 user_action_client_.reset();
660 visibility_controller_.reset(); 678 visibility_controller_.reset();
661 launcher_delegate_.reset();
662 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be 679 // |shelf_item_delegate_manager_| observes |shelf_model_|. It must be
663 // destroyed before |shelf_model_| is destroyed. 680 // destroyed before |shelf_model_| is destroyed.
664 shelf_item_delegate_manager_.reset(); 681 shelf_item_delegate_manager_.reset();
665 // |shelf_window_watcher_| has a weak pointer to |shelf_Model_|.
666 shelf_window_watcher_.reset();
667 shelf_model_.reset(); 682 shelf_model_.reset();
668 video_detector_.reset();
669 683
670 power_button_controller_.reset(); 684 power_button_controller_.reset();
671 lock_state_controller_.reset(); 685 lock_state_controller_.reset();
672 mru_window_tracker_.reset();
673 686
674 resolution_notification_controller_.reset(); 687 resolution_notification_controller_.reset();
675 desktop_background_controller_.reset(); 688 desktop_background_controller_.reset();
676 689
677 // This also deletes all RootWindows. Note that we invoke Shutdown() on 690 // This also deletes all RootWindows. Note that we invoke Shutdown() on
678 // DisplayController before resetting |display_controller_|, since destruction 691 // DisplayController before resetting |display_controller_|, since destruction
679 // of its owned RootWindowControllers relies on the value. 692 // of its owned RootWindowControllers relies on the value.
680 display_controller_->Shutdown(); 693 display_controller_->Shutdown();
681 display_controller_.reset(); 694 display_controller_.reset();
682 screen_position_controller_.reset(); 695 screen_position_controller_.reset();
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 //////////////////////////////////////////////////////////////////////////////// 1029 ////////////////////////////////////////////////////////////////////////////////
1017 // Shell, aura::client::ActivationChangeObserver implementation: 1030 // Shell, aura::client::ActivationChangeObserver implementation:
1018 1031
1019 void Shell::OnWindowActivated(aura::Window* gained_active, 1032 void Shell::OnWindowActivated(aura::Window* gained_active,
1020 aura::Window* lost_active) { 1033 aura::Window* lost_active) {
1021 if (gained_active) 1034 if (gained_active)
1022 target_root_window_ = gained_active->GetRootWindow(); 1035 target_root_window_ = gained_active->GetRootWindow();
1023 } 1036 }
1024 1037
1025 } // namespace ash 1038 } // namespace ash
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_controller.cc ('k') | ash/wm/solo_window_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698