| 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 499d789a1426fc896acf2e08bc1d8510a75f95ba..252797e0a1ecc212de3b8671927941dd36661717 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"
|
| @@ -43,6 +50,22 @@ namespace {
|
| base::LazyInstance<IDMap<GpuProcessHostUIShim*>>::DestructorAtExit
|
| g_hosts_by_id = LAZY_INSTANCE_INITIALIZER;
|
|
|
| +#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) {
|
| @@ -152,4 +175,13 @@ void GpuProcessHostUIShim::OnGraphicsInfoCollected(
|
| GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
|
| }
|
|
|
| +#if defined(OS_ANDROID)
|
| +// static
|
| +void GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces(
|
| + service_manager::InterfaceRegistry* registry) {
|
| + registry->AddInterface(base::Bind(
|
| + &BindJavaInterfaceOnUIThread<media::mojom::AndroidOverlayProvider>));
|
| +}
|
| +#endif
|
| +
|
| } // namespace content
|
|
|