Index: content/browser/resources/media/data_series.js |
diff --git a/content/browser/resources/media/data_series.js b/content/browser/resources/media/data_series.js |
index f32c822c5539e1084689961e9cde5c54e0c9fd83..3dfad4e28077c1f02bb9cb3b1d4bac27705058c6 100644 |
--- a/content/browser/resources/media/data_series.js |
+++ b/content/browser/resources/media/data_series.js |
@@ -6,6 +6,8 @@ |
* A TimelineDataSeries collects an ordered series of (time, value) pairs, |
* and converts them to graph points. It also keeps track of its color and |
* current visibility state. |
+ * It keeps MAX_STATS_DATA_POINT_BUFFER_SIZE data points at most. Old data |
+ * points will be dropped when it reaches this size. |
*/ |
var TimelineDataSeries = (function() { |
'use strict'; |
@@ -35,6 +37,9 @@ var TimelineDataSeries = (function() { |
addPoint: function(timeTicks, value) { |
var time = new Date(timeTicks); |
this.dataPoints_.push(new DataPoint(time, value)); |
+ |
+ if (this.dataPoints_.length > MAX_STATS_DATA_POINT_BUFFER_SIZE) |
+ this.dataPoints_.shift(); |
}, |
isVisible: function() { |