| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/service_manager/public/cpp/service_runner.h" | 5 #include "services/service_manager/public/cpp/service_runner.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Note that we destruct the message loop first because that might trigger | 64 // Note that we destruct the message loop first because that might trigger |
| 65 // connection error handlers and they might access objects created by the | 65 // connection error handlers and they might access objects created by the |
| 66 // service. | 66 // service. |
| 67 loop.reset(); | 67 loop.reset(); |
| 68 context_.reset(); | 68 context_.reset(); |
| 69 } | 69 } |
| 70 return MOJO_RESULT_OK; | 70 return MOJO_RESULT_OK; |
| 71 } | 71 } |
| 72 | 72 |
| 73 MojoResult ServiceRunner::Run(MojoHandle service_request_handle) { | 73 MojoResult ServiceRunner::Run(MojoHandle service_request_handle) { |
| 74 return Run(service_request_handle, false); | 74 bool init_base = true; |
| 75 if (base::CommandLine::InitializedForCurrentProcess()) { |
| 76 init_base = |
| 77 !base::CommandLine::ForCurrentProcess()->HasSwitch("single-process"); |
| 78 } |
| 79 return Run(service_request_handle, init_base); |
| 75 } | 80 } |
| 76 | 81 |
| 77 void ServiceRunner::Quit() { | 82 void ServiceRunner::Quit() { |
| 78 base::MessageLoop::current()->QuitWhenIdle(); | 83 base::MessageLoop::current()->QuitWhenIdle(); |
| 79 } | 84 } |
| 80 | 85 |
| 81 } // namespace service_manager | 86 } // namespace service_manager |
| OLD | NEW |