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

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

Issue 2738773004: No longer clamp setTimeout(..., 0) to 1ms. (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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 * @param {boolean} forceTimerUpdate 66 * @param {boolean} forceTimerUpdate
67 */ 67 */
68 _innerSchedule(forceTimerUpdate) { 68 _innerSchedule(forceTimerUpdate) {
69 if (this._isRunningProcess) 69 if (this._isRunningProcess)
70 return; 70 return;
71 if (this._processTimeout && !forceTimerUpdate) 71 if (this._processTimeout && !forceTimerUpdate)
72 return; 72 return;
73 if (this._processTimeout) 73 if (this._processTimeout)
74 this._clearTimeout(this._processTimeout); 74 this._clearTimeout(this._processTimeout);
75 75
76 var timeout = this._asSoonAsPossible ? 0 : this._timeout; 76 var timeout = this._asSoonAsPossible ? 1 : this._timeout;
77 this._processTimeout = this._setTimeout(this._onTimeout.bind(this), timeout) ; 77 this._processTimeout = this._setTimeout(this._onTimeout.bind(this), timeout) ;
78 } 78 }
79 79
80 /** 80 /**
81 * @param {number} timeoutId 81 * @param {number} timeoutId
82 */ 82 */
83 _clearTimeout(timeoutId) { 83 _clearTimeout(timeoutId) {
84 clearTimeout(timeoutId); 84 clearTimeout(timeoutId);
85 } 85 }
86 86
87 /** 87 /**
88 * @param {function()} operation 88 * @param {function()} operation
89 * @param {number} timeout 89 * @param {number} timeout
90 * @return {number} 90 * @return {number}
91 */ 91 */
92 _setTimeout(operation, timeout) { 92 _setTimeout(operation, timeout) {
93 return setTimeout(operation, timeout); 93 return setTimeout(operation, timeout);
94 } 94 }
95 }; 95 };
96 96
97 /** @typedef {function(!Error=)} */ 97 /** @typedef {function(!Error=)} */
98 Common.Throttler.FinishCallback; 98 Common.Throttler.FinishCallback;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698