Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: content/browser/android/sandboxed_process_launcher.cc

Issue 10541110: Added sandboxed process launcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 #include "content/browser/android/sandboxed_process_launcher.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h"
9 #include "base/logging.h"
10 #include "jni/sandboxed_process_launcher_jni.h"
11
12 using base::android::AttachCurrentThread;
13 using base::android::ToJavaArrayOfStrings;
14 using base::android::ScopedJavaLocalRef;
15
16 static void OnSandboxedProcessStarted(JNIEnv*,
17 jclass,
18 jint client_context,
19 jint pid) {
20 reinterpret_cast<content::SandboxedProcessClient*>(
jam 2012/06/12 17:24:11 nit: indentation si off
michaelbai 2012/06/12 19:44:26 Done.
21 client_context)->OnSandboxedProcessStarted(pid);
22 }
23
24 namespace content {
25
26 ScopedJavaLocalRef<jobject> StartSandboxedProcess(
27 const CommandLine::StringVector& argv,
28 int ipc_fd,
29 int crash_fd,
30 SandboxedProcessClient* client) {
31 JNIEnv* env = AttachCurrentThread();
32 DCHECK(env);
33
34 // Create the Command line String[]
35 ScopedJavaLocalRef<jobjectArray> j_argv = ToJavaArrayOfStrings(env, argv);
36
37 return Java_SandboxedProcessLauncher_start(env,
38 base::android::GetApplicationContext(),
39 static_cast<jobjectArray>(j_argv.obj()),
40 static_cast<jint>(ipc_fd),
41 static_cast<jint>(crash_fd),
42 reinterpret_cast<jint>(client));
43 }
44
45 void CancelStartSandboxedProcess(
46 const base::android::JavaRef<jobject>& connection) {
47 Java_SandboxedProcessLauncher_cancelStart(AttachCurrentThread(),
48 connection.obj());
49 }
50
51 void StopSandboxedProcess(base::ProcessHandle handle) {
52 JNIEnv* env = AttachCurrentThread();
53 DCHECK(env);
54 Java_SandboxedProcessLauncher_stop(env, static_cast<jint>(handle));
55 }
56
57 bool RegisterSandboxedProcessLauncher(JNIEnv* env) {
58 return RegisterNativesImpl(env);
59 }
60
61 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698