diff options
author | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-06 04:29:01 +0000 |
---|---|---|
committer | reveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-06 04:29:01 +0000 |
commit | 354c448d265435890a34f364562be49315f5af1c (patch) | |
tree | a4e35233ce56a0f64b206fb1a812dcae166b42dc /content/browser/android/child_process_launcher_android.cc | |
parent | 0485cf05e88915e1b175a02d60b54e5c1af31a44 (diff) | |
download | chromium_src-354c448d265435890a34f364562be49315f5af1c.zip chromium_src-354c448d265435890a34f364562be49315f5af1c.tar.gz chromium_src-354c448d265435890a34f364562be49315f5af1c.tar.bz2 |
content: Cleanup surface reference passing using Java IPC.
This moves the surface/surface-texture id lookup code into Java so
we don't have to enter native land when responding to related IPC
messages.
BUG=269808
Review URL: https://codereview.chromium.org/226103004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262041 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/android/child_process_launcher_android.cc')
-rw-r--r-- | content/browser/android/child_process_launcher_android.cc | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/content/browser/android/child_process_launcher_android.cc b/content/browser/android/child_process_launcher_android.cc index ca99a78..6c4c6af 100644 --- a/content/browser/android/child_process_launcher_android.cc +++ b/content/browser/android/child_process_launcher_android.cc @@ -153,24 +153,33 @@ void EstablishSurfacePeer( &SetSurfacePeer, jsurface, pid, primary_id, secondary_id)); } -jobject GetViewSurface(JNIEnv* env, jclass clazz, jint surface_id) { - // This is a synchronous call from the GPU process and is expected to be - // handled on a binder thread. Handling this on the UI thread will lead - // to deadlocks. - DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); - return CompositorImpl::GetSurface(surface_id).Release(); +void RegisterViewSurface(int surface_id, jobject j_surface) { + JNIEnv* env = AttachCurrentThread(); + DCHECK(env); + Java_ChildProcessLauncher_registerViewSurface(env, surface_id, j_surface); } -jobject GetSurfaceTextureSurface(JNIEnv* env, - jclass clazz, - jint surface_texture_id, - jint child_process_id) { - // This is a synchronous call from a renderer process and is expected to be - // handled on a binder thread. Handling this on the UI thread will lead - // to deadlocks. - DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); - return CompositorImpl::GetSurfaceTextureSurface(surface_texture_id, - child_process_id).Release(); +void UnregisterViewSurface(int surface_id) { + JNIEnv* env = AttachCurrentThread(); + DCHECK(env); + Java_ChildProcessLauncher_unregisterViewSurface(env, surface_id); +} + +void RegisterChildProcessSurfaceTexture(int surface_texture_id, + int child_process_id, + jobject j_surface_texture) { + JNIEnv* env = AttachCurrentThread(); + DCHECK(env); + Java_ChildProcessLauncher_registerSurfaceTexture( + env, surface_texture_id, child_process_id, j_surface_texture); +} + +void UnregisterChildProcessSurfaceTexture(int surface_texture_id, + int child_process_id) { + JNIEnv* env = AttachCurrentThread(); + DCHECK(env); + Java_ChildProcessLauncher_unregisterSurfaceTexture( + env, surface_texture_id, child_process_id); } jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { |