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..d996be2f1d6d9e690006aae0493ef24f255db141 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" |
@@ -219,4 +226,27 @@ void GpuProcessHostUIShim::OnVideoMemoryUsageStatsReceived( |
video_memory_usage_stats); |
} |
+#if defined(OS_ANDROID) |
+template <typename Interface> |
+void BindJavaInterface(mojo::InterfaceRequest<Interface> request) { |
boliu
2017/02/22 18:03:49
these two should be in an anonymous namespace
liberato (no reviews please)
2017/02/22 19:10:50
Done.
|
+ 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 |
+ |
+// static |
+void GpuProcessHostUIShim::RegisterUIThreadMojoInterfaces( |
boliu
2017/02/22 18:03:49
This needs to be OS_ANDROID as well?
liberato (no reviews please)
2017/02/22 19:10:49
Done.
|
+ service_manager::InterfaceRegistry* registry) { |
+ registry->AddInterface(base::Bind( |
+ &BindJavaInterfaceOnUIThread<media::mojom::AndroidOverlayProvider>)); |
+} |
+ |
} // namespace content |