| Index: content/browser/gpu/gpu_process_host_ui_shim.cc
|
| diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc
|
| index aacf72b28ddc8b5accd5e517b514991ea69ae583..391421c2d0935f9fc57861af274813c3bd17715c 100644
|
| --- a/content/browser/gpu/gpu_process_host_ui_shim.cc
|
| +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc
|
| @@ -26,6 +26,13 @@
|
| #include "gpu/ipc/common/memory_stats.h"
|
| #include "ui/gfx/swap_result.h"
|
|
|
| +#if defined(OS_ANDROID)
|
| +#include "content/public/browser/android/java_interfaces.h"
|
| +#include "media/mojo/interfaces/android_overlay.mojom.h"
|
| +#include "services/service_manager/public/cpp/interface_provider.h"
|
| +#include "services/service_manager/public/cpp/interface_registry.h"
|
| +#endif
|
| +
|
| #if defined(USE_OZONE)
|
| #include "ui/ozone/public/gpu_platform_support_host.h"
|
| #include "ui/ozone/public/ozone_platform.h"
|
| @@ -57,6 +64,22 @@ void StopGpuProcessOnIO(int host_id) {
|
| host->StopGpuProcess();
|
| }
|
|
|
| +#if defined(OS_ANDROID)
|
| +template <typename Interface>
|
| +void BindJavaInterface(mojo::InterfaceRequest<Interface> request) {
|
| + 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
|
| +
|
| } // namespace
|
|
|
| void RouteToGpuProcessHostUIShimTask(int host_id, const IPC::Message& msg) {
|
| @@ -219,4 +242,13 @@ void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived(
|
| video_memory_usage_stats);
|
| }
|
|
|
| +#if defined(OS_ANDROID)
|
| +// static
|
| +void GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces(
|
| + service_manager::InterfaceRegistry* registry) {
|
| + registry->AddInterface(base::Bind(
|
| + &BindJavaInterfaceOnUIThread<media::mojom::AndroidOverlayProvider>));
|
| +}
|
| +#endif
|
| +
|
| } // namespace content
|
|
|