DevTools: [SASS] poll CSS for 30 seconds instead of 5 seconds.

Currently, SASSSourceMapping polls CSS for 5 seconds after the SASS
change, and this turns out to be insufficient in case of complex
css-processing build steps.

Instead of adding one more setting "css polling duration", this patch
tries to solve most of the problems by increasing polling duration
to 30 seconds.

BUG=421925
R=vsevik, apavlov

Review URL: https://codereview.chromium.org/658123002

git-svn-id: svn://svn.chromium.org/blink/trunk@183819 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 22fc8a39
......@@ -37,7 +37,7 @@
*/
WebInspector.SASSSourceMapping = function(cssModel, workspace, networkWorkspaceBinding)
{
this.pollPeriodMs = 5000;
this.pollPeriodMs = 30 * 1000;
this.pollIntervalMs = 200;
this._cssModel = cssModel;
......@@ -221,10 +221,14 @@ WebInspector.SASSSourceMapping.prototype = {
if (!pollData)
return;
if (stopPolling || (now = new Date().getTime()) > pollData.deadlineMs) {
delete pollData.dataByURL[cssURL];
if (!Object.keys(pollData.dataByURL).length)
delete this._pollDataForSASSURL[sassURL];
if (stopPolling) {
this._stopPolling(cssURL, sassURL);
return;
}
if ((now = new Date().getTime()) > pollData.deadlineMs) {
WebInspector.console.warn(WebInspector.UIString("%s hasn't been updated in %d seconds.", cssURL, this.pollPeriodMs / 1000));
this._stopPolling(cssURL, sassURL);
return;
}
var nextPoll = this.pollIntervalMs + pollData.dataByURL[cssURL].previousPoll;
......@@ -233,6 +237,18 @@ WebInspector.SASSSourceMapping.prototype = {
pollData.dataByURL[cssURL].timer = setTimeout(this._reloadCSS.bind(this, cssURL, sassURL, this._pollCallback.bind(this)), remainingTimeoutMs);
},
/**
* @param {string} cssURL
* @param {string} sassURL
*/
_stopPolling: function(cssURL, sassURL)
{
var pollData = this._pollDataForSASSURL[sassURL];
delete pollData.dataByURL[cssURL];
if (!Object.keys(pollData.dataByURL).length)
delete this._pollDataForSASSURL[sassURL];
},
/**
* @param {string} cssURL
* @param {string} sassURL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment