summaryrefslogtreecommitdiffstats
path: root/content/app
diff options
context:
space:
mode:
authoryfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-28 21:26:23 +0000
committeryfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-28 21:26:23 +0000
commit30935368c9ced14f8f4db5c35a1ab592d3bea328 (patch)
treef3ffe6cce7c9a4806aeb97be8a337c9ec8b3dbb1 /content/app
parentf928b89b660fe3ec965a19d784e80285c2957477 (diff)
downloadchromium_src-30935368c9ced14f8f4db5c35a1ab592d3bea328.zip
chromium_src-30935368c9ced14f8f4db5c35a1ab592d3bea328.tar.gz
chromium_src-30935368c9ced14f8f4db5c35a1ab592d3bea328.tar.bz2
Upstream ChildProcessLauncher changes for Android.
Includes updates to SandboxedProcess* to support passing multiple FDs to child processes. Review URL: https://chromiumcodereview.appspot.com/10696025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/app')
-rw-r--r--content/app/android/sandboxed_process_service.cc33
1 files changed, 21 insertions, 12 deletions
diff --git a/content/app/android/sandboxed_process_service.cc b/content/app/android/sandboxed_process_service.cc
index 7c87d71..58a2687 100644
--- a/content/app/android/sandboxed_process_service.cc
+++ b/content/app/android/sandboxed_process_service.cc
@@ -4,6 +4,7 @@
#include "content/app/android/sandboxed_process_service.h"
+#include "base/android/jni_array.h"
#include "base/global_descriptors_posix.h"
#include "base/logging.h"
#include "content/common/android/surface_texture_peer.h"
@@ -14,6 +15,7 @@
using base::android::AttachCurrentThread;
using base::android::CheckException;
+using base::android::JavaIntArrayToIntVector;
namespace {
@@ -35,7 +37,7 @@ class SurfaceTexturePeerSandboxedImpl : public content::SurfaceTexturePeer {
int secondary_id) {
JNIEnv* env = base::android::AttachCurrentThread();
content::Java_SandboxedProcessService_establishSurfaceTexturePeer(
- env, service_, pid, type, j_surface_texture, primary_id, secondary_id);
+ env, service_, pid, type, j_surface_texture, primary_id, secondary_id);
CheckException(env);
}
@@ -49,18 +51,22 @@ class SurfaceTexturePeerSandboxedImpl : public content::SurfaceTexturePeer {
// Chrome actually uses the renderer code path for all of its sandboxed
// processes such as renderers, plugins, etc.
void InternalInitSandboxedProcess(int ipc_fd,
- int crash_fd,
+ const std::vector<int>& extra_file_ids,
+ const std::vector<int>& extra_file_fds,
JNIEnv* env,
jclass clazz,
jobject context,
jobject service) {
// Set up the IPC file descriptor mapping.
base::GlobalDescriptors::GetInstance()->Set(kPrimaryIPCChannel, ipc_fd);
-#if defined(USE_LINUX_BREAKPAD)
- if (crash_fd > 0) {
- base::GlobalDescriptors::GetInstance()->Set(kCrashDumpSignal, crash_fd);
+ // Register the extra file descriptors.
+ // This usually include the crash dump signals and resource related files.
+ DCHECK(extra_file_fds.size() == extra_file_ids.size());
+ for (size_t i = 0; i < extra_file_ids.size(); ++i) {
+ base::GlobalDescriptors::GetInstance()->Set(extra_file_ids[i],
+ extra_file_fds[i]);
}
-#endif
+
content::SurfaceTexturePeer::InitInstance(
new SurfaceTexturePeerSandboxedImpl(service));
@@ -75,13 +81,16 @@ void InitSandboxedProcess(JNIEnv* env,
jobject context,
jobject service,
jint ipc_fd,
- jint crash_fd) {
- InternalInitSandboxedProcess(static_cast<int>(ipc_fd),
- static_cast<int>(crash_fd), env, clazz, context, service);
+ jintArray j_extra_file_ids,
+ jintArray j_extra_file_fds) {
+ std::vector<int> extra_file_ids;
+ std::vector<int> extra_file_fds;
+ JavaIntArrayToIntVector(env, j_extra_file_ids, &extra_file_ids);
+ JavaIntArrayToIntVector(env, j_extra_file_fds, &extra_file_fds);
- // sandboxed process can't be reused. There is no need to wait for the browser
- // to unbind the service. Just exit and done.
- LOG(INFO) << "SandboxedProcessService: Drop out of SandboxedProcessMain.";
+ InternalInitSandboxedProcess(static_cast<int>(ipc_fd),
+ extra_file_ids, extra_file_fds,
+ env, clazz, context, service);
}
void ExitSandboxedProcess(JNIEnv* env, jclass clazz) {