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