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

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

Issue 634643002: content: Out-of-process GPU service support for SurfaceTexture backed GpuMemoryBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one last build fix Created 6 years, 2 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
OLDNEW
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" 21 #include "ui/gl/android/surface_texture.h"
22 22
23 using base::android::AttachCurrentThread; 23 using base::android::AttachCurrentThread;
24 using base::android::ToJavaArrayOfStrings; 24 using base::android::ToJavaArrayOfStrings;
25 using base::android::ScopedJavaGlobalRef; 25 using base::android::ScopedJavaGlobalRef;
26 using base::android::ScopedJavaLocalRef; 26 using base::android::ScopedJavaLocalRef;
27 using content::StartChildProcessCallback; 27 using content::StartChildProcessCallback;
28 28
29 namespace content { 29 namespace content {
30 30
31 namespace { 31 namespace {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 DCHECK(env); 190 DCHECK(env);
191 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); 191 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface);
192 } 192 }
193 193
194 void UnregisterViewSurface(int surface_id) { 194 void UnregisterViewSurface(int surface_id) {
195 JNIEnv* env = AttachCurrentThread(); 195 JNIEnv* env = AttachCurrentThread();
196 DCHECK(env); 196 DCHECK(env);
197 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); 197 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id);
198 } 198 }
199 199
200 void RegisterChildProcessSurfaceTexture(int surface_texture_id, 200 void CreateSurfaceTextureSurface(int surface_texture_id,
201 int child_process_id, 201 int client_id,
202 jobject j_surface_texture) { 202 gfx::SurfaceTexture* surface_texture) {
203 JNIEnv* env = AttachCurrentThread(); 203 JNIEnv* env = AttachCurrentThread();
204 DCHECK(env); 204 DCHECK(env);
205 Java_ChildProcessLauncher_registerSurfaceTexture( 205 Java_ChildProcessLauncher_createSurfaceTextureSurface(
206 env, surface_texture_id, child_process_id, j_surface_texture); 206 env,
207 surface_texture_id,
208 client_id,
209 surface_texture->j_surface_texture().obj());
207 } 210 }
208 211
209 void UnregisterChildProcessSurfaceTexture(int surface_texture_id, 212 void DestroySurfaceTextureSurface(int surface_texture_id, int client_id) {
210 int child_process_id) {
211 JNIEnv* env = AttachCurrentThread(); 213 JNIEnv* env = AttachCurrentThread();
212 DCHECK(env); 214 DCHECK(env);
213 Java_ChildProcessLauncher_unregisterSurfaceTexture( 215 Java_ChildProcessLauncher_destroySurfaceTextureSurface(
214 env, surface_texture_id, child_process_id); 216 env, surface_texture_id, client_id);
217 }
218
219 gfx::ScopedJavaSurface GetSurfaceTextureSurface(int surface_texture_id,
220 int client_id) {
221 JNIEnv* env = AttachCurrentThread();
222 DCHECK(env);
223 return gfx::ScopedJavaSurface::AcquireExternalSurface(
224 Java_ChildProcessLauncher_getSurfaceTextureSurface(
225 env, surface_texture_id, client_id).obj());
215 } 226 }
216 227
217 jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { 228 jboolean IsSingleProcess(JNIEnv* env, jclass clazz) {
218 return base::CommandLine::ForCurrentProcess()->HasSwitch( 229 return base::CommandLine::ForCurrentProcess()->HasSwitch(
219 switches::kSingleProcess); 230 switches::kSingleProcess);
220 } 231 }
221 232
222 bool RegisterChildProcessLauncher(JNIEnv* env) { 233 bool RegisterChildProcessLauncher(JNIEnv* env) {
223 return RegisterNativesImpl(env); 234 return RegisterNativesImpl(env);
224 } 235 }
225 236
226 } // namespace content 237 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/child_process_launcher_android.h ('k') | content/browser/android/surface_texture_peer_browser_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698