diff options
author | watk <watk@chromium.org> | 2016-01-08 16:41:12 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-09 00:42:14 +0000 |
commit | 2b0e76f6c665b2f0988315591276f08906420cbd (patch) | |
tree | c2aeb55d2ca8e1d33c1e2e87af2917c8f82dc946 | |
parent | ff942f12ced6fea94ec108035acfb15a048fe204 (diff) | |
download | chromium_src-2b0e76f6c665b2f0988315591276f08906420cbd.zip chromium_src-2b0e76f6c665b2f0988315591276f08906420cbd.tar.gz chromium_src-2b0e76f6c665b2f0988315591276f08906420cbd.tar.bz2 |
Add GpuSurfaceLookup::AcquireJavaSurface for AVDA on Android.
AndroidVideoDecodeAccelerator, which runs in the GPU process, needs a
way to get a java Surface from the browser process. GpuSurfaceLookup and
SurfaceTextureManagerImpl already provide a way to get an ANativeWindow
but not the corresponding java Surface. This new method returns the java
surface.
BUG=533630
Review URL: https://codereview.chromium.org/1567193002
Cr-Commit-Position: refs/heads/master@{#368478}
-rw-r--r-- | content/app/android/child_process_service.cc | 8 | ||||
-rw-r--r-- | content/common/gpu/gpu_surface_lookup.cc | 7 | ||||
-rw-r--r-- | content/common/gpu/gpu_surface_lookup.h | 8 |
3 files changed, 23 insertions, 0 deletions
diff --git a/content/app/android/child_process_service.cc b/content/app/android/child_process_service.cc index 8ede667..3627eba 100644 --- a/content/app/android/child_process_service.cc +++ b/content/app/android/child_process_service.cc @@ -123,6 +123,14 @@ class SurfaceTextureManagerImpl : public SurfaceTextureManager, return native_window; } + // Overridden from GpuSurfaceLookup: + gfx::ScopedJavaSurface AcquireJavaSurface(int surface_id) override { + JNIEnv* env = base::android::AttachCurrentThread(); + return gfx::ScopedJavaSurface( + content::Java_ChildProcessService_getViewSurface(env, service_.obj(), + surface_id)); + } + private: // The instance of org.chromium.content.app.ChildProcessService. base::android::ScopedJavaGlobalRef<jobject> service_; diff --git a/content/common/gpu/gpu_surface_lookup.cc b/content/common/gpu/gpu_surface_lookup.cc index df18711..61bbc04 100644 --- a/content/common/gpu/gpu_surface_lookup.cc +++ b/content/common/gpu/gpu_surface_lookup.cc @@ -23,4 +23,11 @@ void GpuSurfaceLookup::InitInstance(GpuSurfaceLookup* lookup) { g_instance = lookup; } +#if defined(OS_ANDROID) +gfx::ScopedJavaSurface GpuSurfaceLookup::AcquireJavaSurface(int surface_id) { + NOTIMPLEMENTED(); + return gfx::ScopedJavaSurface(); +} +#endif + } // namespace content diff --git a/content/common/gpu/gpu_surface_lookup.h b/content/common/gpu/gpu_surface_lookup.h index 3f3a1e5..c47e7e3 100644 --- a/content/common/gpu/gpu_surface_lookup.h +++ b/content/common/gpu/gpu_surface_lookup.h @@ -9,6 +9,10 @@ #include "content/common/content_export.h" #include "ui/gfx/native_widget_types.h" +#if defined(OS_ANDROID) +#include "ui/gl/android/scoped_java_surface.h" +#endif + namespace content { // This class provides an interface to look up window surface handles @@ -23,6 +27,10 @@ class CONTENT_EXPORT GpuSurfaceLookup { virtual gfx::AcceleratedWidget AcquireNativeWidget(int surface_id) = 0; +#if defined(OS_ANDROID) + virtual gfx::ScopedJavaSurface AcquireJavaSurface(int surface_id); +#endif + private: DISALLOW_COPY_AND_ASSIGN(GpuSurfaceLookup); }; |