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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2416123003: [Device Sensors] Move Mojo communication to UI thread on Android (Closed)
Patch Set: Fix browsertest Created 4 years, 2 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/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 088b7196b9c210ff5c5e93333b1da9907e15ca4c..f8faa01abea7b10fbe07658cdc55c4ac948ded4b 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1279,11 +1279,24 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() {
file_task_runner);
#endif
- // These callbacks will be run immediately on the IO thread.
+#if defined(OS_ANDROID)
+ // On Android the device sensors implementations need to run on the UI thread
+ // to communicate to Java.
+ AddUIThreadInterface(registry.get(), base::Bind(&DeviceLightHost::Create));
+ AddUIThreadInterface(registry.get(), base::Bind(&DeviceMotionHost::Create));
+ AddUIThreadInterface(registry.get(),
+ base::Bind(&DeviceOrientationHost::Create));
+ AddUIThreadInterface(registry.get(),
+ base::Bind(&DeviceOrientationAbsoluteHost::Create));
+#else
+ // On platforms other than Android the device sensors implementations run on
+ // the IO thread.
registry->AddInterface(base::Bind(&DeviceLightHost::Create));
registry->AddInterface(base::Bind(&DeviceMotionHost::Create));
registry->AddInterface(base::Bind(&DeviceOrientationHost::Create));
registry->AddInterface(base::Bind(&DeviceOrientationAbsoluteHost::Create));
+#endif // defined(OS_ANDROID)
+
registry->AddInterface(
base::Bind(&URLLoaderFactoryImpl::Create, resource_message_filter_));

Powered by Google App Engine
This is Rietveld 408576698