Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / browser / android / child_process_launcher_android.h
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_
6 #define CONTENT_BROWSER_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_
7
8 #include <jni.h>
9
10 #include "base/callback.h"
11 #include "base/command_line.h"
12 #include "base/platform_file.h"
13 #include "base/process/process.h"
14 #include "content/public/browser/file_descriptor_info.h"
15
16 namespace content {
17
18 typedef base::Callback<void(base::ProcessHandle)> StartChildProcessCallback;
19 // Starts a process as a child process spawned by the Android
20 // ActivityManager.
21 // The created process handle is returned to the |callback| on success, 0 is
22 // retuned if the process could not be created.
23 void StartChildProcess(
24     const base::CommandLine::StringVector& argv,
25     int child_process_id,
26     const std::vector<FileDescriptorInfo>& files_to_register,
27     const StartChildProcessCallback& callback);
28
29 // Stops a child process based on the handle returned form
30 // StartChildProcess.
31 void StopChildProcess(base::ProcessHandle handle);
32
33 bool IsChildProcessOomProtected(base::ProcessHandle handle);
34
35 void SetChildProcessInForeground(base::ProcessHandle handle,
36                                  bool in_foreground);
37
38 void RegisterViewSurface(int surface_id, jobject j_surface);
39
40 void UnregisterViewSurface(int surface_id);
41
42 void RegisterChildProcessSurfaceTexture(int surface_texture_id,
43                                         int child_process_id,
44                                         jobject j_surface_texture);
45
46 void UnregisterChildProcessSurfaceTexture(int surface_texture_id,
47                                           int child_process_id);
48
49 bool RegisterChildProcessLauncher(JNIEnv* env);
50
51 }  // namespace content
52
53 #endif  // CONTENT_BROWSER_ANDROID_CHILD_PROCESS_LAUNCHER_ANDROID_H_