Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Unified Diff: content/browser/gpu/gpu_process_host_ui_shim.cc

Issue 2688193002: Mojo framework for AndroidOverlay. (Closed)
Patch Set: fixed mojo manifest bug introduced by rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/browser/gpu/gpu_process_host_ui_shim.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698