Chromium Code Reviews| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 return gfx::ScopedJavaSurface::AcquireExternalSurface( | 220 return gfx::ScopedJavaSurface::AcquireExternalSurface( |
| 221 Java_ChildProcessLauncher_getSurfaceTextureSurface( | 221 Java_ChildProcessLauncher_getSurfaceTextureSurface( |
| 222 env, surface_texture_id, client_id).obj()); | 222 env, surface_texture_id, client_id).obj()); |
| 223 } | 223 } |
| 224 | 224 |
| 225 jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { | 225 jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { |
| 226 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 226 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 227 switches::kSingleProcess); | 227 switches::kSingleProcess); |
| 228 } | 228 } |
| 229 | 229 |
| 230 static void ExecuteOnLauncherThread( | |
| 231 const base::android::JavaRef<jobject>& runnable) { | |
| 232 JNIEnv* env = AttachCurrentThread(); | |
| 233 DCHECK(env); | |
| 234 Java_ChildProcessLauncher_executeOnLauncherThread(env, runnable.obj()); | |
| 235 } | |
| 236 | |
| 237 jboolean RunOnLauncherThread(JNIEnv* env, jclass clazz, jobject runnable) { | |
|
Yaron
2015/09/04 16:04:03
I think you're going to have to rebase on torne's
Jaekyun Seok (inactive)
2015/09/08 09:45:11
Done.
| |
| 238 ScopedJavaGlobalRef<jobject> jrunnable; | |
| 239 jrunnable.Reset(env, runnable); | |
| 240 if (jrunnable.is_null()) | |
| 241 return false; | |
| 242 | |
| 243 if (!BrowserThread::IsThreadInitialized(BrowserThread::PROCESS_LAUNCHER)) | |
| 244 return false; | |
| 245 | |
| 246 if (BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER)) { | |
| 247 ExecuteOnLauncherThread(jrunnable); | |
| 248 } else { | |
| 249 BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE, | |
| 250 base::Bind(&ExecuteOnLauncherThread, jrunnable)); | |
| 251 } | |
| 252 return true; | |
| 253 } | |
| 254 | |
| 230 bool RegisterChildProcessLauncher(JNIEnv* env) { | 255 bool RegisterChildProcessLauncher(JNIEnv* env) { |
| 231 return RegisterNativesImpl(env); | 256 return RegisterNativesImpl(env); |
| 232 } | 257 } |
| 233 | 258 |
| 234 } // namespace content | 259 } // namespace content |
| OLD | NEW |