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

Unified Diff: Source/devtools/front_end/MemoryStatistics.js

Issue 196523006: [DevTools]Abstract Counter and CounterUIBase (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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 | « Source/devtools/front_end/CountersGraph.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/MemoryStatistics.js
diff --git a/Source/devtools/front_end/MemoryStatistics.js b/Source/devtools/front_end/MemoryStatistics.js
index c6a2d1e362323f91c8aa1ade9410827df8fc8c3a..c3b6bf3f7ae172666b2eacd7b89e915016427ebb 100644
--- a/Source/devtools/front_end/MemoryStatistics.js
+++ b/Source/devtools/front_end/MemoryStatistics.js
@@ -70,14 +70,14 @@ WebInspector.MemoryStatistics = function(delegate, model)
* @constructor
* @param {string} counterName
*/
-WebInspector.MemoryStatistics.Counter = function(counterName)
+WebInspector.Counter = function(counterName)
{
this.counterName = counterName;
this.times = [];
this.values = [];
}
-WebInspector.MemoryStatistics.Counter.prototype = {
+WebInspector.Counter.prototype = {
/**
* @param {number} time
* @param {!TimelineAgent.Counters} counters
@@ -181,34 +181,20 @@ WebInspector.SwatchCheckbox.prototype = {
/**
* @constructor
- * @param {!WebInspector.MemoryStatistics} memoryCountersPane
- * @param {string} title
* @param {string} graphColor
- * @param {!WebInspector.MemoryStatistics.Counter} counter
+ * @param {!WebInspector.Counter} counter
*/
-WebInspector.CounterUIBase = function(memoryCountersPane, title, graphColor, counter)
+WebInspector.CounterUIBase = function(graphColor, counter)
{
- this._memoryCountersPane = memoryCountersPane;
this.counter = counter;
- var container = memoryCountersPane.sidebarElement().createChild("div", "memory-counter-sidebar-info");
- var swatchColor = graphColor;
- this._swatch = new WebInspector.SwatchCheckbox(WebInspector.UIString(title), swatchColor);
- this._swatch.addEventListener(WebInspector.SwatchCheckbox.Events.Changed, this._toggleCounterGraph.bind(this));
- container.appendChild(this._swatch.element);
-
- this._value = null;
this.graphColor = graphColor;
this.strokeColor = graphColor;
this.graphYValues = [];
-}
+ this._value = null;
+ this._marker = null;
+},
WebInspector.CounterUIBase.prototype = {
- _toggleCounterGraph: function(event)
- {
- this._value.classList.toggle("hidden", !this._swatch.checked);
- this._memoryCountersPane.refresh();
- },
-
/**
* @param {number} x
* @return {number}
@@ -239,10 +225,42 @@ WebInspector.CounterUIBase.prototype = {
this._marker.classList.add("hidden");
},
+ get visible() {
+ return true;
+ },
+}
+
+/**
+ * @constructor
+ * @param {!WebInspector.MemoryStatistics} memoryCountersPane
+ * @param {string} title
+ * @param {string} graphColor
+ * @param {!WebInspector.Counter} counter
+ */
+WebInspector.MemoryCounterUIBase = function(memoryCountersPane, title, graphColor, counter)
+{
+ WebInspector.CounterUIBase.call(this, graphColor, counter);
+ this._memoryCountersPane = memoryCountersPane;
+ var container = memoryCountersPane.sidebarElement().createChild("div", "memory-counter-sidebar-info");
+ var swatchColor = graphColor;
+ this._swatch = new WebInspector.SwatchCheckbox(WebInspector.UIString(title), swatchColor);
+ this._swatch.addEventListener(WebInspector.SwatchCheckbox.Events.Changed, this._toggleCounterGraph.bind(this));
+ container.appendChild(this._swatch.element);
+}
+
+WebInspector.MemoryCounterUIBase.prototype = {
+ _toggleCounterGraph: function(event)
+ {
+ this._value.classList.toggle("hidden", !this._swatch.checked);
+ this._memoryCountersPane.refresh();
+ },
+
get visible()
{
return this._swatch.checked;
},
+
+ __proto__: WebInspector.CounterUIBase.prototype
}
WebInspector.MemoryStatistics.prototype = {
« no previous file with comments | « Source/devtools/front_end/CountersGraph.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698