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

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: Response to review Created 4 years, 1 month 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 ba63945eeb29b13d2d8344f7be2a404fe2520c91..7718166d3eeb2969e275280d21496abbe35d4680 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1263,11 +1263,23 @@ 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(&VideoCaptureHost::Create,

Powered by Google App Engine
This is Rietveld 408576698