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" |
11 #include "content/browser/frame_host/render_frame_host_impl.h" | 11 #include "content/browser/frame_host/render_frame_host_impl.h" |
12 #include "content/browser/media/android/browser_media_player_manager.h" | 12 #include "content/browser/media/android/browser_media_player_manager.h" |
13 #include "content/browser/media/media_web_contents_observer.h" | 13 #include "content/browser/media/media_web_contents_observer.h" |
14 #include "content/browser/renderer_host/compositor_impl_android.h" | 14 #include "content/browser/renderer_host/compositor_impl_android.h" |
15 #include "content/browser/renderer_host/render_view_host_impl.h" | 15 #include "content/browser/renderer_host/render_view_host_impl.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 #include "jni/ChildProcessLauncher_jni.h" | 19 #include "jni/ChildProcessLauncher_jni.h" |
20 #include "media/base/android/media_player_android.h" | 20 #include "media/base/android/media_player_android.h" |
21 #include "ui/gl/android/scoped_java_surface.h" | |
22 | 21 |
23 using base::android::AttachCurrentThread; | 22 using base::android::AttachCurrentThread; |
24 using base::android::ToJavaArrayOfStrings; | 23 using base::android::ToJavaArrayOfStrings; |
25 using base::android::ScopedJavaGlobalRef; | 24 using base::android::ScopedJavaGlobalRef; |
26 using base::android::ScopedJavaLocalRef; | 25 using base::android::ScopedJavaLocalRef; |
27 using content::StartChildProcessCallback; | 26 using content::StartChildProcessCallback; |
28 | 27 |
29 namespace content { | 28 namespace content { |
30 | 29 |
31 namespace { | 30 namespace { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 DCHECK(env); | 189 DCHECK(env); |
191 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); | 190 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); |
192 } | 191 } |
193 | 192 |
194 void UnregisterViewSurface(int surface_id) { | 193 void UnregisterViewSurface(int surface_id) { |
195 JNIEnv* env = AttachCurrentThread(); | 194 JNIEnv* env = AttachCurrentThread(); |
196 DCHECK(env); | 195 DCHECK(env); |
197 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); | 196 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); |
198 } | 197 } |
199 | 198 |
200 void RegisterChildProcessSurfaceTexture(int surface_texture_id, | 199 void RegisterSurfaceTextureSurface(int surface_texture_id, |
201 int child_process_id, | 200 int client_id, |
202 jobject j_surface_texture) { | 201 jobject j_surface) { |
203 JNIEnv* env = AttachCurrentThread(); | 202 JNIEnv* env = AttachCurrentThread(); |
204 DCHECK(env); | 203 DCHECK(env); |
205 Java_ChildProcessLauncher_registerSurfaceTexture( | 204 Java_ChildProcessLauncher_registerSurfaceTextureSurface( |
206 env, surface_texture_id, child_process_id, j_surface_texture); | 205 env, surface_texture_id, client_id, j_surface); |
207 } | 206 } |
208 | 207 |
209 void UnregisterChildProcessSurfaceTexture(int surface_texture_id, | 208 void UnregisterSurfaceTextureSurface(int surface_texture_id, int client_id) { |
210 int child_process_id) { | |
211 JNIEnv* env = AttachCurrentThread(); | 209 JNIEnv* env = AttachCurrentThread(); |
212 DCHECK(env); | 210 DCHECK(env); |
213 Java_ChildProcessLauncher_unregisterSurfaceTexture( | 211 Java_ChildProcessLauncher_unregisterSurfaceTextureSurface( |
214 env, surface_texture_id, child_process_id); | 212 env, surface_texture_id, client_id); |
| 213 } |
| 214 |
| 215 gfx::ScopedJavaSurface GetSurfaceTextureSurface(int surface_texture_id, |
| 216 int client_id) { |
| 217 JNIEnv* env = AttachCurrentThread(); |
| 218 DCHECK(env); |
| 219 return gfx::ScopedJavaSurface( |
| 220 Java_ChildProcessLauncher_getSurfaceTextureSurface( |
| 221 env, surface_texture_id, client_id)); |
215 } | 222 } |
216 | 223 |
217 jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { | 224 jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { |
218 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 225 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
219 switches::kSingleProcess); | 226 switches::kSingleProcess); |
220 } | 227 } |
221 | 228 |
222 bool RegisterChildProcessLauncher(JNIEnv* env) { | 229 bool RegisterChildProcessLauncher(JNIEnv* env) { |
223 return RegisterNativesImpl(env); | 230 return RegisterNativesImpl(env); |
224 } | 231 } |
225 | 232 |
226 } // namespace content | 233 } // namespace content |
OLD | NEW |