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 #include "content/browser/android/child_process_launcher_android.h" | 5 #include "content/browser/android/child_process_launcher_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 j_file_auto_close.obj(), | 124 j_file_auto_close.obj(), |
125 reinterpret_cast<jint>(new StartChildProcessCallback(callback))); | 125 reinterpret_cast<jint>(new StartChildProcessCallback(callback))); |
126 } | 126 } |
127 | 127 |
128 void StopChildProcess(base::ProcessHandle handle) { | 128 void StopChildProcess(base::ProcessHandle handle) { |
129 JNIEnv* env = AttachCurrentThread(); | 129 JNIEnv* env = AttachCurrentThread(); |
130 DCHECK(env); | 130 DCHECK(env); |
131 Java_ChildProcessLauncher_stop(env, static_cast<jint>(handle)); | 131 Java_ChildProcessLauncher_stop(env, static_cast<jint>(handle)); |
132 } | 132 } |
133 | 133 |
| 134 bool IsChildProcessOomProtected(base::ProcessHandle handle) { |
| 135 JNIEnv* env = AttachCurrentThread(); |
| 136 DCHECK(env); |
| 137 return Java_ChildProcessLauncher_isOomProtected(env, |
| 138 static_cast<jint>(handle)); |
| 139 } |
| 140 |
134 void EstablishSurfacePeer( | 141 void EstablishSurfacePeer( |
135 JNIEnv* env, jclass clazz, | 142 JNIEnv* env, jclass clazz, |
136 jint pid, jobject surface, jint primary_id, jint secondary_id) { | 143 jint pid, jobject surface, jint primary_id, jint secondary_id) { |
137 ScopedJavaGlobalRef<jobject> jsurface; | 144 ScopedJavaGlobalRef<jobject> jsurface; |
138 jsurface.Reset(env, surface); | 145 jsurface.Reset(env, surface); |
139 if (jsurface.is_null()) | 146 if (jsurface.is_null()) |
140 return; | 147 return; |
141 | 148 |
142 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); | 149 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); |
143 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( | 150 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
(...skipping 10 matching lines...) Expand all Loading... |
154 | 161 |
155 jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { | 162 jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { |
156 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); | 163 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
157 } | 164 } |
158 | 165 |
159 bool RegisterChildProcessLauncher(JNIEnv* env) { | 166 bool RegisterChildProcessLauncher(JNIEnv* env) { |
160 return RegisterNativesImpl(env); | 167 return RegisterNativesImpl(env); |
161 } | 168 } |
162 | 169 |
163 } // namespace content | 170 } // namespace content |
OLD | NEW |