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

Issue 319143002: DevTools: introduce WebInspector.Throttler (Closed)

Created:
6 years, 6 months ago by lushnikov
Modified:
6 years, 6 months ago
CC:
blink-reviews, caseq+blink_chromium.org, loislo+blink_chromium.org, eustas+blink_chromium.org, malch+blink_chromium.org, yurys+blink_chromium.org, lushnikov+blink_chromium.org, vsevik+blink_chromium.org, pfeldman+blink_chromium.org, paulirish+reviews_chromium.org, apavlov+blink_chromium.org, devtools-reviews_chromium.org, sergeyv+blink_chromium.org, aandrey+blink_chromium.org
Visibility:
Public.

Description

DevTools: introduce WebInspector.Throttler This patch introduces WebInspector.Throttler and uses it for throttling calls to PageAgent in OverridesSupport, as well as throttling calls in StylesSourceMapping. Throttler is a helper object that throttles execution of processes (possibly asynchronous). Throttler is created with a single parameter - throttle interval T. Throttler satisfies to the following contract: for every two consecutive runs performed by throttler, time between the end of the first run and start of the second run is always greater or equal to T. Throttler.schedule has additional second parameter "asSoonAsPossible" which essentially sets throttler timeout into 0 for the next process run. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=175956

Patch Set 1 #

Total comments: 2

Patch Set 2 : support asSoonAsPossible argument for schedule #

Patch Set 3 : address @vsevik comments #

Patch Set 4 : migrate StylesSourceMapping on throttler #

Patch Set 5 : jsdoc for Throttler.FinishCallback #

Total comments: 18

Patch Set 6 : address @vsevik & @dgozman comments #

Total comments: 9

Patch Set 7 : reduce Throttler state as discussed with dgozman #

Patch Set 8 : Remove unnecessary flag from Overrides support. #

Patch Set 9 : fix testcase #

Total comments: 12

Patch Set 10 : add throttler test. #

Patch Set 11 : address @vsevik & @aandrey comments #

Total comments: 2

