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

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

Issue 2161083004: [DO NOT COMMIT] MediaPlayerRenderer using StreamTextures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 10 matching lines...) Expand all
21 #include "content/browser/web_contents/web_contents_impl.h" 21 #include "content/browser/web_contents/web_contents_impl.h"
22 #include "content/common/child_process_host_impl.h" 22 #include "content/common/child_process_host_impl.h"
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/content_browser_client.h" 24 #include "content/public/browser/content_browser_client.h"
25 #include "content/public/browser/render_process_host.h" 25 #include "content/public/browser/render_process_host.h"
26 #include "content/public/common/content_client.h" 26 #include "content/public/common/content_client.h"
27 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
28 #include "jni/ChildProcessLauncher_jni.h" 28 #include "jni/ChildProcessLauncher_jni.h"
29 #include "media/base/android/media_player_android.h" 29 #include "media/base/android/media_player_android.h"
30 #include "ui/gl/android/surface_texture.h" 30 #include "ui/gl/android/surface_texture.h"
31 #include "media/base/android/media_player_renderer.h"
31 32
32 using base::android::AttachCurrentThread; 33 using base::android::AttachCurrentThread;
33 using base::android::ToJavaArrayOfStrings; 34 using base::android::ToJavaArrayOfStrings;
34 using base::android::ScopedJavaGlobalRef; 35 using base::android::ScopedJavaGlobalRef;
35 using base::android::ScopedJavaLocalRef; 36 using base::android::ScopedJavaLocalRef;
36 using content::StartChildProcessCallback; 37 using content::StartChildProcessCallback;
37 38
38 namespace content { 39 namespace content {
39 40
40 namespace { 41 namespace {
41 42
43 // TODO(tguilbert): Uncomment the following code an properly register surface.
44 // See crbug.com/627658.
45 /*
42 // Pass a java surface object to the MediaPlayerAndroid object 46 // Pass a java surface object to the MediaPlayerAndroid object
43 // identified by render process handle, render frame ID and player ID. 47 // identified by render process handle, render frame ID and player ID.
44 static void SetSurfacePeer( 48 static void SetSurfacePeer(
45 const base::android::JavaRef<jobject>& surface, 49 const base::android::JavaRef<jobject>& surface,
46 base::ProcessHandle render_process_handle, 50 base::ProcessHandle render_process_handle,
47 int render_frame_id, 51 int render_frame_id,
48 int player_id) { 52 int player_id) {
49 int render_process_id = 0; 53 int render_process_id = 0;
50 RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); 54 RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator();
51 while (!it.IsAtEnd()) { 55 while (!it.IsAtEnd()) {
(...skipping 29 matching lines...) Expand all
81 if (!player) { 85 if (!player) {
82 DVLOG(1) << "Cannot find media player for player_id " << player_id; 86 DVLOG(1) << "Cannot find media player for player_id " << player_id;
83 return; 87 return;
84 } 88 }
85 89
86 if (player != player_manager->GetFullscreenPlayer()) { 90 if (player != player_manager->GetFullscreenPlayer()) {
87 gl::ScopedJavaSurface scoped_surface(surface); 91 gl::ScopedJavaSurface scoped_surface(surface);
88 player->SetVideoSurface(std::move(scoped_surface)); 92 player->SetVideoSurface(std::move(scoped_surface));
89 } 93 }
90 } 94 }
95 */
91 96
92 void LaunchDownloadProcess(base::CommandLine* cmd_line) { 97 void LaunchDownloadProcess(base::CommandLine* cmd_line) {
93 std::unique_ptr<base::CommandLine> cmd_line_deleter(cmd_line); 98 std::unique_ptr<base::CommandLine> cmd_line_deleter(cmd_line);
94 99
95 JNIEnv* env = AttachCurrentThread(); 100 JNIEnv* env = AttachCurrentThread();
96 DCHECK(env); 101 DCHECK(env);
97 102
98 // Create the Command line String[] 103 // Create the Command line String[]
99 ScopedJavaLocalRef<jobjectArray> j_argv = 104 ScopedJavaLocalRef<jobjectArray> j_argv =
100 ToJavaArrayOfStrings(env, cmd_line->argv()); 105 ToJavaArrayOfStrings(env, cmd_line->argv());
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 210 }
206 211
207 bool IsChildProcessOomProtected(base::ProcessHandle handle) { 212 bool IsChildProcessOomProtected(base::ProcessHandle handle) {
208 JNIEnv* env = AttachCurrentThread(); 213 JNIEnv* env = AttachCurrentThread();
209 DCHECK(env); 214 DCHECK(env);
210 return Java_ChildProcessLauncher_isOomProtected(env, 215 return Java_ChildProcessLauncher_isOomProtected(env,
211 static_cast<jint>(handle)); 216 static_cast<jint>(handle));
212 } 217 }
213 218
214 void SetChildProcessInForeground(base::ProcessHandle handle, 219 void SetChildProcessInForeground(base::ProcessHandle handle,
215 bool in_foreground) { 220 bool in_foreground) {
216 JNIEnv* env = AttachCurrentThread(); 221 JNIEnv* env = AttachCurrentThread();
217 DCHECK(env); 222 DCHECK(env);
218 return Java_ChildProcessLauncher_setInForeground(env, 223 return Java_ChildProcessLauncher_setInForeground(
219 static_cast<jint>(handle), static_cast<jboolean>(in_foreground)); 224 env, static_cast<jint>(handle), static_cast<jboolean>(in_foreground));
220 } 225 }
221 226
222 void EstablishSurfacePeer(JNIEnv* env, 227 void EstablishSurfacePeer(JNIEnv* env,
223 const JavaParamRef<jclass>& clazz, 228 const JavaParamRef<jclass>& clazz,
224 jint pid, 229 jint pid,
225 const JavaParamRef<jobject>& surface, 230 const JavaParamRef<jobject>& surface,
226 jint primary_id, 231 jint primary_id,
227 jint secondary_id) { 232 jint secondary_id) {
228 ScopedJavaGlobalRef<jobject> jsurface; 233 DVLOG(1) << "Surface intercepted " << primary_id << " " << secondary_id;
229 jsurface.Reset(env, surface); 234 media::MediaPlayerRenderer::surface_for_prototype =
230 if (jsurface.is_null()) 235 gl::ScopedJavaSurface::AcquireExternalSurface(surface);
231 return;
232 236
233 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); 237 // DO NOT COMMIT!
234 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( 238 // TODO(tguilbert): Properly register surface and uncomment the code bellow.
235 &SetSurfacePeer, jsurface, pid, primary_id, secondary_id)); 239 // See crbug.com/627658.
240
241 // ScopedJavaGlobalRef<jobject> jsurface;
242 // jsurface.Reset(env, surface);
243 // if (jsurface.is_null())
244 // return;
245 //
246 // DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
247 // BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
248 // &SetSurfacePeer, jsurface, pid, primary_id, secondary_id));
236 } 249 }
237 250
238 void RegisterViewSurface(int surface_id, jobject j_surface) { 251 void RegisterViewSurface(int surface_id, jobject j_surface) {
239 JNIEnv* env = AttachCurrentThread(); 252 JNIEnv* env = AttachCurrentThread();
240 DCHECK(env); 253 DCHECK(env);
241 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); 254 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface);
242 } 255 }
243 256
244 void UnregisterViewSurface(int surface_id) { 257 void UnregisterViewSurface(int surface_id) {
245 JNIEnv* env = AttachCurrentThread(); 258 JNIEnv* env = AttachCurrentThread();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { 299 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
287 return base::CommandLine::ForCurrentProcess()->HasSwitch( 300 return base::CommandLine::ForCurrentProcess()->HasSwitch(
288 switches::kSingleProcess); 301 switches::kSingleProcess);
289 } 302 }
290 303
291 bool RegisterChildProcessLauncher(JNIEnv* env) { 304 bool RegisterChildProcessLauncher(JNIEnv* env) {
292 return RegisterNativesImpl(env); 305 return RegisterNativesImpl(env);
293 } 306 }
294 307
295 } // namespace content 308 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698