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

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

Issue 1947143003: DevTools: make throttler with timeout respect the timeout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..074b27dc9aeb4ce9868a4cd8942dc15b2ea476d8 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 = Date.now();
caseq 2016/05/05 01:39:19 performance.now() * 1000?
this._isRunningProcess = false;
if (this._process)
this._innerSchedule(false);
@@ -53,7 +55,7 @@ WebInspector.Throttler.prototype = {
// Run the first scheduled task instantly.
var hasScheduledTasks = !!this._processTimeout || this._isRunningProcess;
- asSoonAsPossible = !!asSoonAsPossible || !hasScheduledTasks;
+ asSoonAsPossible = !!asSoonAsPossible || (!hasScheduledTasks && Date.now() - this._lastCompleteTime > this._timeout);
caseq 2016/05/05 01:39:19 ditto.
var forceTimerUpdate = asSoonAsPossible && !this._asSoonAsPossible;
this._asSoonAsPossible = this._asSoonAsPossible || asSoonAsPossible;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698