Patch Set 12 : address @vsevik's nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+431 lines, -77 lines) Patch
M LayoutTests/http/tests/inspector/inspector-test.js View 1 2 3 4 5 6 7 8 9 2 chunks +37 lines, -1 line 0 comments Download
M LayoutTests/inspector/extensions/extensions-resources.html View 1 2 3 4 5 6 7 8 9 1 chunk +8 lines, -3 lines 0 comments Download
A LayoutTests/inspector/throttler.html View 1 2 3 4 5 6 7 8 9 1 chunk +184 lines, -0 lines 0 comments Download
A LayoutTests/inspector/throttler-expected.txt View 1 2 3 4 5 6 7 8 9 1 chunk +81 lines, -0 lines 0 comments Download
M Source/devtools/devtools.gypi View 1 chunk +1 line, -0 lines 0 comments Download
A Source/devtools/front_end/common/Throttler.js View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +88 lines, -0 lines 0 comments Download
M Source/devtools/front_end/inspector.html View 1 chunk +1 line, -0 lines 0 comments Download
M Source/devtools/front_end/sdk/OverridesSupport.js View 1 2 3 4 5 6 7 4 chunks +19 lines, -23 lines 0 comments Download
M Source/devtools/front_end/sdk/StylesSourceMapping.js View 1 2 3 4 5 3 chunks +11 lines, -50 lines 0 comments Download
M Source/devtools/scripts/frontend_modules.json View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 28 (0 generated)
lushnikov
ptal
6 years, 6 months ago (2014-06-06 14:01:18 UTC) #1
vsevik
I think migrating StylesSourceMapping on this would help to explain the motivation behind this change. ...
6 years, 6 months ago (2014-06-06 16:14:46 UTC) #2
lushnikov
>I think migrating StylesSourceMapping on this would help to explain the >motivation behind this change. ...
6 years, 6 months ago (2014-06-06 16:38:15 UTC) #3
lushnikov
Migrated StylesSourceMapping onto throttler.
6 years, 6 months ago (2014-06-08 14:36:33 UTC) #4
lushnikov
Added jsdoc for Throttler callback
6 years, 6 months ago (2014-06-08 17:19:01 UTC) #5
dgozman
https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/common/Throttler.js#newcode52 Source/devtools/front_end/common/Throttler.js:52: if (this._processTimeout) How can this be non-null? https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/common/Throttler.js#newcode60 Source/devtools/front_end/common/Throttler.js:60: ...
6 years, 6 months ago (2014-06-09 07:01:51 UTC) #6
lushnikov
https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/common/Throttler.js#newcode52 Source/devtools/front_end/common/Throttler.js:52: if (this._processTimeout) On 2014/06/09 07:01:51, dgozman wrote: > How ...
6 years, 6 months ago (2014-06-09 09:45:53 UTC) #7
dgozman
https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/common/Throttler.js#newcode42 Source/devtools/front_end/common/Throttler.js:42: this._asSoonAsPossible = this._asSoonAsPossible || !!asSoonAsPossible; I think, the general ...
6 years, 6 months ago (2014-06-09 12:03:34 UTC) #8
vsevik
https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/sdk/OverridesSupport.js File Source/devtools/front_end/sdk/OverridesSupport.js (left): https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/sdk/OverridesSupport.js#oldcode659 Source/devtools/front_end/sdk/OverridesSupport.js:659: setDeviceMetricsOverride.call(this); This one is not called synchronously anymore, could ...
6 years, 6 months ago (2014-06-09 12:32:58 UTC) #9
lushnikov
Addressed your comments guys. https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://codereview.chromium.org/319143002/diff/80001/Source/devtools/front_end/common/Throttler.js#newcode42 Source/devtools/front_end/common/Throttler.js:42: this._asSoonAsPossible = this._asSoonAsPossible || !!asSoonAsPossible; ...
6 years, 6 months ago (2014-06-09 13:07:27 UTC) #10
dgozman
https://codereview.chromium.org/319143002/diff/100001/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://codereview.chromium.org/319143002/diff/100001/Source/devtools/front_end/common/Throttler.js#newcode14 Source/devtools/front_end/common/Throttler.js:14: this._asSoonAsPossible = false; Consider renaming to something like |skipTimeout|. ...
6 years, 6 months ago (2014-06-09 13:17:38 UTC) #11
dgozman
OverridesSupport lgtm
6 years, 6 months ago (2014-06-09 13:18:54 UTC) #12
pfeldman
https://codereview.chromium.org/319143002/diff/100001/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://codereview.chromium.org/319143002/diff/100001/Source/devtools/front_end/common/Throttler.js#newcode43 Source/devtools/front_end/common/Throttler.js:43: this._asSoonAsPossible = this._asSoonAsPossible || !!asSoonAsPossible || !this._isRunningProcess; This logic ...
6 years, 6 months ago (2014-06-09 13:26:45 UTC) #13
lushnikov
On 2014/06/09 13:26:45, pfeldman_ooo wrote: > https://codereview.chromium.org/319143002/diff/100001/Source/devtools/front_end/common/Throttler.js > File Source/devtools/front_end/common/Throttler.js (right): > > https://codereview.chromium.org/319143002/diff/100001/Source/devtools/front_end/common/Throttler.js#newcode43 > ...
6 years, 6 months ago (2014-06-09 15:42:28 UTC) #14
lushnikov
https://codereview.chromium.org/319143002/diff/100001/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://codereview.chromium.org/319143002/diff/100001/Source/devtools/front_end/common/Throttler.js#newcode14 Source/devtools/front_end/common/Throttler.js:14: this._asSoonAsPossible = false; On 2014/06/09 13:17:37, dgozman wrote: > ...
6 years, 6 months ago (2014-06-09 15:53:42 UTC) #15
dgozman
https://codereview.chromium.org/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://codereview.chromium.org/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js#newcode62 Source/devtools/front_end/common/Throttler.js:62: this._isRunningProcess = this._asSoonAsPossible; If you clear |this._asSoonAsPossible| here: - ...
6 years, 6 months ago (2014-06-09 19:43:12 UTC) #16
lushnikov
https://codereview.chromium.org/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://codereview.chromium.org/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js#newcode62 Source/devtools/front_end/common/Throttler.js:62: this._isRunningProcess = this._asSoonAsPossible; On 2014/06/09 19:43:11, dgozman wrote: > ...
6 years, 6 months ago (2014-06-10 09:05:22 UTC) #17
vsevik
lgtm, but consider simplifying this with the lines below as discussed offline. Can we also ...
6 years, 6 months ago (2014-06-10 11:39:00 UTC) #18
aandrey
nits https://chromiumcodereview.appspot.com/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://chromiumcodereview.appspot.com/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js#newcode13 Source/devtools/front_end/common/Throttler.js:13: this._processTimeout = null; remove https://chromiumcodereview.appspot.com/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js#newcode15 Source/devtools/front_end/common/Throttler.js:15: this._process = ...
6 years, 6 months ago (2014-06-10 14:59:53 UTC) #19
aandrey
https://chromiumcodereview.appspot.com/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://chromiumcodereview.appspot.com/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js#newcode9 Source/devtools/front_end/common/Throttler.js:9: WebInspector.Throttler = function(timeout) IMO, the most common use case ...
6 years, 6 months ago (2014-06-10 15:08:38 UTC) #20
vsevik
On 2014/06/10 15:08:38, aandrey wrote: > https://chromiumcodereview.appspot.com/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js > File Source/devtools/front_end/common/Throttler.js (right): > > https://chromiumcodereview.appspot.com/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js#newcode9 > ...
6 years, 6 months ago (2014-06-10 15:35:04 UTC) #21
lushnikov
https://chromiumcodereview.appspot.com/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://chromiumcodereview.appspot.com/319143002/diff/30006/Source/devtools/front_end/common/Throttler.js#newcode15 Source/devtools/front_end/common/Throttler.js:15: this._process = null; On 2014/06/10 14:59:53, aandrey wrote: > ...
6 years, 6 months ago (2014-06-10 16:05:09 UTC) #22
vsevik
https://chromiumcodereview.appspot.com/319143002/diff/190001/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://chromiumcodereview.appspot.com/319143002/diff/190001/Source/devtools/front_end/common/Throttler.js#newcode61 Source/devtools/front_end/common/Throttler.js:61: if (this._processTimeout && force) if (this._processTimeout) is enough
6 years, 6 months ago (2014-06-10 16:28:23 UTC) #23
vsevik
6 years, 6 months ago (2014-06-10 16:28:23 UTC) #24
lushnikov
Thanks for the review guys! https://chromiumcodereview.appspot.com/319143002/diff/190001/Source/devtools/front_end/common/Throttler.js File Source/devtools/front_end/common/Throttler.js (right): https://chromiumcodereview.appspot.com/319143002/diff/190001/Source/devtools/front_end/common/Throttler.js#newcode61 Source/devtools/front_end/common/Throttler.js:61: if (this._processTimeout && force) ...
6 years, 6 months ago (2014-06-10 16:44:59 UTC) #25
lushnikov
The CQ bit was checked by lushnikov@chromium.org
6 years, 6 months ago (2014-06-11 12:01:30 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/lushnikov@chromium.org/319143002/210001
6 years, 6 months ago (2014-06-11 12:02:17 UTC) #27
commit-bot: I haz the power
6 years, 6 months ago (2014-06-11 12:49:32 UTC) #28
Message was sent while issue was closed.
Change committed as 175956

Powered by Google App Engine
This is Rietveld 408576698