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

Side by Side Diff: Source/devtools/front_end/CountersGraph.js

Issue 183893010: DevTools: extract TimelineModel.Record from TimelinePresentationModel.Record. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @extends {WebInspector.MemoryStatistics} 33 * @extends {WebInspector.MemoryStatistics}
34 * @implements {WebInspector.TimelineModeView} 34 * @implements {WebInspector.TimelineModeView}
35 * @param {!WebInspector.TimelineModeViewDelegate} delegate 35 * @param {!WebInspector.TimelineModeViewDelegate} delegate
36 * @param {!WebInspector.TimelinePresentationModel} presentationModel 36 * @param {!WebInspector.TimelineModel} model
37 */ 37 */
38 WebInspector.CountersGraph = function(delegate, presentationModel) 38 WebInspector.CountersGraph = function(delegate, model)
39 { 39 {
40 WebInspector.MemoryStatistics.call(this, delegate, presentationModel); 40 WebInspector.MemoryStatistics.call(this, delegate, model);
41 } 41 }
42 42
43 /** 43 /**
44 * @constructor 44 * @constructor
45 * @extends {WebInspector.CounterUIBase} 45 * @extends {WebInspector.CounterUIBase}
46 * @param {!WebInspector.CountersGraph} memoryCountersPane 46 * @param {!WebInspector.CountersGraph} memoryCountersPane
47 * @param {string} title 47 * @param {string} title
48 * @param {string} currentValueLabel 48 * @param {string} currentValueLabel
49 * @param {!string} color 49 * @param {!string} color
50 * @param {!WebInspector.MemoryStatistics.Counter} counter 50 * @param {!WebInspector.MemoryStatistics.Counter} counter
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 * @param {string} protocolName 110 * @param {string} protocolName
111 */ 111 */
112 _createCounter: function(uiName, uiValueTemplate, color, protocolName) 112 _createCounter: function(uiName, uiValueTemplate, color, protocolName)
113 { 113 {
114 var counter = new WebInspector.MemoryStatistics.Counter(protocolName); 114 var counter = new WebInspector.MemoryStatistics.Counter(protocolName);
115 this._counters.push(counter); 115 this._counters.push(counter);
116 this._counterUI.push(new WebInspector.CounterUI(this, uiName, uiValueTem plate, color, counter)); 116 this._counterUI.push(new WebInspector.CounterUI(this, uiName, uiValueTem plate, color, counter));
117 }, 117 },
118 118
119 /** 119 /**
120 * @param {!TimelineAgent.TimelineEvent} record 120 * @param {!WebInspector.TimelineModel.Record} record
121 * @param {!Array.<!WebInspector.TimelinePresentationModel.Record>} presenta tionRecords
122 */ 121 */
123 addRecord: function(record, presentationRecords) 122 addRecord: function(record)
124 { 123 {
125 /** 124 /**
125 * @param {!WebInspector.TimelineModel.Record} record
126 * @this {!WebInspector.CountersGraph} 126 * @this {!WebInspector.CountersGraph}
127 */ 127 */
128 function addStatistics(record) 128 function addStatistics(record)
129 { 129 {
130 var counters = record.counters; 130 var counters = record.counters;
131 if (!counters) 131 if (!counters)
132 return; 132 return;
133 var time = record.endTime || record.startTime; 133 var time = record.endTime || record.startTime;
134 for (var i = 0; i < this._counters.length; ++i) 134 for (var i = 0; i < this._counters.length; ++i)
135 this._counters[i].appendSample(time, counters); 135 this._counters[i].appendSample(time, counters);
136 } 136 }
137 WebInspector.TimelinePresentationModel.forAllRecords([record], null, add Statistics.bind(this)); 137 WebInspector.TimelineModel.forAllRecords([record], null, addStatistics.b ind(this));
138 this.scheduleRefresh(); 138 this.scheduleRefresh();
139 }, 139 },
140 140
141 draw: function() 141 draw: function()
142 { 142 {
143 WebInspector.MemoryStatistics.prototype.draw.call(this); 143 WebInspector.MemoryStatistics.prototype.draw.call(this);
144 for (var i = 0; i < this._counterUI.length; i++) 144 for (var i = 0; i < this._counterUI.length; i++)
145 this._drawGraph(this._counterUI[i]); 145 this._drawGraph(this._counterUI[i]);
146 }, 146 },
147 147
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 ctx.lineWidth = 1; 204 ctx.lineWidth = 1;
205 ctx.strokeStyle = counterUI.graphColor; 205 ctx.strokeStyle = counterUI.graphColor;
206 ctx.stroke(); 206 ctx.stroke();
207 ctx.closePath(); 207 ctx.closePath();
208 ctx.restore(); 208 ctx.restore();
209 }, 209 },
210 210
211 __proto__: WebInspector.MemoryStatistics.prototype 211 __proto__: WebInspector.MemoryStatistics.prototype
212 } 212 }
213 213
OLDNEW
« no previous file with comments | « LayoutTests/inspector/timeline/timeline-timer.html ('k') | Source/devtools/front_end/MemoryStatistics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698