OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mash/quick_launch/quick_launch.h" | 5 #include "mash/quick_launch/quick_launch.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 windows_.erase(it); | 168 windows_.erase(it); |
169 if (windows_.empty() && base::RunLoop::IsRunningOnCurrentThread()) | 169 if (windows_.empty() && base::RunLoop::IsRunningOnCurrentThread()) |
170 base::MessageLoop::current()->QuitWhenIdle(); | 170 base::MessageLoop::current()->QuitWhenIdle(); |
171 } | 171 } |
172 | 172 |
173 void QuickLaunch::OnStart() { | 173 void QuickLaunch::OnStart() { |
174 aura_init_ = base::MakeUnique<views::AuraInit>( | 174 aura_init_ = base::MakeUnique<views::AuraInit>( |
175 context()->connector(), context()->identity(), "views_mus_resources.pak", | 175 context()->connector(), context()->identity(), "views_mus_resources.pak", |
176 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); | 176 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); |
177 | 177 |
| 178 // If AuraInit was unable to initialize there is no longer a peer connection. |
| 179 // The ServiceManager is in the process of shutting down, however we haven't |
| 180 // been notified yet. Close our ServiceContext and shutdown. |
| 181 if (!aura_init_->initialized()) { |
| 182 context()->QuitNow(); |
| 183 return; |
| 184 } |
| 185 |
178 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); | 186 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); |
179 } | 187 } |
180 | 188 |
181 void QuickLaunch::OnBindInterface( | 189 void QuickLaunch::OnBindInterface( |
182 const service_manager::BindSourceInfo& source_info, | 190 const service_manager::BindSourceInfo& source_info, |
183 const std::string& interface_name, | 191 const std::string& interface_name, |
184 mojo::ScopedMessagePipeHandle interface_pipe) { | 192 mojo::ScopedMessagePipeHandle interface_pipe) { |
185 registry_.BindInterface(source_info, interface_name, | 193 registry_.BindInterface(source_info, interface_name, |
186 std::move(interface_pipe)); | 194 std::move(interface_pipe)); |
187 } | 195 } |
(...skipping 16 matching lines...) Expand all Loading... |
204 windows_.push_back(window); | 212 windows_.push_back(window); |
205 } | 213 } |
206 | 214 |
207 void QuickLaunch::Create(const service_manager::BindSourceInfo& source_info, | 215 void QuickLaunch::Create(const service_manager::BindSourceInfo& source_info, |
208 ::mash::mojom::LaunchableRequest request) { | 216 ::mash::mojom::LaunchableRequest request) { |
209 bindings_.AddBinding(this, std::move(request)); | 217 bindings_.AddBinding(this, std::move(request)); |
210 } | 218 } |
211 | 219 |
212 } // namespace quick_launch | 220 } // namespace quick_launch |
213 } // namespace mash | 221 } // namespace mash |
OLD | NEW |