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 "chrome/app/mash/mash_runner.h" | 5 #include "chrome/app/mash/mash_runner.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 // Quits |run_loop| if the |identity| of the quitting service is critical to the | 126 // Quits |run_loop| if the |identity| of the quitting service is critical to the |
127 // system (e.g. the window manager). Used in the main process. | 127 // system (e.g. the window manager). Used in the main process. |
128 void OnInstanceQuitInMain(base::RunLoop* run_loop, | 128 void OnInstanceQuitInMain(base::RunLoop* run_loop, |
129 int* exit_value, | 129 int* exit_value, |
130 const service_manager::Identity& identity) { | 130 const service_manager::Identity& identity) { |
131 DCHECK(exit_value); | 131 DCHECK(exit_value); |
132 DCHECK(run_loop); | 132 DCHECK(run_loop); |
133 | 133 |
134 if (identity.name() != mash::common::GetWindowManagerServiceName() && | 134 if (identity.name() != mash::common::GetWindowManagerServiceName() && |
135 identity.name() != ui::mojom::kServiceName) { | 135 identity.name() != ui::mojom::kServiceName && |
| 136 identity.name() != content::mojom::kBrowserServiceName) { |
136 return; | 137 return; |
137 } | 138 } |
138 | 139 |
139 LOG(ERROR) << "Main process exiting because service " << identity.name() | 140 LOG(ERROR) << "Main process exiting because service " << identity.name() |
140 << " quit unexpectedly."; | 141 << " quit unexpectedly."; |
141 *exit_value = 1; | 142 *exit_value = 1; |
142 run_loop->Quit(); | 143 run_loop->Quit(); |
143 } | 144 } |
144 | 145 |
145 } // namespace | 146 } // namespace |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 base::RunLoop run_loop; | 201 base::RunLoop run_loop; |
201 int exit_value = 0; | 202 int exit_value = 0; |
202 background_service_manager.SetInstanceQuitCallback( | 203 background_service_manager.SetInstanceQuitCallback( |
203 base::Bind(&OnInstanceQuitInMain, &run_loop, &exit_value)); | 204 base::Bind(&OnInstanceQuitInMain, &run_loop, &exit_value)); |
204 | 205 |
205 // Ping services that we know we want to launch on startup (UI service, | 206 // Ping services that we know we want to launch on startup (UI service, |
206 // window manager, quick launch app). | 207 // window manager, quick launch app). |
207 context.connector()->Connect(ui::mojom::kServiceName); | 208 context.connector()->Connect(ui::mojom::kServiceName); |
208 context.connector()->Connect(mash::common::GetWindowManagerServiceName()); | 209 context.connector()->Connect(mash::common::GetWindowManagerServiceName()); |
209 context.connector()->Connect(mash::quick_launch::mojom::kServiceName); | 210 context.connector()->Connect(mash::quick_launch::mojom::kServiceName); |
| 211 context.connector()->Connect(content::mojom::kBrowserServiceName); |
210 | 212 |
211 run_loop.Run(); | 213 run_loop.Run(); |
212 | 214 |
213 // |context| must be destroyed before the message loop. | 215 // |context| must be destroyed before the message loop. |
214 return exit_value; | 216 return exit_value; |
215 } | 217 } |
216 | 218 |
217 int MashRunner::RunChild() { | 219 int MashRunner::RunChild() { |
218 service_manager::WaitForDebuggerIfNecessary(); | 220 service_manager::WaitForDebuggerIfNecessary(); |
219 | 221 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) { | 287 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) { |
286 return; | 288 return; |
287 } | 289 } |
288 | 290 |
289 // Include the pid as logging may not have been initialized yet (the pid | 291 // Include the pid as logging may not have been initialized yet (the pid |
290 // printed out by logging is wrong). | 292 // printed out by logging is wrong). |
291 LOG(WARNING) << "waiting for debugger to attach for service " << service_name | 293 LOG(WARNING) << "waiting for debugger to attach for service " << service_name |
292 << " pid=" << base::Process::Current().Pid(); | 294 << " pid=" << base::Process::Current().Pid(); |
293 base::debug::WaitForDebugger(120, true); | 295 base::debug::WaitForDebugger(120, true); |
294 } | 296 } |
OLD | NEW |