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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/common/Throttler.js

Issue 2770523002: DevTools: kill Common.Throttler.flush() method (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Common.Throttler = class { 7 Common.Throttler = class {
8 /** 8 /**
9 * @param {number} timeout 9 * @param {number} timeout
10 */ 10 */
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 var hasScheduledTasks = !!this._processTimeout || this._isRunningProcess; 50 var hasScheduledTasks = !!this._processTimeout || this._isRunningProcess;
51 var okToFire = window.performance.now() - this._lastCompleteTime > this._tim eout; 51 var okToFire = window.performance.now() - this._lastCompleteTime > this._tim eout;
52 asSoonAsPossible = !!asSoonAsPossible || (!hasScheduledTasks && okToFire); 52 asSoonAsPossible = !!asSoonAsPossible || (!hasScheduledTasks && okToFire);
53 53
54 var forceTimerUpdate = asSoonAsPossible && !this._asSoonAsPossible; 54 var forceTimerUpdate = asSoonAsPossible && !this._asSoonAsPossible;
55 this._asSoonAsPossible = this._asSoonAsPossible || asSoonAsPossible; 55 this._asSoonAsPossible = this._asSoonAsPossible || asSoonAsPossible;
56 56
57 this._innerSchedule(forceTimerUpdate); 57 this._innerSchedule(forceTimerUpdate);
58 } 58 }
59 59
60 flush() {
61 if (this._process)
62 this._onTimeout();
63 }
64
65 /** 60 /**
66 * @param {boolean} forceTimerUpdate 61 * @param {boolean} forceTimerUpdate
67 */ 62 */
68 _innerSchedule(forceTimerUpdate) { 63 _innerSchedule(forceTimerUpdate) {
69 if (this._isRunningProcess) 64 if (this._isRunningProcess)
70 return; 65 return;
71 if (this._processTimeout && !forceTimerUpdate) 66 if (this._processTimeout && !forceTimerUpdate)
72 return; 67 return;
73 if (this._processTimeout) 68 if (this._processTimeout)
74 this._clearTimeout(this._processTimeout); 69 this._clearTimeout(this._processTimeout);
(...skipping 14 matching lines...) Expand all
89 * @param {number} timeout 84 * @param {number} timeout
90 * @return {number} 85 * @return {number}
91 */ 86 */
92 _setTimeout(operation, timeout) { 87 _setTimeout(operation, timeout) {
93 return setTimeout(operation, timeout); 88 return setTimeout(operation, timeout);
94 } 89 }
95 }; 90 };
96 91
97 /** @typedef {function(!Error=)} */ 92 /** @typedef {function(!Error=)} */
98 Common.Throttler.FinishCallback; 93 Common.Throttler.FinishCallback;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698