Chromium Code Reviews| Index: content/browser/gpu/gpu_process_host.cc |
| diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc |
| index 4aabfd167311f7e7bd0ab2e5047601a811a3685a..c1ece2eb42e6d67945049e60633ffbefc2ccf65f 100644 |
| --- a/content/browser/gpu/gpu_process_host.cc |
| +++ b/content/browser/gpu/gpu_process_host.cc |
| @@ -75,6 +75,9 @@ |
| #if defined(OS_ANDROID) |
| #include "base/android/build_info.h" |
| +#include "content/public/browser/android/java_interfaces.h" |
| +#include "media/mojo/interfaces/android_overlay.mojom.h" |
| +#include "services/service_manager/public/cpp/interface_registry.h" |
| #endif |
| #if defined(OS_WIN) |
| @@ -318,6 +321,22 @@ void HostLoadedShader(int host_id, |
| } // anonymous namespace |
| +#if defined(OS_ANDROID) |
| +template <typename Interface> |
| +void BindJavaInterface(mojo::InterfaceRequest<Interface> request) { |
|
boliu
2017/02/17 21:20:51
if we end up creating a separate registry for gpu,
liberato (no reviews please)
2017/02/22 16:25:01
moved to UI shim, per offline discussion.
|
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + content::GetGlobalJavaInterfaces()->GetInterface(std::move(request)); |
| +} |
| + |
| +// Binder which posts each request to the UI thread. |
| +template <typename Interface> |
| +void BindJavaInterfaceOnUIThread(mojo::InterfaceRequest<Interface> request) { |
| + BrowserThread::GetTaskRunnerForThread(BrowserThread::UI) |
| + ->PostTask(FROM_HERE, base::Bind(&BindJavaInterface<Interface>, |
| + base::Passed(&request))); |
| +} |
| +#endif |
| + |
| class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter { |
| public: |
| ConnectionFilterImpl(GpuProcessHost* host) : host_(host) {} |
| @@ -332,6 +351,12 @@ class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter { |
| GetContentClient()->browser()->ExposeInterfacesToGpuProcess(registry, |
| host_); |
| + |
| +#if defined(OS_ANDROID) |
| + registry->AddInterface(base::Bind( |
| + &BindJavaInterfaceOnUIThread<media::mojom::AndroidOverlayProvider>)); |
| +#endif |
| + |
| return true; |
| } |