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

Issue 2503853002: [Sensors] Improvements in fetching reading for sensors with continuous reporting mode (Closed)

Created:
4 years, 1 month ago by Mikhail
Modified:
3 years, 12 months ago
CC:
chromium-reviews, blink-reviews, haraken
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Sensors] Improvements in fetching reading for sensors with continuous reporting mode If a platform sensors has continuous reporting mode its updates are not send via IPC, so there is a timer on Blink side which periodically reads the sensor data from shared buffer. Before this change every sensor instance had its own repeating timer, however in case of multiple sensor instances it could bloat the thread task queue with unneeded requests to read the sensor data from shared buffer. This patch introduces only one repeating timer per 'SensorProxy' (i.e. per frame) which is shared between all sensor instances of the same type. Another consequent change is that now the 'SensorProxy' class is inherited from 'PageVisibilityObserver' (and the 'Sensor' class is not any more) which makes suspend/resume code path more efficient. BUG=606766 Committed: https://crrev.com/7ef84cca9ddf9928a08967084030632d21b7fbff Cr-Commit-Position: refs/heads/master@{#434133}

Patch Set 1 #

Patch Set 2 : Fixed assertion hit #

Total comments: 8

Patch Set 3 : Comments from haraken@ + rename m_sensors -> m_sensorProxies #

Total comments: 1

Patch Set 4 : Comments from Alex #

Total comments: 8

Patch Set 5 : Comments from Tim #

Messages

Total messages: 51 (31 generated)
Mikhail
Please take a look
4 years, 1 month ago (2016-11-15 17:00:52 UTC) #16
timvolodine
https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp File third_party/WebKit/Source/modules/sensor/SensorProxy.cpp (right): https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp#newcode290 third_party/WebKit/Source/modules/sensor/SensorProxy.cpp:290: double repeatInterval = 1 / *it; does this mean ...
4 years, 1 month ago (2016-11-15 18:27:56 UTC) #17
Mikhail
https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp File third_party/WebKit/Source/modules/sensor/SensorProxy.cpp (right): https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp#newcode290 third_party/WebKit/Source/modules/sensor/SensorProxy.cpp:290: double repeatInterval = 1 / *it; On 2016/11/15 18:27:56, ...
4 years, 1 month ago (2016-11-15 19:19:00 UTC) #18
haraken
https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/Sensor.cpp File third_party/WebKit/Source/modules/sensor/Sensor.cpp (right): https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/Sensor.cpp#newcode167 third_party/WebKit/Source/modules/sensor/Sensor.cpp:167: Page* page = toDocument(getExecutionContext())->page(); toDocument(getExecutionContext()) => document https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.cpp File ...
4 years, 1 month ago (2016-11-16 04:31:47 UTC) #19
Mikhail
Thanks for review! https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/Sensor.cpp File third_party/WebKit/Source/modules/sensor/Sensor.cpp (right): https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/Sensor.cpp#newcode167 third_party/WebKit/Source/modules/sensor/Sensor.cpp:167: Page* page = toDocument(getExecutionContext())->page(); On 2016/11/16 ...
4 years, 1 month ago (2016-11-17 17:07:35 UTC) #20
haraken
Either way, this CL is not changing the existing timer behavior, so this CL LGTM ...
4 years, 1 month ago (2016-11-17 18:30:58 UTC) #22
shalamov
https://codereview.chromium.org/2503853002/diff/60001/third_party/WebKit/Source/modules/sensor/Sensor.cpp File third_party/WebKit/Source/modules/sensor/Sensor.cpp (right): https://codereview.chromium.org/2503853002/diff/60001/third_party/WebKit/Source/modules/sensor/Sensor.cpp#newcode287 third_party/WebKit/Source/modules/sensor/Sensor.cpp:287: updateState(Sensor::SensorState::Errored); Maybe make helper function with: if (m_sensorUpdateNotifier) m_sensorUpdateNotifier->cancelPendingNotifications(); ...
4 years, 1 month ago (2016-11-18 07:42:02 UTC) #27
shalamov
lgtm
4 years, 1 month ago (2016-11-18 08:53:34 UTC) #28
Sami
https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.cpp File third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.cpp (right): https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.cpp#newcode59 third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.cpp:59: m_timer.startOneShot(waitingTime, BLINK_FROM_HERE); On 2016/11/17 18:30:58, haraken wrote: > On ...
4 years, 1 month ago (2016-11-18 19:25:18 UTC) #30
Mikhail
On 2016/11/18 19:25:18, Sami (slow -- traveling) wrote: > > By the way, looks like ...
4 years, 1 month ago (2016-11-18 20:06:38 UTC) #31
Mikhail
Reilly, Tim, Sami, do you have any more comments on this CL?
4 years, 1 month ago (2016-11-21 11:21:37 UTC) #32
Sami
lgtm from my side. Maybe add a TODO about using repeating timers when it makes ...
4 years, 1 month ago (2016-11-21 15:50:13 UTC) #33
timvolodine
Just a few comments, otherwise looks fine to me. Also, probably best to format the ...
4 years, 1 month ago (2016-11-21 16:30:35 UTC) #34
timvolodine
On 2016/11/18 19:25:18, Sami wrote: > https://codereview.chromium.org/2503853002/diff/40001/third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.cpp > File > third_party/WebKit/Source/modules/sensor/SensorUpdateNotificationStrategy.cpp > (right): > > ...
4 years, 1 month ago (2016-11-21 16:32:27 UTC) #35
Mikhail
Thanks for your comments! https://codereview.chromium.org/2503853002/diff/80001/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp File third_party/WebKit/Source/modules/sensor/SensorProxy.cpp (right): https://codereview.chromium.org/2503853002/diff/80001/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp#newcode286 third_party/WebKit/Source/modules/sensor/SensorProxy.cpp:286: auto it = On 2016/11/21 ...
4 years, 1 month ago (2016-11-22 12:54:23 UTC) #38
tdresser
+dtapuska@ I don't think we should be using a repeating timer here, we should synchronize ...
4 years, 1 month ago (2016-11-22 13:24:39 UTC) #40
Mikhail
On 2016/11/22 13:24:39, tdresser wrote: > +dtapuska@ > > I don't think we should be ...
4 years ago (2016-11-23 08:17:12 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2503853002/100001
4 years ago (2016-11-23 08:18:48 UTC) #46
commit-bot: I haz the power
Committed patchset #5 (id:100001)
4 years ago (2016-11-23 08:23:04 UTC) #49
commit-bot: I haz the power
4 years ago (2016-11-23 08:24:58 UTC) #51
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/7ef84cca9ddf9928a08967084030632d21b7fbff
Cr-Commit-Position: refs/heads/master@{#434133}

Powered by Google App Engine
This is Rietveld 408576698