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

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

Issue 2688193002: Mojo framework for AndroidOverlay. (Closed)
Patch Set: fixed unittest 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.cc
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 4aabfd167311f7e7bd0ab2e5047601a811a3685a..c1ece2eb42e6d67945049e60633ffbefc2ccf65f 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -75,6 +75,9 @@
#if defined(OS_ANDROID)
#include "base/android/build_info.h"
+#include "content/public/browser/android/java_interfaces.h"
+#include "media/mojo/interfaces/android_overlay.mojom.h"
+#include "services/service_manager/public/cpp/interface_registry.h"
#endif
#if defined(OS_WIN)
@@ -318,6 +321,22 @@ void HostLoadedShader(int host_id,
} // anonymous namespace
+#if defined(OS_ANDROID)
+template <typename Interface>
+void BindJavaInterface(mojo::InterfaceRequest<Interface> request) {
boliu 2017/02/17 21:20:51 if we end up creating a separate registry for gpu,
liberato (no reviews please) 2017/02/22 16:25:01 moved to UI shim, per offline discussion.
+ 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
+
class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter {
public:
ConnectionFilterImpl(GpuProcessHost* host) : host_(host) {}
@@ -332,6 +351,12 @@ class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter {
GetContentClient()->browser()->ExposeInterfacesToGpuProcess(registry,
host_);
+
+#if defined(OS_ANDROID)
+ registry->AddInterface(base::Bind(
+ &BindJavaInterfaceOnUIThread<media::mojom::AndroidOverlayProvider>));
+#endif
+
return true;
}

Powered by Google App Engine
This is Rietveld 408576698