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

Side by Side Diff: ash/display/window_tree_host_manager.cc

Issue 1640503002: ash: Do not use MessageLoopForUI when not needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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/display/window_tree_host_manager.h" 5 #include "ash/display/window_tree_host_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 15 matching lines...) Expand all
26 #include "ash/screen_util.h" 26 #include "ash/screen_util.h"
27 #include "ash/shell.h" 27 #include "ash/shell.h"
28 #include "ash/shell_delegate.h" 28 #include "ash/shell_delegate.h"
29 #include "ash/system/tray/system_tray.h" 29 #include "ash/system/tray/system_tray.h"
30 #include "ash/wm/coordinate_conversion.h" 30 #include "ash/wm/coordinate_conversion.h"
31 #include "ash/wm/window_util.h" 31 #include "ash/wm/window_util.h"
32 #include "base/command_line.h" 32 #include "base/command_line.h"
33 #include "base/stl_util.h" 33 #include "base/stl_util.h"
34 #include "base/strings/stringprintf.h" 34 #include "base/strings/stringprintf.h"
35 #include "base/strings/utf_string_conversions.h" 35 #include "base/strings/utf_string_conversions.h"
36 #include "base/thread_task_runner_handle.h"
36 #include "ui/aura/client/capture_client.h" 37 #include "ui/aura/client/capture_client.h"
37 #include "ui/aura/client/focus_client.h" 38 #include "ui/aura/client/focus_client.h"
38 #include "ui/aura/client/screen_position_client.h" 39 #include "ui/aura/client/screen_position_client.h"
39 #include "ui/aura/window.h" 40 #include "ui/aura/window.h"
40 #include "ui/aura/window_event_dispatcher.h" 41 #include "ui/aura/window_event_dispatcher.h"
41 #include "ui/aura/window_property.h" 42 #include "ui/aura/window_property.h"
42 #include "ui/aura/window_tracker.h" 43 #include "ui/aura/window_tracker.h"
43 #include "ui/aura/window_tree_host.h" 44 #include "ui/aura/window_tree_host.h"
44 #include "ui/base/ime/input_method_factory.h" 45 #include "ui/base/ime/input_method_factory.h"
45 #include "ui/compositor/compositor.h" 46 #include "ui/compositor/compositor.h"
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 636
636 void WindowTreeHostManager::DeleteHost(AshWindowTreeHost* host_to_delete) { 637 void WindowTreeHostManager::DeleteHost(AshWindowTreeHost* host_to_delete) {
637 ClearDisplayPropertiesOnHost(host_to_delete); 638 ClearDisplayPropertiesOnHost(host_to_delete);
638 RootWindowController* controller = 639 RootWindowController* controller =
639 GetRootWindowController(GetWindow(host_to_delete)); 640 GetRootWindowController(GetWindow(host_to_delete));
640 DCHECK(controller); 641 DCHECK(controller);
641 controller->MoveWindowsTo(GetPrimaryRootWindow()); 642 controller->MoveWindowsTo(GetPrimaryRootWindow());
642 // Delete most of root window related objects, but don't delete 643 // Delete most of root window related objects, but don't delete
643 // root window itself yet because the stack may be using it. 644 // root window itself yet because the stack may be using it.
644 controller->Shutdown(); 645 controller->Shutdown();
645 base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller); 646 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, controller);
646 } 647 }
647 648
648 void WindowTreeHostManager::OnDisplayRemoved(const gfx::Display& display) { 649 void WindowTreeHostManager::OnDisplayRemoved(const gfx::Display& display) {
649 AshWindowTreeHost* host_to_delete = window_tree_hosts_[display.id()]; 650 AshWindowTreeHost* host_to_delete = window_tree_hosts_[display.id()];
650 CHECK(host_to_delete) << display.ToString(); 651 CHECK(host_to_delete) << display.ToString();
651 652
652 // When the primary root window's display is removed, move the primary 653 // When the primary root window's display is removed, move the primary
653 // root to the other display. 654 // root to the other display.
654 if (primary_display_id == display.id()) { 655 if (primary_display_id == display.id()) {
655 // Temporarily store the primary root window in 656 // Temporarily store the primary root window in
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 SetDisplayPropertiesOnHost(ash_host, display); 834 SetDisplayPropertiesOnHost(ash_host, display);
834 835
835 #if defined(OS_CHROMEOS) 836 #if defined(OS_CHROMEOS)
836 if (switches::ConstrainPointerToRoot()) 837 if (switches::ConstrainPointerToRoot())
837 ash_host->ConfineCursorToRootWindow(); 838 ash_host->ConfineCursorToRootWindow();
838 #endif 839 #endif
839 return ash_host; 840 return ash_host;
840 } 841 }
841 842
842 } // namespace ash 843 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698