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

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

Issue 2688193002: Mojo framework for AndroidOverlay. (Closed)
Patch Set: moved UI thread mojo init to Gpu...UIShim Created 3 years, 10 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
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

Powered by Google App Engine
This is Rietveld 408576698