Chromium Code Reviews
Description[Device Sensors] Move Mojo communication to UI thread on Android
In preparation for removing content::BrowserThread knowledge from
Device Sensors, this CL eliminates the need for SensorManagerAndroid to
live on multiple threads. Instead, Mojo communication for Device Sensors
occurs on the UI thread on Android, resulting in the following structure:
- On Android, all of the device sensors host code lives solely on the
UI thread.
- On all other platforms, all of the device sensors host code lives
solely on the IO thread.
This restructure will enable a straightforward followup that replaces
usage of content::BrowserThread with //base-level primitives in this code.
Note that device_sensor_browsertest.cc had to be updated to support this
change:
- Could no longer use WaitableEvents, as they blocked the UI thread while
waiting for incoming Mojo communication, which on Android is now incoming
on the UI thread :P.
- Instead, the tests spin up run loops and pass their QuitClosures into
the FakeDataFetcher, which calls those QuitClosures on the UI thread when
the appropriate events occur. In this way, the tests can wait for the
various events (by Running the appropriate RunLoop) regardless of whether
the Mojo communication (and FakeDataFetcher) live on the UI or IO thread.
BUG=612322
Committed: https://crrev.com/4489ef7781fd694d199e2c5a407f0614317de2d7
Cr-Commit-Position: refs/heads/master@{#432455}
Patch Set 1 #Patch Set 2 : git cl format #Patch Set 3 : Update browsertest #Patch Set 4 : Fix browsertest #
Total comments: 4
Patch Set 5 : Rebase #Patch Set 6 : Response to review #
Total comments: 4
Patch Set 7 : Rebase #Patch Set 8 : Response to review #
Dependent Patchsets: Messages
Total messages: 35 (20 generated)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||