Index: third_party/WebKit/Source/devtools/front_end/common/Throttler.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/common/Throttler.js b/third_party/WebKit/Source/devtools/front_end/common/Throttler.js |
index 284f47e321ee8c04af82a43e97bcb43e4dd2d625..5465df5a4429ddc02808f9c973bbf6f86fae987a 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/common/Throttler.js |
+++ b/third_party/WebKit/Source/devtools/front_end/common/Throttler.js |
@@ -13,11 +13,13 @@ WebInspector.Throttler = function(timeout) |
this._asSoonAsPossible = false; |
/** @type {?function():(!Promise.<?>)} */ |
this._process = null; |
+ this._lastCompleteTime = 0; |
} |
WebInspector.Throttler.prototype = { |
_processCompleted: function() |
{ |
+ this._lastCompleteTime = window.performance.now(); |
this._isRunningProcess = false; |
if (this._process) |
this._innerSchedule(false); |
@@ -53,7 +55,8 @@ WebInspector.Throttler.prototype = { |
// Run the first scheduled task instantly. |
var hasScheduledTasks = !!this._processTimeout || this._isRunningProcess; |
- asSoonAsPossible = !!asSoonAsPossible || !hasScheduledTasks; |
+ var okToFire = window.performance.now() - this._lastCompleteTime > this._timeout; |
+ asSoonAsPossible = !!asSoonAsPossible || (!hasScheduledTasks && okToFire); |
var forceTimerUpdate = asSoonAsPossible && !this._asSoonAsPossible; |
this._asSoonAsPossible = this._asSoonAsPossible || asSoonAsPossible; |
@@ -61,6 +64,12 @@ WebInspector.Throttler.prototype = { |
this._innerSchedule(forceTimerUpdate); |
}, |
+ flush: function() |
+ { |
+ if (this._process) |
+ this._onTimeout(); |
+ }, |
+ |
/** |
* @param {boolean} forceTimerUpdate |
*/ |