| 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 #include "ui/gl/android/scoped_java_surface.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 typedef base::Callback<void(base::ProcessHandle)> StartChildProcessCallback; | 18 typedef base::Callback<void(base::ProcessHandle)> StartChildProcessCallback; |
| 18 // Starts a process as a child process spawned by the Android | 19 // Starts a process as a child process spawned by the Android |
| 19 // ActivityManager. | 20 // ActivityManager. |
| 20 // The created process handle is returned to the |callback| on success, 0 is | 21 // The created process handle is returned to the |callback| on success, 0 is |
| 21 // retuned if the process could not be created. | 22 // retuned if the process could not be created. |
| 22 void StartChildProcess(const base::CommandLine::StringVector& argv, | 23 void StartChildProcess(const base::CommandLine::StringVector& argv, |
| 23 int child_process_id, | 24 int child_process_id, |
| 24 const scoped_ptr<FileDescriptorInfo> files_to_register, | 25 const scoped_ptr<FileDescriptorInfo> files_to_register, |
| 25 const StartChildProcessCallback& callback); | 26 const StartChildProcessCallback& callback); |
| 26 | 27 |
| 27 // Stops a child process based on the handle returned form | 28 // Stops a child process based on the handle returned form |
| 28 // StartChildProcess. | 29 // StartChildProcess. |
| 29 void StopChildProcess(base::ProcessHandle handle); | 30 void StopChildProcess(base::ProcessHandle handle); |
| 30 | 31 |
| 31 bool IsChildProcessOomProtected(base::ProcessHandle handle); | 32 bool IsChildProcessOomProtected(base::ProcessHandle handle); |
| 32 | 33 |
| 33 void SetChildProcessInForeground(base::ProcessHandle handle, | 34 void SetChildProcessInForeground(base::ProcessHandle handle, |
| 34 bool in_foreground); | 35 bool in_foreground); |
| 35 | 36 |
| 36 void RegisterViewSurface(int surface_id, jobject j_surface); | 37 void RegisterViewSurface(int surface_id, jobject j_surface); |
| 37 | 38 |
| 38 void UnregisterViewSurface(int surface_id); | 39 void UnregisterViewSurface(int surface_id); |
| 39 | 40 |
| 40 void RegisterChildProcessSurfaceTexture(int surface_texture_id, | 41 void RegisterSurfaceTexture(int surface_texture_id, |
| 41 int child_process_id, | 42 int client_id, |
| 42 jobject j_surface_texture); | 43 jobject j_surface_texture); |
| 43 | 44 |
| 44 void UnregisterChildProcessSurfaceTexture(int surface_texture_id, | 45 void UnregisterSurfaceTexture(int surface_texture_id, int client_id); |
| 45 int child_process_id); | 46 |
| 47 gfx::ScopedJavaSurface GetSurfaceTextureSurface(int surface_texture_id, |
| 48 int client_id); |
| 46 | 49 |
| 47 bool RegisterChildProcessLauncher(JNIEnv* env); | 50 bool RegisterChildProcessLauncher(JNIEnv* env); |
| 48 | 51 |
| 49 } // namespace content | 52 } // namespace content |
| 50 | 53 |
| 51 #endif // CONTENT_BROWSER_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_ | 54 #endif // CONTENT_BROWSER_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_ |
| OLD | NEW |