| 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_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_ | 6 #define CONTENT_BROWSER_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/process/process.h" | 12 #include "base/process/process.h" |
| 13 #include "content/public/browser/file_descriptor_info.h" | 13 #include "content/public/browser/file_descriptor_info.h" |
| 14 | 14 |
| 15 // Contains the methods either being called from or calling to | 15 // Contains the methods either being called from or calling to |
| 16 // ChildProcessLauncher.java. | 16 // ChildProcessLauncher.java. |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 | 19 |
| 20 typedef base::Callback<void(base::ProcessHandle, int /* launch result */)> | 20 typedef base::Callback<void(base::ProcessHandle, int /* launch result */)> |
| 21 StartChildProcessCallback; | 21 StartChildProcessCallback; |
| 22 | 22 |
| 23 // Starts a process as a child process spawned by the Android ActivityManager. | 23 // Starts a process as a child process spawned by the Android ActivityManager. |
| 24 // The created process handle is returned to the |callback| on success, 0 is | 24 // The created process handle is returned to the |callback| on success, 0 is |
| 25 // returned if the process could not be created. | 25 // returned if the process could not be created. |
| 26 void StartChildProcess( | 26 void StartChildProcess(const base::CommandLine::StringVector& argv, |
| 27 const base::CommandLine::StringVector& argv, | 27 int child_process_id, |
| 28 int child_process_id, | 28 FileDescriptorInfo* files_to_register, |
| 29 FileDescriptorInfo* files_to_register, | 29 int child_process_param_id, |
| 30 const StartChildProcessCallback& callback); | 30 const StartChildProcessCallback& callback); |
| 31 | 31 |
| 32 // Stops a child process based on the handle returned from StartChildProcess. | 32 // Stops a child process based on the handle returned from StartChildProcess. |
| 33 void StopChildProcess(base::ProcessHandle handle); | 33 void StopChildProcess(base::ProcessHandle handle); |
| 34 | 34 |
| 35 bool IsChildProcessOomProtected(base::ProcessHandle handle); | 35 bool IsChildProcessOomProtected(base::ProcessHandle handle); |
| 36 | 36 |
| 37 void SetChildProcessInForeground(base::ProcessHandle handle, | 37 void SetChildProcessInForeground(base::ProcessHandle handle, |
| 38 bool in_foreground); | 38 bool in_foreground); |
| 39 | 39 |
| 40 bool RegisterChildProcessLauncher(JNIEnv* env); | 40 bool RegisterChildProcessLauncher(JNIEnv* env); |
| 41 | 41 |
| 42 } // namespace content | 42 } // namespace content |
| 43 | 43 |
| 44 #endif // CONTENT_BROWSER_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_ | 44 #endif // CONTENT_BROWSER_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_ |
| OLD | NEW |