Chromium Code Reviews| 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..659c6f5effaeb31c6e8739b1284958a0236ca549 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,23 @@ void HostLoadedShader(int host_id, |
| } // anonymous namespace |
| +#if defined(OS_ANDROID) |
| +template <typename InterfaceType> |
| +void AddUIInterfaceHelper(service_manager::InterfaceRegistry* registry) { |
|
boliu
2017/02/16 22:24:19
Hmm, I don't know mojo at all.. my immediate quest
liberato (no reviews please)
2017/02/17 17:47:12
(fixed per rockot@'s suggestions.)
|
| + registry->AddInterface( |
| + content::GetGlobalJavaInterfaces() |
| + ->CreateInterfaceFactory<InterfaceType>(), |
| + BrowserThread::GetTaskRunnerForThread(BrowserThread::UI)); |
| +} |
| + |
| +template <typename InterfaceType> |
| +void AddUIInterface(service_manager::InterfaceRegistry* registry) { |
| + BrowserThread::GetTaskRunnerForThread(BrowserThread::UI) |
| + ->PostTask(FROM_HERE, |
| + base::Bind(&AddUIInterfaceHelper<InterfaceType>, registry)); |
|
Ken Rockot(use gerrit already)
2017/02/17 06:29:56
This is not safe, and CreateInterfaceFactory() whi
liberato (no reviews please)
2017/02/17 17:47:12
thank you very much!
|
| +} |
| +#endif |
| + |
| class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter { |
| public: |
| ConnectionFilterImpl(GpuProcessHost* host) : host_(host) {} |
| @@ -332,6 +352,11 @@ class GpuProcessHost::ConnectionFilterImpl : public ConnectionFilter { |
| GetContentClient()->browser()->ExposeInterfacesToGpuProcess(registry, |
| host_); |
| + |
| +#if defined(OS_ANDROID) |
| + AddUIInterface<media::mojom::AndroidOverlayProvider>(registry); |
| +#endif |
| + |
| return true; |
| } |