- Revision
- 203633
- Author
- rn...@webkit.org
- Date
- 2016-07-22 23:11:33 -0700 (Fri, 22 Jul 2016)
Log Message
REGRESSION(r203035): Marking points as an outlier no longer updates charts
https://bugs.webkit.org/show_bug.cgi?id=160106
Reviewed by Darin Adler.
The bug was caused by MeasurementSet's fetchBetween clearing previously registered callbacks when noCache
option is specified.
* public/v3/components/time-series-chart.js:
(TimeSeriesChart.prototype.setSourceList): Clear this._fetchedTimeSeries when changing chart options.
e.g. need to start including or excluding outliers.
(TimeSeriesChart.prototype.fetchMeasurementSets): Don't skip the fetching when noCache is true.
* public/v3/models/measurement-set.js:
(MeasurementSet): Added this._callbackMap as an instance variable to keep track of all callbacks on every
cluster since we may need to call each callback multiple times per cluster when noCache option is used.
(MeasurementSet.prototype.fetchBetween): Moved the code to add _primaryClusterPromise to _allFetches here
so that now this function and _ensureClusterPromise are only functions that touch _allFetches.
(MeasurementSet.prototype._ensureClusterPromise): Extracted out of fetchBetween. Queue up all callbacks
for each cluster when creating a new promise.
(MeasurementSet.prototype._fetchPrimaryCluster): Removed the code to add _primaryClusterPromise now that
it's done in fetchBetween.
* public/v3/remote.js:
(RemoteAPI.postJSONWithStatus): Removed superfluous call to console.log.
* unit-tests/measurement-set-tests.js: Updated the test case for noCache. The callback registered before
fetchBetween is called with noCache=true is now invoked so callCount must be 3 instead of 2.
Modified Paths
Diff
Modified: trunk/Websites/perf.webkit.org/ChangeLog (203632 => 203633)
--- trunk/Websites/perf.webkit.org/ChangeLog 2016-07-23 06:01:15 UTC (rev 203632)
+++ trunk/Websites/perf.webkit.org/ChangeLog 2016-07-23 06:11:33 UTC (rev 203633)
@@ -1,3 +1,34 @@
+2016-07-22 Ryosuke Niwa <rn...@webkit.org>
+
+ REGRESSION(r203035): Marking points as an outlier no longer updates charts
+ https://bugs.webkit.org/show_bug.cgi?id=160106
+
+ Reviewed by Darin Adler.
+
+ The bug was caused by MeasurementSet's fetchBetween clearing previously registered callbacks when noCache
+ option is specified.
+
+ * public/v3/components/time-series-chart.js:
+ (TimeSeriesChart.prototype.setSourceList): Clear this._fetchedTimeSeries when changing chart options.
+ e.g. need to start including or excluding outliers.
+ (TimeSeriesChart.prototype.fetchMeasurementSets): Don't skip the fetching when noCache is true.
+
+ * public/v3/models/measurement-set.js:
+ (MeasurementSet): Added this._callbackMap as an instance variable to keep track of all callbacks on every
+ cluster since we may need to call each callback multiple times per cluster when noCache option is used.
+ (MeasurementSet.prototype.fetchBetween): Moved the code to add _primaryClusterPromise to _allFetches here
+ so that now this function and _ensureClusterPromise are only functions that touch _allFetches.
+ (MeasurementSet.prototype._ensureClusterPromise): Extracted out of fetchBetween. Queue up all callbacks
+ for each cluster when creating a new promise.
+ (MeasurementSet.prototype._fetchPrimaryCluster): Removed the code to add _primaryClusterPromise now that
+ it's done in fetchBetween.
+
+ * public/v3/remote.js:
+ (RemoteAPI.postJSONWithStatus): Removed superfluous call to console.log.
+
+ * unit-tests/measurement-set-tests.js: Updated the test case for noCache. The callback registered before
+ fetchBetween is called with noCache=true is now invoked so callCount must be 3 instead of 2.
+
2016-07-19 Ryosuke Niwa <rn...@webkit.org>
Perf dashboard always re-generate measurement set JSON
Modified: trunk/Websites/perf.webkit.org/public/v3/components/time-series-chart.js (203632 => 203633)
--- trunk/Websites/perf.webkit.org/public/v3/components/time-series-chart.js 2016-07-23 06:01:15 UTC (rev 203632)
+++ trunk/Websites/perf.webkit.org/public/v3/components/time-series-chart.js 2016-07-23 06:11:33 UTC (rev 203633)
@@ -83,6 +83,7 @@
{
this._sourceList = sourceList;
this.fetchMeasurementSets(false);
+ this._fetchedTimeSeries = null;
}
fetchMeasurementSets(noCache)
@@ -90,7 +91,7 @@
var fetching = false;
for (var source of this._sourceList) {
if (source.measurementSet) {
- if (source.measurementSet.hasFetchedRange(this._startTime, this._endTime))
+ if (!noCache && source.measurementSet.hasFetchedRange(this._startTime, this._endTime))
continue;
source.measurementSet.fetchBetween(this._startTime, this._endTime, this._didFetchMeasurementSet.bind(this, source.measurementSet), noCache);
fetching = true;
Modified: trunk/Websites/perf.webkit.org/public/v3/models/measurement-set.js (203632 => 203633)
--- trunk/Websites/perf.webkit.org/public/v3/models/measurement-set.js 2016-07-23 06:01:15 UTC (rev 203632)
+++ trunk/Websites/perf.webkit.org/public/v3/models/measurement-set.js 2016-07-23 06:11:33 UTC (rev 203633)
@@ -16,6 +16,7 @@
this._clusterStart = null;
this._clusterSize = null;
this._allFetches = {};
+ this._callbackMap = new Map;
this._primaryClusterPromise = null;
}
@@ -61,22 +62,38 @@
this._primaryClusterPromise = null;
this._allFetches = {};
}
- if (!this._primaryClusterPromise || noCache)
+ if (!this._primaryClusterPromise)
this._primaryClusterPromise = this._fetchPrimaryCluster(noCache);
var self = this;
this._primaryClusterPromise.catch(callback);
return this._primaryClusterPromise.then(function () {
- var promiseList = [];
- self.findClusters(startTime, endTime).map(function (clusterEndTime) {
- if(!self._allFetches[clusterEndTime])
- self._allFetches[clusterEndTime] = self._fetchSecondaryCluster(clusterEndTime);
- self._allFetches[clusterEndTime].then(callback, callback);
- promiseList.push(self._allFetches[clusterEndTime]);
- });
- return Promise.all(promiseList);
+ self._allFetches[self._primaryClusterEndTime] = self._primaryClusterPromise;
+ return Promise.all(self.findClusters(startTime, endTime).map(function (clusterEndTime) {
+ return self._ensureClusterPromise(clusterEndTime, callback);
+ }));
});
}
+ _ensureClusterPromise(clusterEndTime, callback)
+ {
+ if (!this._callbackMap.has(clusterEndTime))
+ this._callbackMap.set(clusterEndTime, new Set);
+ var callbackSet = this._callbackMap.get(clusterEndTime);
+ callbackSet.add(callback);
+
+ var promise = this._allFetches[clusterEndTime];
+ if (promise)
+ promise.then(callback, callback);
+ else {
+ promise = this._fetchSecondaryCluster(clusterEndTime);
+ for (var existingCallback of callbackSet)
+ promise.then(existingCallback, existingCallback);
+ this._allFetches[clusterEndTime] = promise;
+ }
+
+ return promise;
+ }
+
_constructUrl(useCache, clusterEndTime)
{
if (!useCache) {
@@ -96,7 +113,6 @@
if (noCache) {
return RemoteAPI.getJSONWithStatus(self._constructUrl(false, null)).then(function (data) {
self._didFetchJSON(true, data);
- self._allFetches[self._primaryClusterEndTime] = self._primaryClusterPromise;
});
}
@@ -110,7 +126,6 @@
return Promise.reject(error);
}).then(function (data) {
self._didFetchJSON(true, data);
- self._allFetches[self._primaryClusterEndTime] = self._primaryClusterPromise;
});
}
Modified: trunk/Websites/perf.webkit.org/public/v3/remote.js (203632 => 203633)
--- trunk/Websites/perf.webkit.org/public/v3/remote.js 2016-07-23 06:01:15 UTC (rev 203632)
+++ trunk/Websites/perf.webkit.org/public/v3/remote.js 2016-07-23 06:11:33 UTC (rev 203633)
@@ -9,7 +9,6 @@
RemoteAPI.postJSONWithStatus = function (path, data)
{
- console.log(document.cookie);
return this.getJSONWithStatus(path, data || {});
}
Modified: trunk/Websites/perf.webkit.org/unit-tests/measurement-set-tests.js (203632 => 203633)
--- trunk/Websites/perf.webkit.org/unit-tests/measurement-set-tests.js 2016-07-23 06:01:15 UTC (rev 203632)
+++ trunk/Websites/perf.webkit.org/unit-tests/measurement-set-tests.js 2016-07-23 06:11:33 UTC (rev 203633)
@@ -373,7 +373,7 @@
return waitForMeasurementSet();
}).then(function () {
- assert.equal(callCount, 2);
+ assert.equal(callCount, 3);
assert.equal(noCacheFetchCount, 2);
assert.equal(set._sortedClusters.length, 2);
assert.equal(requests.length, 4);