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

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

Issue 2285593002: Add ScopedSurfaceRequestManager (Closed)
Patch Set: Fixing comments. Created 4 years, 3 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>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/android/context_utils.h" 13 #include "base/android/context_utils.h"
14 #include "base/android/jni_android.h" 14 #include "base/android/jni_android.h"
15 #include "base/android/jni_array.h" 15 #include "base/android/jni_array.h"
16 #include "base/android/jni_string.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "content/browser/android/scoped_surface_request_manager.h"
17 #include "content/browser/file_descriptor_info_impl.h" 19 #include "content/browser/file_descriptor_info_impl.h"
18 #include "content/browser/frame_host/render_frame_host_impl.h" 20 #include "content/browser/frame_host/render_frame_host_impl.h"
19 #include "content/browser/media/android/browser_media_player_manager.h" 21 #include "content/browser/media/android/browser_media_player_manager.h"
20 #include "content/browser/media/android/media_web_contents_observer_android.h" 22 #include "content/browser/media/android/media_web_contents_observer_android.h"
21 #include "content/browser/web_contents/web_contents_impl.h" 23 #include "content/browser/web_contents/web_contents_impl.h"
22 #include "content/common/child_process_host_impl.h" 24 #include "content/common/child_process_host_impl.h"
23 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/content_browser_client.h" 26 #include "content/public/browser/content_browser_client.h"
25 #include "content/public/browser/render_process_host.h" 27 #include "content/public/browser/render_process_host.h"
26 #include "content/public/common/content_client.h" 28 #include "content/public/common/content_client.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 ScopedJavaGlobalRef<jobject> jsurface; 232 ScopedJavaGlobalRef<jobject> jsurface;
231 jsurface.Reset(env, surface); 233 jsurface.Reset(env, surface);
232 if (jsurface.is_null()) 234 if (jsurface.is_null())
233 return; 235 return;
234 236
235 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); 237 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
236 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( 238 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
237 &SetSurfacePeer, jsurface, pid, primary_id, secondary_id)); 239 &SetSurfacePeer, jsurface, pid, primary_id, secondary_id));
238 } 240 }
239 241
242 void CompleteScopedSurfaceRequest(JNIEnv* env,
243 const JavaParamRef<jclass>& clazz,
244 const JavaParamRef<jstring>& request_token,
245 const JavaParamRef<jobject>& surface) {
246 ScopedJavaGlobalRef<jobject> jsurface;
247 jsurface.Reset(env, surface);
248 gl::ScopedJavaSurface scoped_surface(jsurface);
249
250 ScopedSurfaceRequestManager::GetInstance()->FulfillScopedSurfaceRequest(
251 base::android::ConvertJavaStringToUTF8(env, request_token),
252 std::move(scoped_surface));
253 }
254
240 void RegisterViewSurface(int surface_id, const JavaRef<jobject>& j_surface) { 255 void RegisterViewSurface(int surface_id, const JavaRef<jobject>& j_surface) {
241 JNIEnv* env = AttachCurrentThread(); 256 JNIEnv* env = AttachCurrentThread();
242 DCHECK(env); 257 DCHECK(env);
243 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); 258 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface);
244 } 259 }
245 260
246 void UnregisterViewSurface(int surface_id) { 261 void UnregisterViewSurface(int surface_id) {
247 JNIEnv* env = AttachCurrentThread(); 262 JNIEnv* env = AttachCurrentThread();
248 DCHECK(env); 263 DCHECK(env);
249 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); 264 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { 300 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
286 return base::CommandLine::ForCurrentProcess()->HasSwitch( 301 return base::CommandLine::ForCurrentProcess()->HasSwitch(
287 switches::kSingleProcess); 302 switches::kSingleProcess);
288 } 303 }
289 304
290 bool RegisterChildProcessLauncher(JNIEnv* env) { 305 bool RegisterChildProcessLauncher(JNIEnv* env) {
291 return RegisterNativesImpl(env); 306 return RegisterNativesImpl(env);
292 } 307 }
293 308
294 } // namespace content 309 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698