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

Side by Side Diff: chrome/app/mash/mash_runner.cc

Issue 2686003002: mash: Exit main process if content_browser service crashes (Closed)
Patch Set: Created 3 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 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 // Quits |run_loop| if the |identity| of the quitting service is critical to the 125 // Quits |run_loop| if the |identity| of the quitting service is critical to the
126 // system (e.g. the window manager). Used in the main process. 126 // system (e.g. the window manager). Used in the main process.
127 void OnInstanceQuitInMain(base::RunLoop* run_loop, 127 void OnInstanceQuitInMain(base::RunLoop* run_loop,
128 int* exit_value, 128 int* exit_value,
129 const service_manager::Identity& identity) { 129 const service_manager::Identity& identity) {
130 DCHECK(exit_value); 130 DCHECK(exit_value);
131 DCHECK(run_loop); 131 DCHECK(run_loop);
132 132
133 if (identity.name() != mash::common::GetWindowManagerServiceName() && 133 if (identity.name() != mash::common::GetWindowManagerServiceName() &&
134 identity.name() != ui::mojom::kServiceName) { 134 identity.name() != ui::mojom::kServiceName &&
135 identity.name() != content::mojom::kBrowserServiceName) {
135 return; 136 return;
136 } 137 }
137 138
138 LOG(ERROR) << "Main process exiting because service " << identity.name() 139 LOG(ERROR) << "Main process exiting because service " << identity.name()
139 << " quit unexpectedly."; 140 << " quit unexpectedly.";
140 *exit_value = 1; 141 *exit_value = 1;
141 run_loop->Quit(); 142 run_loop->Quit();
142 } 143 }
143 144
144 } // namespace 145 } // namespace
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 base::RunLoop run_loop; 198 base::RunLoop run_loop;
198 int exit_value = 0; 199 int exit_value = 0;
199 background_service_manager.SetInstanceQuitCallback( 200 background_service_manager.SetInstanceQuitCallback(
200 base::Bind(&OnInstanceQuitInMain, &run_loop, &exit_value)); 201 base::Bind(&OnInstanceQuitInMain, &run_loop, &exit_value));
201 202
202 // Ping services that we know we want to launch on startup (UI service, 203 // Ping services that we know we want to launch on startup (UI service,
203 // window manager, quick launch app). 204 // window manager, quick launch app).
204 context_->connector()->Connect(ui::mojom::kServiceName); 205 context_->connector()->Connect(ui::mojom::kServiceName);
205 context_->connector()->Connect(mash::common::GetWindowManagerServiceName()); 206 context_->connector()->Connect(mash::common::GetWindowManagerServiceName());
206 context_->connector()->Connect(mash::quick_launch::mojom::kServiceName); 207 context_->connector()->Connect(mash::quick_launch::mojom::kServiceName);
208 context_->connector()->Connect(content::mojom::kBrowserServiceName);
207 209
208 run_loop.Run(); 210 run_loop.Run();
209 211
210 context_.reset(); 212 context_.reset();
211 return exit_value; 213 return exit_value;
212 } 214 }
213 215
214 int MashRunner::RunChild() { 216 int MashRunner::RunChild() {
215 service_manager::WaitForDebuggerIfNecessary(); 217 service_manager::WaitForDebuggerIfNecessary();
216 218
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« chrome/app/mash/chrome_mash_manifest.json ('K') | « chrome/app/mash/chrome_mash_manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698