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

Side by Side Diff: ash/root_window_controller.cc

Issue 2321763002: Moves some shutdown related code to earlier on in function (Closed)
Patch Set: move to end Created 4 years, 3 months 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
« no previous file with comments | « no previous file | no next file » | 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/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/aura/aura_layout_manager_adapter.h" 10 #include "ash/aura/aura_layout_manager_adapter.h"
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 // panel_layout_manager_ needs to be shut down before windows are destroyed. 553 // panel_layout_manager_ needs to be shut down before windows are destroyed.
554 if (panel_layout_manager_) { 554 if (panel_layout_manager_) {
555 panel_layout_manager_->Shutdown(); 555 panel_layout_manager_->Shutdown();
556 panel_layout_manager_ = NULL; 556 panel_layout_manager_ = NULL;
557 } 557 }
558 // docked_layout_manager_ needs to be shut down before windows are destroyed. 558 // docked_layout_manager_ needs to be shut down before windows are destroyed.
559 if (docked_layout_manager_) { 559 if (docked_layout_manager_) {
560 docked_layout_manager_->Shutdown(); 560 docked_layout_manager_->Shutdown();
561 docked_layout_manager_ = NULL; 561 docked_layout_manager_ = NULL;
562 } 562 }
563 aura::Window* root_window = GetRootWindow();
564 aura::client::SetDragDropClient(root_window, NULL);
565
566 wm_shelf_aura_->ShutdownShelfWidget(); 563 wm_shelf_aura_->ShutdownShelfWidget();
567 564
568 // Close wallpaper widget first as it depends on tooltip. 565 // Close wallpaper widget first as it depends on tooltip.
569 wallpaper_widget_controller_.reset(); 566 wallpaper_widget_controller_.reset();
570 animating_wallpaper_widget_controller_.reset(); 567 animating_wallpaper_widget_controller_.reset();
571 568
572 wm_root_window_controller_->DeleteWorkspaceController(); 569 wm_root_window_controller_->DeleteWorkspaceController();
573 aura::client::SetTooltipClient(root_window, NULL);
574 570
575 // Explicitly destroy top level windows. We do this as during part of 571 // Explicitly destroy top level windows. We do this as during part of
576 // destruction such windows may query the RootWindow for state. 572 // destruction such windows may query the RootWindow for state.
573 aura::Window* root_window = GetRootWindow();
577 aura::WindowTracker non_toplevel_windows; 574 aura::WindowTracker non_toplevel_windows;
578 non_toplevel_windows.Add(root_window); 575 non_toplevel_windows.Add(root_window);
579 while (!non_toplevel_windows.windows().empty()) { 576 while (!non_toplevel_windows.windows().empty()) {
580 const aura::Window* non_toplevel_window = 577 const aura::Window* non_toplevel_window =
581 *non_toplevel_windows.windows().begin(); 578 *non_toplevel_windows.windows().begin();
582 non_toplevel_windows.Remove(const_cast<aura::Window*>(non_toplevel_window)); 579 non_toplevel_windows.Remove(const_cast<aura::Window*>(non_toplevel_window));
583 aura::WindowTracker toplevel_windows; 580 aura::WindowTracker toplevel_windows;
584 for (size_t i = 0; i < non_toplevel_window->children().size(); ++i) { 581 for (size_t i = 0; i < non_toplevel_window->children().size(); ++i) {
585 aura::Window* child = non_toplevel_window->children()[i]; 582 aura::Window* child = non_toplevel_window->children()[i];
586 if (!child->owned_by_parent()) 583 if (!child->owned_by_parent())
(...skipping 15 matching lines...) Expand all
602 root_window->RemoveChild(window); 599 root_window->RemoveChild(window);
603 } 600 }
604 } 601 }
605 602
606 wm_shelf_aura_->DestroyShelfWidget(); 603 wm_shelf_aura_->DestroyShelfWidget();
607 604
608 // CloseChildWindows may be called twice during the shutdown of ash unittests. 605 // CloseChildWindows may be called twice during the shutdown of ash unittests.
609 // Avoid notifying WmShelf that the shelf has been destroyed twice. 606 // Avoid notifying WmShelf that the shelf has been destroyed twice.
610 if (wm_shelf_aura_->IsShelfInitialized()) 607 if (wm_shelf_aura_->IsShelfInitialized())
611 wm_shelf_aura_->ShutdownShelf(); 608 wm_shelf_aura_->ShutdownShelf();
609
610 aura::client::SetDragDropClient(root_window, nullptr);
611 aura::client::SetTooltipClient(root_window, nullptr);
612 } 612 }
613 613
614 void RootWindowController::MoveWindowsTo(aura::Window* dst) { 614 void RootWindowController::MoveWindowsTo(aura::Window* dst) {
615 // Clear the workspace controller, so it doesn't incorrectly update the shelf. 615 // Clear the workspace controller, so it doesn't incorrectly update the shelf.
616 wm_root_window_controller_->DeleteWorkspaceController(); 616 wm_root_window_controller_->DeleteWorkspaceController();
617 ReparentAllWindows(GetRootWindow(), dst); 617 ReparentAllWindows(GetRootWindow(), dst);
618 } 618 }
619 619
620 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { 620 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() {
621 return wm_shelf_aura_->shelf_layout_manager(); 621 return wm_shelf_aura_->shelf_layout_manager();
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 aura::Window* primary_root_window = Shell::GetInstance() 950 aura::Window* primary_root_window = Shell::GetInstance()
951 ->window_tree_host_manager() 951 ->window_tree_host_manager()
952 ->GetPrimaryRootWindow(); 952 ->GetPrimaryRootWindow();
953 return GetRootWindowSettings(primary_root_window)->controller; 953 return GetRootWindowSettings(primary_root_window)->controller;
954 } 954 }
955 955
956 return GetRootWindowSettings(root_window)->controller; 956 return GetRootWindowSettings(root_window)->controller;
957 } 957 }
958 958
959 } // namespace ash 959 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698