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

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
« no previous file with comments | « content/browser/device_sensors/sensor_manager_android.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c8cbea2370ade26c37a59d63bc45b09ecf01a971..48d69aa21d5ad28cb4dc478172c1ffc9564f391f 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1264,11 +1264,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,
« no previous file with comments | « content/browser/device_sensors/sensor_manager_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698