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 // Platform-specific "pipe" to the child process. Valid immediately after |
yzshen1
2015/11/20 20:39:55
nit: Please update the comment since it is no long
jam
2015/11/21 01:26:09
Done.
| |
87 // creation. | 97 // creation. |
88 embedder::ScopedPlatformHandle platform_channel_; | 98 mojo::ScopedMessagePipeHandle child_message_pipe_; |
89 | 99 |
90 base::WeakPtrFactory<ChildProcessHost> weak_factory_; | 100 base::WeakPtrFactory<ChildProcessHost> weak_factory_; |
91 | 101 |
92 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); | 102 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); |
93 }; | 103 }; |
94 | 104 |
95 } // namespace runner | 105 } // namespace runner |
96 } // namespace mojo | 106 } // namespace mojo |
97 | 107 |
98 #endif // MOJO_RUNNER_HOST_CHILD_PROCESS_HOST_H_ | 108 #endif // MOJO_RUNNER_HOST_CHILD_PROCESS_HOST_H_ |
OLD | NEW |