Chromium Code Reviews| 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 if (request_token_high == 0 && request_token_low == 0) | |
|
tguilbert
2016/09/20 03:08:40
Thoughts on whether this should be logged?
dcheng
2016/09/20 06:50:35
It's fine to add something like a DLOG(), but it's
| |
| 248 return; | |
| 249 | |
| 250 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 251 | |
| 252 ScopedJavaGlobalRef<jobject> jsurface; | |
| 253 jsurface.Reset(env, surface); | |
| 254 ScopedSurfaceRequestManager::GetInstance()->FulfillScopedSurfaceRequest( | |
| 255 base::UnguessableToken::Deserialize(request_token_high, | |
| 256 request_token_low), | |
| 257 gl::ScopedJavaSurface(jsurface)); | |
| 258 } | |
| 259 | |
| 240 void RegisterViewSurface(int surface_id, const JavaRef<jobject>& j_surface) { | 260 void RegisterViewSurface(int surface_id, const JavaRef<jobject>& j_surface) { |
| 241 JNIEnv* env = AttachCurrentThread(); | 261 JNIEnv* env = AttachCurrentThread(); |
| 242 DCHECK(env); | 262 DCHECK(env); |
| 243 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); | 263 Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); |
| 244 } | 264 } |
| 245 | 265 |
| 246 void UnregisterViewSurface(int surface_id) { | 266 void UnregisterViewSurface(int surface_id) { |
| 247 JNIEnv* env = AttachCurrentThread(); | 267 JNIEnv* env = AttachCurrentThread(); |
| 248 DCHECK(env); | 268 DCHECK(env); |
| 249 Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); | 269 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) { | 305 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
| 286 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 306 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 287 switches::kSingleProcess); | 307 switches::kSingleProcess); |
| 288 } | 308 } |
| 289 | 309 |
| 290 bool RegisterChildProcessLauncher(JNIEnv* env) { | 310 bool RegisterChildProcessLauncher(JNIEnv* env) { |
| 291 return RegisterNativesImpl(env); | 311 return RegisterNativesImpl(env); |
| 292 } | 312 } |
| 293 | 313 |
| 294 } // namespace content | 314 } // namespace content |
| OLD | NEW |