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_HOST_CHILD_PROCESS_HOST_H_ | 5 #ifndef MOJO_RUNNER_HOST_CHILD_PROCESS_HOST_H_ |
6 #define MOJO_RUNNER_HOST_CHILD_PROCESS_HOST_H_ | 6 #define MOJO_RUNNER_HOST_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/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/process/process.h" | 11 #include "base/process/process.h" |
12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 14 #include "mojo/public/cpp/system/message_pipe.h" |
13 #include "mojo/runner/child/child_controller.mojom.h" | 15 #include "mojo/runner/child/child_controller.mojom.h" |
14 #include "mojo/runner/host/child_process_host.h" | 16 #include "mojo/runner/host/child_process_host.h" |
15 #include "third_party/mojo/src/mojo/edk/embedder/channel_info_forward.h" | 17 #include "third_party/mojo/src/mojo/edk/embedder/channel_info_forward.h" |
16 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h" | 18 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h" |
17 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h" | 19 #include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h" |
18 | 20 |
19 namespace base { | 21 namespace base { |
20 class TaskRunner; | 22 class TaskRunner; |
21 } | 23 } |
22 | 24 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 virtual void DidStart(); | 65 virtual void DidStart(); |
64 | 66 |
65 private: | 67 private: |
66 void DoLaunch(); | 68 void DoLaunch(); |
67 | 69 |
68 void AppCompleted(int32_t result); | 70 void AppCompleted(int32_t result); |
69 | 71 |
70 // Callback for |embedder::CreateChannel()|. | 72 // Callback for |embedder::CreateChannel()|. |
71 void DidCreateChannel(embedder::ChannelInfo* channel_info); | 73 void DidCreateChannel(embedder::ChannelInfo* channel_info); |
72 | 74 |
73 base::TaskRunner* const launch_process_runner_; | 75 scoped_refptr<base::TaskRunner> launch_process_runner_; |
74 bool start_sandboxed_; | 76 bool start_sandboxed_; |
75 const base::FilePath app_path_; | 77 const base::FilePath app_path_; |
76 base::Process child_process_; | 78 base::Process child_process_; |
| 79 // Used for the ChildController binding. |
77 embedder::PlatformChannelPair platform_channel_pair_; | 80 embedder::PlatformChannelPair platform_channel_pair_; |
78 ChildControllerPtr controller_; | 81 ChildControllerPtr controller_; |
79 embedder::ChannelInfo* channel_info_; | 82 embedder::ChannelInfo* channel_info_; |
80 ChildController::StartAppCallback on_app_complete_; | 83 ChildController::StartAppCallback on_app_complete_; |
| 84 embedder::HandlePassingInformation handle_passing_info_; |
| 85 |
| 86 #if defined(OS_WIN) |
| 87 // Used only when --use-new-edk is specified, as a communication channel for |
| 88 // TokenSerializer. |
| 89 scoped_ptr<edk::PlatformChannelPair> serializer_platform_channel_pair_; |
| 90 #endif |
81 | 91 |
82 // Since Start() calls a method on another thread, we use an event to block | 92 // Since Start() calls a method on another thread, we use an event to block |
83 // the main thread if it tries to destruct |this| while launching the process. | 93 // the main thread if it tries to destruct |this| while launching the process. |
84 base::WaitableEvent start_child_process_event_; | 94 base::WaitableEvent start_child_process_event_; |
85 | 95 |
86 // Platform-specific "pipe" to the child process. Valid immediately after | 96 // A message pipe to the child process. Valid immediately after creation. |
87 // creation. | 97 mojo::ScopedMessagePipeHandle child_message_pipe_; |
88 embedder::ScopedPlatformHandle platform_channel_; | |
89 | 98 |
90 base::WeakPtrFactory<ChildProcessHost> weak_factory_; | 99 base::WeakPtrFactory<ChildProcessHost> weak_factory_; |
91 | 100 |
92 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); | 101 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); |
93 }; | 102 }; |
94 | 103 |
95 } // namespace runner | 104 } // namespace runner |
96 } // namespace mojo | 105 } // namespace mojo |
97 | 106 |
98 #endif // MOJO_RUNNER_HOST_CHILD_PROCESS_HOST_H_ | 107 #endif // MOJO_RUNNER_HOST_CHILD_PROCESS_HOST_H_ |
OLD | NEW |