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

Side by Side Diff: ash/mus/window_manager_application.cc

Issue 2861773003: chromeos: Fix crash when clicking on networking menu under mash (Closed)
Patch Set: deps Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mus/window_manager_application.h" 5 #include "ash/mus/window_manager_application.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/mojo_interface_factory.h" 9 #include "ash/mojo_interface_factory.h"
10 #include "ash/mus/network_connect_delegate_mus.h" 10 #include "ash/mus/network_connect_delegate_mus.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 statistics_provider_->SetMachineStatistic("keyboard_layout", ""); 88 statistics_provider_->SetMachineStatistic("keyboard_layout", "");
89 89
90 window_manager_->Init(std::move(window_tree_client), blocking_pool, 90 window_manager_->Init(std::move(window_tree_client), blocking_pool,
91 std::move(shell_delegate_)); 91 std::move(shell_delegate_));
92 } 92 }
93 93
94 void WindowManagerApplication::InitializeComponents(bool init_network_handler) { 94 void WindowManagerApplication::InitializeComponents(bool init_network_handler) {
95 message_center::MessageCenter::Initialize(); 95 message_center::MessageCenter::Initialize();
96 96
97 // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but 97 // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but
98 // before WindowManager::Init(). 98 // before WindowManager::Init(). Tests might initialize their own instance.
99 chromeos::DBusThreadManager::Initialize( 99 if (!chromeos::DBusThreadManager::IsInitialized()) {
100 chromeos::DBusThreadManager::PROCESS_ASH); 100 chromeos::DBusThreadManager::Initialize(
101 chromeos::DBusThreadManager::PROCESS_ASH);
102 dbus_thread_manager_initialized_ = true;
103 }
101 104
102 // See ChromeBrowserMainPartsChromeos for ordering details. 105 // See ChromeBrowserMainPartsChromeos for ordering details.
103 bluez::BluezDBusManager::Initialize( 106 bluez::BluezDBusManager::Initialize(
104 chromeos::DBusThreadManager::Get()->GetSystemBus(), 107 chromeos::DBusThreadManager::Get()->GetSystemBus(),
105 chromeos::DBusThreadManager::Get()->IsUsingFakes()); 108 chromeos::DBusThreadManager::Get()->IsUsingFakes());
106 if (init_network_handler) 109 if (init_network_handler) {
107 chromeos::NetworkHandler::Initialize(); 110 chromeos::NetworkHandler::Initialize();
stevenjb 2017/05/03 22:11:39 Should we also check chromeos::NetworkHandler::IsI
James Cook 2017/05/03 22:29:32 Done.
111 network_handler_initialized_ = true;
112 }
108 network_connect_delegate_.reset(new NetworkConnectDelegateMus()); 113 network_connect_delegate_.reset(new NetworkConnectDelegateMus());
109 chromeos::NetworkConnect::Initialize(network_connect_delegate_.get()); 114 chromeos::NetworkConnect::Initialize(network_connect_delegate_.get());
110 // TODO(jamescook): Initialize real audio handler. 115 // TODO(jamescook): Initialize real audio handler.
111 chromeos::CrasAudioHandler::InitializeForTesting(); 116 chromeos::CrasAudioHandler::InitializeForTesting();
112 } 117 }
113 118
114 void WindowManagerApplication::ShutdownComponents() { 119 void WindowManagerApplication::ShutdownComponents() {
115 // NOTE: PowerStatus is shutdown by Shell. 120 // NOTE: PowerStatus is shutdown by Shell.
116 chromeos::CrasAudioHandler::Shutdown(); 121 chromeos::CrasAudioHandler::Shutdown();
117 chromeos::NetworkConnect::Shutdown(); 122 chromeos::NetworkConnect::Shutdown();
118 network_connect_delegate_.reset(); 123 network_connect_delegate_.reset();
119 // We may not have started the NetworkHandler. 124 // We may not have started the NetworkHandler.
120 if (chromeos::NetworkHandler::IsInitialized()) 125 if (network_handler_initialized_)
121 chromeos::NetworkHandler::Shutdown(); 126 chromeos::NetworkHandler::Shutdown();
122 device::BluetoothAdapterFactory::Shutdown(); 127 device::BluetoothAdapterFactory::Shutdown();
123 bluez::BluezDBusManager::Shutdown(); 128 bluez::BluezDBusManager::Shutdown();
124 chromeos::DBusThreadManager::Shutdown(); 129 if (dbus_thread_manager_initialized_)
130 chromeos::DBusThreadManager::Shutdown();
125 message_center::MessageCenter::Shutdown(); 131 message_center::MessageCenter::Shutdown();
126 } 132 }
127 133
128 void WindowManagerApplication::OnStart() { 134 void WindowManagerApplication::OnStart() {
129 mojo_interface_factory::RegisterInterfaces( 135 mojo_interface_factory::RegisterInterfaces(
130 &registry_, base::ThreadTaskRunnerHandle::Get()); 136 &registry_, base::ThreadTaskRunnerHandle::Get());
131 137
132 aura_init_ = base::MakeUnique<views::AuraInit>( 138 aura_init_ = base::MakeUnique<views::AuraInit>(
133 context()->connector(), context()->identity(), "ash_mus_resources.pak", 139 context()->connector(), context()->identity(), "ash_mus_resources.pak",
134 "ash_mus_resources_200.pak", nullptr, 140 "ash_mus_resources_200.pak", nullptr,
(...skipping 21 matching lines...) Expand all
156 void WindowManagerApplication::OnBindInterface( 162 void WindowManagerApplication::OnBindInterface(
157 const service_manager::BindSourceInfo& source_info, 163 const service_manager::BindSourceInfo& source_info,
158 const std::string& interface_name, 164 const std::string& interface_name,
159 mojo::ScopedMessagePipeHandle interface_pipe) { 165 mojo::ScopedMessagePipeHandle interface_pipe) {
160 registry_.BindInterface(source_info, interface_name, 166 registry_.BindInterface(source_info, interface_name,
161 std::move(interface_pipe)); 167 std::move(interface_pipe));
162 } 168 }
163 169
164 } // namespace mus 170 } // namespace mus
165 } // namespace ash 171 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698