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