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

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: 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
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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 623
624 // Destroy SystemTrayDelegate before destroying the status area(s). 624 // Destroy SystemTrayDelegate before destroying the status area(s).
625 system_tray_delegate_->Shutdown(); 625 system_tray_delegate_->Shutdown();
626 system_tray_delegate_.reset(); 626 system_tray_delegate_.reset();
627 627
628 locale_notification_controller_.reset(); 628 locale_notification_controller_.reset();
629 629
630 // Drag-and-drop must be canceled prior to close all windows. 630 // Drag-and-drop must be canceled prior to close all windows.
631 drag_drop_controller_.reset(); 631 drag_drop_controller_.reset();
632 632
633 // Controllers who has WindowObserver added must be deleted
634 // before |display_controller_| being deleted.
sky 2013/12/04 22:52:59 being -> is
oshima 2013/12/05 01:26:44 Done.
635 #if defined(OS_CHROMEOS)
636 // Destroy VideoActivityNotifier before destroying VideoDetector.
sky 2013/12/04 22:52:59 This comment documents the code, and therefor isn'
oshima 2013/12/05 01:26:44 I need these comments not to break the order when
sky 2013/12/05 01:36:35 I'm fine with comments, but they should describe w
637 video_activity_notifier_.reset();
638 #endif // defined(OS_CHROMEOS)
639 video_detector_.reset();
640
641 shadow_controller_.reset();
642 resize_shadow_controller_.reset();
643
644 window_cycle_controller_.reset();
645 mru_window_tracker_.reset();
646
633 // Destroy all child windows including widgets. 647 // Destroy all child windows including widgets.
634 display_controller_->CloseChildWindows(); 648 display_controller_->CloseChildWindows();
635 display_controller_->CloseNonDesktopDisplay(); 649 display_controller_->CloseNonDesktopDisplay();
636 650
651 // Launcher delete must be deleted before |focus_client_|.
sky 2013/12/04 22:52:59 Same thing here.
652 launcher_delegate_.reset();
653 focus_client_.reset();
654
637 // Destroy SystemTrayNotifier after destroying SystemTray as TrayItems 655 // Destroy SystemTrayNotifier after destroying SystemTray as TrayItems
638 // needs to remove observers from it. 656 // needs to remove observers from it.
639 system_tray_notifier_.reset(); 657 system_tray_notifier_.reset();
640 658
641 #if defined(OS_CHROMEOS)
642 // Destroy VideoActivityNotifier before destroying VideoDetector.
643 video_activity_notifier_.reset();
644 #endif // defined(OS_CHROMEOS)
645
646 // These need a valid Shell instance to clean up properly, so explicitly 659 // These need a valid Shell instance to clean up properly, so explicitly
647 // delete them before invalidating the instance. 660 // delete them before invalidating the instance.
648 // Alphabetical. TODO(oshima): sort. 661 // Alphabetical. TODO(oshima): sort.
649 magnification_controller_.reset(); 662 magnification_controller_.reset();
650 partial_magnification_controller_.reset(); 663 partial_magnification_controller_.reset();
651 resize_shadow_controller_.reset();
652 shadow_controller_.reset();
653 tooltip_controller_.reset(); 664 tooltip_controller_.reset();
654 event_client_.reset(); 665 event_client_.reset();
655 window_cycle_controller_.reset();
656 nested_dispatcher_controller_.reset(); 666 nested_dispatcher_controller_.reset();
657 user_action_client_.reset(); 667 user_action_client_.reset();
658 visibility_controller_.reset(); 668 visibility_controller_.reset();
659 launcher_delegate_.reset();
660 // |launcher_item_delegate_manager_| observes |shelf_model_|. It must be 669 // |launcher_item_delegate_manager_| observes |shelf_model_|. It must be
661 // destroyed before |shelf_model_| is destroyed. 670 // destroyed before |shelf_model_| is destroyed.
662 launcher_item_delegate_manager_.reset(); 671 launcher_item_delegate_manager_.reset();
663 shelf_model_.reset(); 672 shelf_model_.reset();
664 video_detector_.reset();
665 673
666 power_button_controller_.reset(); 674 power_button_controller_.reset();
667 lock_state_controller_.reset(); 675 lock_state_controller_.reset();
668 mru_window_tracker_.reset();
669 676
670 resolution_notification_controller_.reset(); 677 resolution_notification_controller_.reset();
671 desktop_background_controller_.reset(); 678 desktop_background_controller_.reset();
672 679
673 // This also deletes all RootWindows. Note that we invoke Shutdown() on 680 // This also deletes all RootWindows. Note that we invoke Shutdown() on
674 // DisplayController before resetting |display_controller_|, since destruction 681 // DisplayController before resetting |display_controller_|, since destruction
675 // of its owned RootWindowControllers relies on the value. 682 // of its owned RootWindowControllers relies on the value.
676 display_controller_->Shutdown(); 683 display_controller_->Shutdown();
677 display_controller_.reset(); 684 display_controller_.reset();
678 screen_position_controller_.reset(); 685 screen_position_controller_.reset();
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 //////////////////////////////////////////////////////////////////////////////// 1019 ////////////////////////////////////////////////////////////////////////////////
1013 // Shell, aura::client::ActivationChangeObserver implementation: 1020 // Shell, aura::client::ActivationChangeObserver implementation:
1014 1021
1015 void Shell::OnWindowActivated(aura::Window* gained_active, 1022 void Shell::OnWindowActivated(aura::Window* gained_active,
1016 aura::Window* lost_active) { 1023 aura::Window* lost_active) {
1017 if (gained_active) 1024 if (gained_active)
1018 target_root_window_ = gained_active->GetRootWindow(); 1025 target_root_window_ = gained_active->GetRootWindow();
1019 } 1026 }
1020 1027
1021 } // namespace ash 1028 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698