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