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