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 <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/logging.h" | 16 #include "base/logging.h" |
| 17 #include "content/browser/android/scoped_surface_request_manager.h" |
17 #include "content/browser/file_descriptor_info_impl.h" | 18 #include "content/browser/file_descriptor_info_impl.h" |
18 #include "content/browser/frame_host/render_frame_host_impl.h" | 19 #include "content/browser/frame_host/render_frame_host_impl.h" |
19 #include "content/browser/media/android/browser_media_player_manager.h" | 20 #include "content/browser/media/android/browser_media_player_manager.h" |
20 #include "content/browser/media/android/media_web_contents_observer_android.h" | 21 #include "content/browser/media/android/media_web_contents_observer_android.h" |
21 #include "content/browser/web_contents/web_contents_impl.h" | 22 #include "content/browser/web_contents/web_contents_impl.h" |
22 #include "content/common/child_process_host_impl.h" | 23 #include "content/common/child_process_host_impl.h" |
23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/content_browser_client.h" | 25 #include "content/public/browser/content_browser_client.h" |
25 #include "content/public/browser/render_process_host.h" | 26 #include "content/public/browser/render_process_host.h" |
26 #include "content/public/common/content_client.h" | 27 #include "content/public/common/content_client.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 ScopedJavaGlobalRef<jobject> jsurface; | 230 ScopedJavaGlobalRef<jobject> jsurface; |
230 jsurface.Reset(env, surface); | 231 jsurface.Reset(env, surface); |
231 if (jsurface.is_null()) | 232 if (jsurface.is_null()) |
232 return; | 233 return; |
233 | 234 |
234 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); | 235 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); |
235 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( | 236 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
236 &SetSurfacePeer, jsurface, pid, primary_id, secondary_id)); | 237 &SetSurfacePeer, jsurface, pid, primary_id, secondary_id)); |
237 } | 238 } |
238 | 239 |
| 240 void CompleteScopedSurfaceRequest(JNIEnv* env, |
| 241 const JavaParamRef<jclass>& clazz, |
| 242 jlong request_token, |
| 243 const JavaParamRef<jobject>& surface) { |
| 244 ScopedJavaGlobalRef<jobject> jsurface; |
| 245 jsurface.Reset(env, surface); |
| 246 gl::ScopedJavaSurface scoped_surface(jsurface); |
| 247 |
| 248 ScopedSurfaceRequestManager::GetInstance()->FulfillScopedSurfaceRequest( |
| 249 request_token, std::move(scoped_surface)); |
| 250 } |
| 251 |
239 void RegisterViewSurface(int surface_id, jobject j_surface) { | 252 void RegisterViewSurface(int surface_id, jobject j_surface) { |
240 JNIEnv* env = AttachCurrentThread(); | 253 JNIEnv* env = AttachCurrentThread(); |
241 DCHECK(env); | 254 DCHECK(env); |
242 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); | 255 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); |
243 } | 256 } |
244 | 257 |
245 void UnregisterViewSurface(int surface_id) { | 258 void UnregisterViewSurface(int surface_id) { |
246 JNIEnv* env = AttachCurrentThread(); | 259 JNIEnv* env = AttachCurrentThread(); |
247 DCHECK(env); | 260 DCHECK(env); |
248 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); | 261 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 297 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
285 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 298 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
286 switches::kSingleProcess); | 299 switches::kSingleProcess); |
287 } | 300 } |
288 | 301 |
289 bool RegisterChildProcessLauncher(JNIEnv* env) { | 302 bool RegisterChildProcessLauncher(JNIEnv* env) { |
290 return RegisterNativesImpl(env); | 303 return RegisterNativesImpl(env); |
291 } | 304 } |
292 | 305 |
293 } // namespace content | 306 } // namespace content |
OLD | NEW |