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

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

Issue 2701883002: service_manager: More consistent Service lifecycle API (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
« no previous file with comments | « no previous file | chrome/test/base/mash_browser_tests_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 service_manager::mojom::ServiceRequest service_request) { 230 service_manager::mojom::ServiceRequest service_request) {
231 // TODO(sad): Normally, this would be a TYPE_DEFAULT message loop. However, 231 // TODO(sad): Normally, this would be a TYPE_DEFAULT message loop. However,
232 // TYPE_UI is needed for mojo:ui. But it is not known whether the child app is 232 // TYPE_UI is needed for mojo:ui. But it is not known whether the child app is
233 // going to be mojo:ui at this point. So always create a TYPE_UI message loop 233 // going to be mojo:ui at this point. So always create a TYPE_UI message loop
234 // for now. 234 // for now.
235 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); 235 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
236 base::RunLoop run_loop; 236 base::RunLoop run_loop;
237 service_manager::ServiceContext context( 237 service_manager::ServiceContext context(
238 base::MakeUnique<mash::MashPackagedService>(), 238 base::MakeUnique<mash::MashPackagedService>(),
239 std::move(service_request)); 239 std::move(service_request));
240 // Quit the child process if it loses its connection to service manager. 240 // Quit the child process when the service quits.
241 context.SetConnectionLostClosure(run_loop.QuitClosure()); 241 context.SetQuitClosure(run_loop.QuitClosure());
242 run_loop.Run(); 242 run_loop.Run();
243 // |context| must be destroyed before |message_loop|. 243 // |context| must be destroyed before |message_loop|.
244 } 244 }
245 245
246 int MashMain() { 246 int MashMain() {
247 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN) 247 #if !defined(OFFICIAL_BUILD) && defined(OS_WIN)
248 base::RouteStdioToConsole(false); 248 base::RouteStdioToConsole(false);
249 #endif 249 #endif
250 // TODO(sky): wire this up correctly. 250 // TODO(sky): wire this up correctly.
251 service_manager::InitializeLogging(); 251 service_manager::InitializeLogging();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) { 287 command_line->GetSwitchValueASCII(switches::kWaitForDebugger)) {
288 return; 288 return;
289 } 289 }
290 290
291 // 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
292 // printed out by logging is wrong). 292 // printed out by logging is wrong).
293 LOG(WARNING) << "waiting for debugger to attach for service " << service_name 293 LOG(WARNING) << "waiting for debugger to attach for service " << service_name
294 << " pid=" << base::Process::Current().Pid(); 294 << " pid=" << base::Process::Current().Pid();
295 base::debug::WaitForDebugger(120, true); 295 base::debug::WaitForDebugger(120, true);
296 } 296 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/base/mash_browser_tests_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698