| 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 #ifndef MOJO_SHELL_OUT_OF_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ | 5 #ifndef MOJO_SHELL_OUT_OF_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ |
| 6 #define MOJO_SHELL_OUT_OF_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ | 6 #define MOJO_SHELL_OUT_OF_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "mojo/shell/app_child_process.mojom.h" | 11 #include "mojo/shell/app_child_process.mojom.h" |
| 12 #include "mojo/shell/app_child_process_host.h" | 12 #include "mojo/shell/app_child_process_host.h" |
| 13 #include "mojo/shell/dynamic_service_runner.h" | 13 #include "mojo/shell/dynamic_service_runner.h" |
| 14 #include "mojo/shell/keep_alive.h" | |
| 15 | 14 |
| 16 namespace mojo { | 15 namespace mojo { |
| 17 namespace shell { | 16 namespace shell { |
| 18 | 17 |
| 19 // An implementation of |DynamicServiceRunner| that loads/runs the given app | 18 // An implementation of |DynamicServiceRunner| that loads/runs the given app |
| 20 // (from the file system) in a separate process (of its own). | 19 // (from the file system) in a separate process (of its own). |
| 21 class OutOfProcessDynamicServiceRunner | 20 class OutOfProcessDynamicServiceRunner |
| 22 : public DynamicServiceRunner, | 21 : public DynamicServiceRunner, |
| 23 public AppChildControllerClient { | 22 public AppChildControllerClient { |
| 24 public: | 23 public: |
| 25 explicit OutOfProcessDynamicServiceRunner(Context* context); | 24 explicit OutOfProcessDynamicServiceRunner(Context* context); |
| 26 virtual ~OutOfProcessDynamicServiceRunner(); | 25 virtual ~OutOfProcessDynamicServiceRunner(); |
| 27 | 26 |
| 28 // |DynamicServiceRunner| method: | 27 // |DynamicServiceRunner| method: |
| 29 virtual void Start(const base::FilePath& app_path, | 28 virtual void Start(const base::FilePath& app_path, |
| 30 ScopedMessagePipeHandle service_handle, | 29 ScopedMessagePipeHandle service_handle, |
| 31 const base::Closure& app_completed_callback) OVERRIDE; | 30 const base::Closure& app_completed_callback) OVERRIDE; |
| 32 | 31 |
| 33 private: | 32 private: |
| 34 // |AppChildControllerClient| method: | 33 // |AppChildControllerClient| method: |
| 35 virtual void AppCompleted(int32_t result) OVERRIDE; | 34 virtual void AppCompleted(int32_t result) OVERRIDE; |
| 36 | 35 |
| 37 Context* const context_; | 36 Context* const context_; |
| 38 | 37 |
| 39 KeepAlive keep_alive_; | |
| 40 base::FilePath app_path_; | 38 base::FilePath app_path_; |
| 41 ScopedMessagePipeHandle service_handle_; | 39 ScopedMessagePipeHandle service_handle_; |
| 42 base::Closure app_completed_callback_; | 40 base::Closure app_completed_callback_; |
| 43 | 41 |
| 44 scoped_ptr<AppChildProcessHost> app_child_process_host_; | 42 scoped_ptr<AppChildProcessHost> app_child_process_host_; |
| 45 | 43 |
| 46 DISALLOW_COPY_AND_ASSIGN(OutOfProcessDynamicServiceRunner); | 44 DISALLOW_COPY_AND_ASSIGN(OutOfProcessDynamicServiceRunner); |
| 47 }; | 45 }; |
| 48 | 46 |
| 49 typedef DynamicServiceRunnerFactoryImpl<OutOfProcessDynamicServiceRunner> | 47 typedef DynamicServiceRunnerFactoryImpl<OutOfProcessDynamicServiceRunner> |
| 50 OutOfProcessDynamicServiceRunnerFactory; | 48 OutOfProcessDynamicServiceRunnerFactory; |
| 51 | 49 |
| 52 } // namespace shell | 50 } // namespace shell |
| 53 } // namespace mojo | 51 } // namespace mojo |
| 54 | 52 |
| 55 #endif // MOJO_SHELL_OUT_OF_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ | 53 #endif // MOJO_SHELL_OUT_OF_PROCESS_DYNAMIC_SERVICE_RUNNER_H_ |
| OLD | NEW |