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

Issue 833983002: Stop using [Client=...] feature of Mojom for BatteryMonitor (Closed)

Created:
5 years, 11 months ago by darin (slow to review)
Modified:
5 years, 11 months ago
Reviewers:
Tom Sepez, timvolodine, ppi
CC:
jamesr, chromium-reviews, mlamouri+watch-content_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, jam, abarth-chromium, Aaron Boodman, darin-cc_chromium.org, yzshen+watch_chromium.org, mkwst+moarreviews-renderer_chromium.org, ben+mojo_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Stop 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+115 lines, -41 lines) Patch
M android_webview/java_library_common.mk View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +0 lines, -2 lines 0 comments Download
M content/browser/battery_status/battery_monitor_integration_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +23 lines, -8 lines 0 comments Download
M content/renderer/battery_status/battery_status_dispatcher.h View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -5 lines 0 comments Download
M content/renderer/battery_status/battery_status_dispatcher.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +11 lines, -1 line 0 comments Download
M content/renderer/battery_status/battery_status_dispatcher_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +3 lines, -0 lines 0 comments Download
M device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorImpl.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +31 lines, -14 lines 0 comments Download
M device/battery/battery_monitor.mojom View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +5 lines, -6 lines 0 comments Download
M device/battery/battery_monitor_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +11 lines, -0 lines 0 comments Download
M device/battery/battery_monitor_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +26 lines, -5 lines 0 comments Download
M device/battery/battery_status_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 24 (5 generated)
jamesr
https://codereview.chromium.org/833983002/diff/30001/content/renderer/battery_status/battery_status_dispatcher.cc File content/renderer/battery_status/battery_status_dispatcher.cc (right): https://codereview.chromium.org/833983002/diff/30001/content/renderer/battery_status/battery_status_dispatcher.cc#newcode19 content/renderer/battery_status/battery_status_dispatcher.cc:19: RenderThread::Get()->GetServiceRegistry()->ConnectToRemoteService(&monitor_); i'm not as familiar with content::'s service registry ...
5 years, 11 months ago (2015-01-05 23:33:10 UTC) #2
darin (slow to review)
On 2015/01/05 23:33:10, jamesr wrote: > https://codereview.chromium.org/833983002/diff/30001/content/renderer/battery_status/battery_status_dispatcher.cc > File content/renderer/battery_status/battery_status_dispatcher.cc (right): > > https://codereview.chromium.org/833983002/diff/30001/content/renderer/battery_status/battery_status_dispatcher.cc#newcode19 > ...
5 years, 11 months ago (2015-01-06 00:52:12 UTC) #3
darin (slow to review)
+ppi to review java bits +tim to review c++ bits +jamesr -> FYI, but feedback ...
5 years, 11 months ago (2015-01-07 08:58:52 UTC) #5
qsr
https://codereview.chromium.org/833983002/diff/250001/device/battery/battery_monitor.mojom File device/battery/battery_monitor.mojom (right): https://codereview.chromium.org/833983002/diff/250001/device/battery/battery_monitor.mojom#newcode14 device/battery/battery_monitor.mojom:14: QueryNextStatus() => (BatteryStatus status); Any reason you choose this ...
5 years, 11 months ago (2015-01-07 09:05:00 UTC) #7
timvolodine
c++ bits look fine to me in general. just a few comments/questions below: https://codereview.chromium.org/833983002/diff/250001/device/battery/battery_monitor.mojom File ...
5 years, 11 months ago (2015-01-07 14:38:51 UTC) #8
darin (slow to review)
On 2015/01/07 09:05:00, qsr wrote: > https://codereview.chromium.org/833983002/diff/250001/device/battery/battery_monitor.mojom > File device/battery/battery_monitor.mojom (right): > > https://codereview.chromium.org/833983002/diff/250001/device/battery/battery_monitor.mojom#newcode14 > ...
5 years, 11 months ago (2015-01-07 19:32:57 UTC) #9
darin (slow to review)
On 2015/01/07 14:38:51, timvolodine wrote: > c++ bits look fine to me in general. just ...
5 years, 11 months ago (2015-01-07 19:35:34 UTC) #10
ppi
https://codereview.chromium.org/833983002/diff/250001/android_webview/java_library_common.mk File android_webview/java_library_common.mk (right): https://codereview.chromium.org/833983002/diff/250001/android_webview/java_library_common.mk#newcode78 android_webview/java_library_common.mk:78: $(call intermediates-dir-for,GYP,shared)/java_mojo/device_battery_mojo_bindings/src/org/chromium/mojom/device/BatteryStatusObserver_Internal.java This line should go away too. https://codereview.chromium.org/833983002/diff/250001/device/battery/android/java/src/org/chromium/device/battery/BatteryMonitorImpl.java ...
5 years, 11 months ago (2015-01-07 19:37:36 UTC) #11
ppi
https://codereview.chromium.org/833983002/diff/250001/device/battery/battery_monitor.mojom File device/battery/battery_monitor.mojom (right): https://codereview.chromium.org/833983002/diff/250001/device/battery/battery_monitor.mojom#newcode13 device/battery/battery_monitor.mojom:13: // supported. Ach, you probably did mean "supported", please ...
5 years, 11 months ago (2015-01-07 19:41:12 UTC) #12
darin (slow to review)
https://codereview.chromium.org/833983002/diff/250001/device/battery/battery_monitor.mojom File device/battery/battery_monitor.mojom (right): https://codereview.chromium.org/833983002/diff/250001/device/battery/battery_monitor.mojom#newcode13 device/battery/battery_monitor.mojom:13: // supported. On 2015/01/07 19:41:12, ppi wrote: > Ach, ...
5 years, 11 months ago (2015-01-07 20:39:53 UTC) #13
darin (slow to review)
Thanks for the feedback. PTAL +tsepez for IPC review
5 years, 11 months ago (2015-01-07 21:10:19 UTC) #15
Tom Sepez
Messages LGTM
5 years, 11 months ago (2015-01-07 21:26:02 UTC) #16
timvolodine
On 2015/01/07 19:35:34, darin wrote: > On 2015/01/07 14:38:51, timvolodine wrote: > https://codereview.chromium.org/833983002/diff/250001/device/battery/battery_monitor.mojom#oldcode10 > > ...
5 years, 11 months ago (2015-01-07 22:50:22 UTC) #17
ppi
lgtm % comment, thanks https://codereview.chromium.org/833983002/diff/270001/android_webview/java_library_common.mk File android_webview/java_library_common.mk (right): https://codereview.chromium.org/833983002/diff/270001/android_webview/java_library_common.mk#newcode78 android_webview/java_library_common.mk:78: $(call intermediates-dir-for,GYP,shared)/java_mojo/device_battery_mojo_bindings/src/org/chromium/mojom/device/BatteryStatusObserver_Internal.java Not sure if ...
5 years, 11 months ago (2015-01-07 23:35:16 UTC) #18
darin (slow to review)
On 2015/01/07 22:50:22, timvolodine wrote: ... > also curious if it would make sense to ...
5 years, 11 months ago (2015-01-08 17:06:49 UTC) #19
darin (slow to review)
On 2015/01/07 23:35:16, ppi wrote: > lgtm % comment, thanks > > https://codereview.chromium.org/833983002/diff/270001/android_webview/java_library_common.mk > File ...
5 years, 11 months ago (2015-01-08 17:07:00 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/833983002/290001
5 years, 11 months ago (2015-01-08 17:24:01 UTC) #22
commit-bot: I haz the power
Committed patchset #16 (id:290001)
5 years, 11 months ago (2015-01-08 18:21:18 UTC) #23
commit-bot: I haz the power
5 years, 11 months ago (2015-01-08 18:24:13 UTC) #24
Message was sent while issue was closed.
Patchset 16 (id:??) landed as
https://crrev.com/3e80dbd6aab92f759c262b10fe6fee902e9a6d15
Cr-Commit-Position: refs/heads/master@{#310539}

Powered by Google App Engine
This is Rietveld 408576698