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

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: 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"
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 {
32 31
33 // Pass a java surface object to the MediaPlayerAndroid object 32 // Pass a java surface object to the MediaPlayerAndroid object
34 // identified by render process handle, render frame ID and player ID. 33 // identified by render process handle, render frame ID and player ID.
35 static void SetSurfacePeer( 34 static void SetSurfacePeer(
no sievers 2014/10/06 22:28:27 While you're in here .... :) I think you can remov
reveman 2014/10/07 01:00:21 I'm not sure I understand exactly how that would w
no sievers 2014/10/07 22:12:44 Sounds good, I can take a look as a follow-up.
36 const base::android::JavaRef<jobject>& surface, 35 const base::android::JavaRef<jobject>& surface,
37 base::ProcessHandle render_process_handle, 36 base::ProcessHandle render_process_handle,
38 int render_frame_id, 37 int render_frame_id,
39 int player_id) { 38 int player_id) {
40 int render_process_id = 0; 39 int render_process_id = 0;
41 RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); 40 RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator();
42 while (!it.IsAtEnd()) { 41 while (!it.IsAtEnd()) {
43 if (it.GetCurrentValue()->GetHandle() == render_process_handle) { 42 if (it.GetCurrentValue()->GetHandle() == render_process_handle) {
44 render_process_id = it.GetCurrentValue()->GetID(); 43 render_process_id = it.GetCurrentValue()->GetID();
45 break; 44 break;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 RegisterSurfaceTexture(int surface_texture_id,
201 int child_process_id, 200 int client_id,
202 jobject j_surface_texture) { 201 jobject j_surface_texture) {
203 JNIEnv* env = AttachCurrentThread(); 202 JNIEnv* env = AttachCurrentThread();
204 DCHECK(env); 203 DCHECK(env);
205 Java_ChildProcessLauncher_registerSurfaceTexture( 204 Java_ChildProcessLauncher_registerSurfaceTexture(
206 env, surface_texture_id, child_process_id, j_surface_texture); 205 env, surface_texture_id, client_id, j_surface_texture);
207 } 206 }
208 207
209 void UnregisterChildProcessSurfaceTexture(int surface_texture_id, 208 void UnregisterSurfaceTexture(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_unregisterSurfaceTexture(
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698