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/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 Loading... | |
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 jlong request_token_high, | |
245 jlong request_token_low, | |
246 const JavaParamRef<jobject>& surface) { | |
247 ScopedJavaGlobalRef<jobject> jsurface; | |
248 jsurface.Reset(env, surface); | |
249 gl::ScopedJavaSurface scoped_surface(jsurface); | |
no sievers
2016/09/13 23:25:56
nit: Doesn't the ScopedJavaSurface constructor tak
tguilbert
2016/09/20 03:08:40
You are right. Leftover from previous iterations.
| |
250 | |
251 ScopedSurfaceRequestManager::GetInstance()->FulfillScopedSurfaceRequest( | |
252 base::Nonce::Deserialize(request_token_high, request_token_low), | |
253 std::move(scoped_surface)); | |
254 } | |
255 | |
240 void RegisterViewSurface(int surface_id, const JavaRef<jobject>& j_surface) { | 256 void RegisterViewSurface(int surface_id, const JavaRef<jobject>& j_surface) { |
241 JNIEnv* env = AttachCurrentThread(); | 257 JNIEnv* env = AttachCurrentThread(); |
242 DCHECK(env); | 258 DCHECK(env); |
243 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); | 259 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); |
244 } | 260 } |
245 | 261 |
246 void UnregisterViewSurface(int surface_id) { | 262 void UnregisterViewSurface(int surface_id) { |
247 JNIEnv* env = AttachCurrentThread(); | 263 JNIEnv* env = AttachCurrentThread(); |
248 DCHECK(env); | 264 DCHECK(env); |
249 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); | 265 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
285 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 301 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
286 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 302 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
287 switches::kSingleProcess); | 303 switches::kSingleProcess); |
288 } | 304 } |
289 | 305 |
290 bool RegisterChildProcessLauncher(JNIEnv* env) { | 306 bool RegisterChildProcessLauncher(JNIEnv* env) { |
291 return RegisterNativesImpl(env); | 307 return RegisterNativesImpl(env); |
292 } | 308 } |
293 | 309 |
294 } // namespace content | 310 } // namespace content |
OLD | NEW |