OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ | 5 #ifndef CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ |
6 #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ | 6 #define CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ |
7 | 7 |
8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.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/kill.h" | 11 #include "base/process/kill.h" |
12 #include "base/process/launch.h" | 12 #include "base/process/launch.h" |
13 #include "base/process/process.h" | 13 #include "base/process/process.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 18 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 19 #include "mojo/edk/embedder/platform_channel_pair.h" |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class CommandLine; | 22 class CommandLine; |
22 } | 23 } |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 | 26 |
26 // Launches a process asynchronously and notifies the client of the process | 27 // Launches a process asynchronously and notifies the client of the process |
27 // handle when it's available. It's used to avoid blocking the calling thread | 28 // handle when it's available. It's used to avoid blocking the calling thread |
28 // on the OS since often it can take > 100 ms to create the process. | 29 // on the OS since often it can take > 100 ms to create the process. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 92 |
92 // This is always called on the client thread after an attempt | 93 // This is always called on the client thread after an attempt |
93 // to launch the child process on the launcher thread. | 94 // to launch the child process on the launcher thread. |
94 // It makes sure we always perform the necessary cleanup if the | 95 // It makes sure we always perform the necessary cleanup if the |
95 // client went away. | 96 // client went away. |
96 static void DidLaunch(base::WeakPtr<ChildProcessLauncher> instance, | 97 static void DidLaunch(base::WeakPtr<ChildProcessLauncher> instance, |
97 bool terminate_on_shutdown, | 98 bool terminate_on_shutdown, |
98 ZygoteHandle zygote, | 99 ZygoteHandle zygote, |
99 #if defined(OS_ANDROID) | 100 #if defined(OS_ANDROID) |
100 base::ScopedFD ipcfd, | 101 base::ScopedFD ipcfd, |
| 102 base::ScopedFD mojo_fd, |
101 #endif | 103 #endif |
102 base::Process process); | 104 base::Process process); |
103 | 105 |
104 // Notifies the client about the result of the operation. | 106 // Notifies the client about the result of the operation. |
105 void Notify(ZygoteHandle zygote, | 107 void Notify(ZygoteHandle zygote, |
106 #if defined(OS_ANDROID) | 108 #if defined(OS_ANDROID) |
107 base::ScopedFD ipcfd, | 109 base::ScopedFD ipcfd, |
108 #endif | 110 #endif |
109 base::Process process); | 111 base::Process process); |
110 | 112 |
(...skipping 10 matching lines...) Expand all Loading... |
121 BrowserThread::ID client_thread_id_; | 123 BrowserThread::ID client_thread_id_; |
122 base::Process process_; | 124 base::Process process_; |
123 base::TerminationStatus termination_status_; | 125 base::TerminationStatus termination_status_; |
124 int exit_code_; | 126 int exit_code_; |
125 ZygoteHandle zygote_; | 127 ZygoteHandle zygote_; |
126 bool starting_; | 128 bool starting_; |
127 // Controls whether the child process should be terminated on browser | 129 // Controls whether the child process should be terminated on browser |
128 // shutdown. Default behavior is to terminate the child. | 130 // shutdown. Default behavior is to terminate the child. |
129 const bool terminate_child_on_shutdown_; | 131 const bool terminate_child_on_shutdown_; |
130 | 132 |
| 133 // Platform channel used to establish Mojo IPC. |
| 134 mojo::edk::PlatformChannelPair mojo_platform_channel_; |
| 135 |
131 base::WeakPtrFactory<ChildProcessLauncher> weak_factory_; | 136 base::WeakPtrFactory<ChildProcessLauncher> weak_factory_; |
132 | 137 |
133 DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncher); | 138 DISALLOW_COPY_AND_ASSIGN(ChildProcessLauncher); |
134 }; | 139 }; |
135 | 140 |
136 } // namespace content | 141 } // namespace content |
137 | 142 |
138 #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ | 143 #endif // CONTENT_BROWSER_CHILD_PROCESS_LAUNCHER_H_ |
OLD | NEW |