Commit 2b0e76f6 authored by watk's avatar watk Committed by Commit bot

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}
parent ff942f12
......@@ -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_;
......
......@@ -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
......@@ -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);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment