DescriptionStop using [Client=...] feature of Mojom for BatteryMonitor
Change BatteryMonitor to instead have a QueryNextStatus() method that clients can use to poll for changes to battery status. The first call will complete immediately, reporting the current battery status. After that, QueryNextStatus() will "hang" until there is a change to report.
This also solves a defect (anti-pattern) with the older design, which could result in the service consuming a lot of memory. That could happen if the client failed to consume any of the DidChange messages. Eventually, the pipe would back up, and queuing of MojoWriteMessage calls would occur in the service's process. By switching to a polling design, this problem is eliminated.
See further description of the anti-pattern here: https://groups.google.com/a/chromium.org/forum/#!topic/mojo-dev/pSNDDN3gpFo
Committed: https://crrev.com/3e80dbd6aab92f759c262b10fe6fee902e9a6d15
Cr-Commit-Position: refs/heads/master@{#310539}
Patch Set 1 #Patch Set 2 : add java changes #Patch Set 3 : fixup content integration tests #
Total comments: 3
Patch Set 4 : break BatteryMonitorClient out into its own file #Patch Set 5 : revised interface to be polling based #Patch Set 6 : revised interface to be polling based #Patch Set 7 : tweak #Patch Set 8 : c++11 #Patch Set 9 : rebase #Patch Set 10 : tweak #Patch Set 11 : port integration test to new mojom #Patch Set 12 : tweak #Patch Set 13 : make tests pass #Patch Set 14 : fix comments #
Total comments: 11
Patch Set 15 : revisions per review feedback #
Total comments: 1
Patch Set 16 : fixup per review feedback #Messages
Total messages: 24 (5 generated)
|