| 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 #ifndef CHROME_APP_MASH_MASH_RUNNER_H_ | 5 #ifndef CHROME_APP_MASH_MASH_RUNNER_H_ |
| 6 #define CHROME_APP_MASH_MASH_RUNNER_H_ | 6 #define CHROME_APP_MASH_MASH_RUNNER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "services/service_manager/public/interfaces/service.mojom.h" | 11 #include "services/service_manager/public/interfaces/service.mojom.h" |
| 12 | 12 |
| 13 namespace service_manager { | |
| 14 class ServiceContext; | |
| 15 } | |
| 16 | |
| 17 // Responsible for running mash, both child and main processes. | 13 // Responsible for running mash, both child and main processes. |
| 18 class MashRunner { | 14 class MashRunner { |
| 19 public: | 15 public: |
| 20 MashRunner(); | 16 MashRunner(); |
| 21 ~MashRunner(); | 17 ~MashRunner(); |
| 22 | 18 |
| 23 // Returns 0 if the process was initialized correctly, or error code on | 19 // Returns 0 if the process was initialized correctly, or error code on |
| 24 // failure. | 20 // failure. |
| 25 int Run(); | 21 int Run(); |
| 26 | 22 |
| 27 private: | 23 private: |
| 28 // Runs the main process, including the service manager. Returns the exit | 24 // Runs the main process, including the service manager. Returns the exit |
| 29 // value for the process. | 25 // value for the process. |
| 30 int RunMain(); | 26 int RunMain(); |
| 31 | 27 |
| 32 // Runs a background service manager in the main process. Returns the exit | 28 // Runs a background service manager in the main process. Returns the exit |
| 33 // value for the process. | 29 // value for the process. |
| 34 int RunServiceManagerInMain(); | 30 int RunServiceManagerInMain(); |
| 35 | 31 |
| 36 // Returns 0 if the child process was initialized correctly, or error code on | 32 // Returns 0 if the child process was initialized correctly, or error code on |
| 37 // failure. | 33 // failure. |
| 38 int RunChild(); | 34 int RunChild(); |
| 39 | 35 |
| 40 void StartChildApp(service_manager::mojom::ServiceRequest service_request); | 36 void StartChildApp(service_manager::mojom::ServiceRequest service_request); |
| 41 | 37 |
| 42 // Context for service manager in the main process. | |
| 43 std::unique_ptr<service_manager::ServiceContext> context_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(MashRunner); | 38 DISALLOW_COPY_AND_ASSIGN(MashRunner); |
| 46 }; | 39 }; |
| 47 | 40 |
| 48 // Called during chrome --mash startup instead of ContentMain(). | 41 // Called during chrome --mash startup instead of ContentMain(). |
| 49 int MashMain(); | 42 int MashMain(); |
| 50 | 43 |
| 51 // Called if the command line isn't mash to potentially wait for a debugger | 44 // Called if the command line isn't mash to potentially wait for a debugger |
| 52 // to attach. | 45 // to attach. |
| 53 void WaitForMashDebuggerIfNecessary(); | 46 void WaitForMashDebuggerIfNecessary(); |
| 54 | 47 |
| 55 #endif // CHROME_APP_MASH_MASH_RUNNER_H_ | 48 #endif // CHROME_APP_MASH_MASH_RUNNER_H_ |
| OLD | NEW |