| 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_RUNNER_CHILD_PROCESS_HOST_H_ | 5 #ifndef MOJO_RUNNER_CHILD_PROCESS_HOST_H_ |
| 6 #define MOJO_RUNNER_CHILD_PROCESS_HOST_H_ | 6 #define MOJO_RUNNER_CHILD_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
| 11 #include "mojo/edk/embedder/channel_info_forward.h" | 11 #include "mojo/runner/child_process.mojom.h" |
| 12 #include "mojo/runner/child_process_host.h" |
| 13 |
| 14 #if defined(USE_CHROME_EDK) |
| 12 #include "mojo/edk/embedder/platform_channel_pair.h" | 15 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 13 #include "mojo/edk/embedder/scoped_platform_handle.h" | 16 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 14 #include "mojo/runner/child_process.mojom.h" | 17 #else |
| 15 #include "mojo/runner/child_process_host.h" | 18 #include "third_party/mojo/src/mojo/edk/embedder/channel_info_forward.h" |
| 19 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h" |
| 20 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h" |
| 21 #endif |
| 16 | 22 |
| 17 namespace mojo { | 23 namespace mojo { |
| 18 namespace runner { | 24 namespace runner { |
| 19 | 25 |
| 20 class Context; | 26 class Context; |
| 21 | 27 |
| 22 // This class represents a "child process host". Handles launching and | 28 // This class represents a "child process host". Handles launching and |
| 23 // connecting a platform-specific "pipe" to the child, and supports joining the | 29 // connecting a platform-specific "pipe" to the child, and supports joining the |
| 24 // child process. Currently runs a single app (loaded from the file system). | 30 // child process. Currently runs a single app (loaded from the file system). |
| 25 // | 31 // |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 64 |
| 59 protected: | 65 protected: |
| 60 // virtual for testing. | 66 // virtual for testing. |
| 61 virtual void DidStart(bool success); | 67 virtual void DidStart(bool success); |
| 62 | 68 |
| 63 private: | 69 private: |
| 64 bool DoLaunch(); | 70 bool DoLaunch(); |
| 65 | 71 |
| 66 void AppCompleted(int32_t result); | 72 void AppCompleted(int32_t result); |
| 67 | 73 |
| 74 #if !defined(USE_CHROME_EDK) |
| 68 // Callback for |embedder::CreateChannel()|. | 75 // Callback for |embedder::CreateChannel()|. |
| 69 void DidCreateChannel(embedder::ChannelInfo* channel_info); | 76 void DidCreateChannel(embedder::ChannelInfo* channel_info); |
| 77 #endif |
| 70 | 78 |
| 71 Context* const context_; | 79 Context* const context_; |
| 72 bool start_sandboxed_; | 80 bool start_sandboxed_; |
| 73 const base::FilePath app_path_; | 81 const base::FilePath app_path_; |
| 74 base::Process child_process_; | 82 base::Process child_process_; |
| 83 ChildControllerPtr controller_; |
| 84 #if defined(USE_CHROME_EDK) |
| 85 edk::PlatformChannelPair platform_channel_pair_; |
| 86 // Platform-specific "pipe" to the child process. Valid immediately after |
| 87 // creation. |
| 88 edk::ScopedPlatformHandle platform_channel_; |
| 89 #else |
| 75 embedder::PlatformChannelPair platform_channel_pair_; | 90 embedder::PlatformChannelPair platform_channel_pair_; |
| 76 ChildControllerPtr controller_; | |
| 77 embedder::ChannelInfo* channel_info_; | 91 embedder::ChannelInfo* channel_info_; |
| 78 ChildController::StartAppCallback on_app_complete_; | |
| 79 | |
| 80 // Platform-specific "pipe" to the child process. Valid immediately after | 92 // Platform-specific "pipe" to the child process. Valid immediately after |
| 81 // creation. | 93 // creation. |
| 82 embedder::ScopedPlatformHandle platform_channel_; | 94 embedder::ScopedPlatformHandle platform_channel_; |
| 95 #endif |
| 96 ChildController::StartAppCallback on_app_complete_; |
| 83 | 97 |
| 84 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); | 98 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); |
| 85 }; | 99 }; |
| 86 | 100 |
| 87 } // namespace runner | 101 } // namespace runner |
| 88 } // namespace mojo | 102 } // namespace mojo |
| 89 | 103 |
| 90 #endif // MOJO_RUNNER_CHILD_PROCESS_HOST_H_ | 104 #endif // MOJO_RUNNER_CHILD_PROCESS_HOST_H_ |
| OLD | NEW |