OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // Populate sidebar | 64 // Populate sidebar |
65 this.sidebarElement().createChild("div", "sidebar-tree sidebar-tree-section"
).textContent = WebInspector.UIString("COUNTERS"); | 65 this.sidebarElement().createChild("div", "sidebar-tree sidebar-tree-section"
).textContent = WebInspector.UIString("COUNTERS"); |
66 this.createAllCounters(); | 66 this.createAllCounters(); |
67 } | 67 } |
68 | 68 |
69 /** | 69 /** |
70 * @constructor | 70 * @constructor |
71 * @param {string} counterName | 71 * @param {string} counterName |
72 */ | 72 */ |
73 WebInspector.MemoryStatistics.Counter = function(counterName) | 73 WebInspector.Counter = function(counterName) |
74 { | 74 { |
75 this.counterName = counterName; | 75 this.counterName = counterName; |
76 this.times = []; | 76 this.times = []; |
77 this.values = []; | 77 this.values = []; |
78 } | 78 } |
79 | 79 |
80 WebInspector.MemoryStatistics.Counter.prototype = { | 80 WebInspector.Counter.prototype = { |
81 /** | 81 /** |
82 * @param {number} time | 82 * @param {number} time |
83 * @param {!TimelineAgent.Counters} counters | 83 * @param {!TimelineAgent.Counters} counters |
84 */ | 84 */ |
85 appendSample: function(time, counters) | 85 appendSample: function(time, counters) |
86 { | 86 { |
87 var value = counters[this.counterName]; | 87 var value = counters[this.counterName]; |
88 if (value === undefined) | 88 if (value === undefined) |
89 return; | 89 return; |
90 if (this.values.length && this.values.peekLast() === value) | 90 if (this.values.length && this.values.peekLast() === value) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 { | 174 { |
175 this.checked = !this.checked; | 175 this.checked = !this.checked; |
176 this.dispatchEventToListeners(WebInspector.SwatchCheckbox.Events.Changed
); | 176 this.dispatchEventToListeners(WebInspector.SwatchCheckbox.Events.Changed
); |
177 }, | 177 }, |
178 | 178 |
179 __proto__: WebInspector.Object.prototype | 179 __proto__: WebInspector.Object.prototype |
180 } | 180 } |
181 | 181 |
182 /** | 182 /** |
183 * @constructor | 183 * @constructor |
184 * @param {!WebInspector.MemoryStatistics} memoryCountersPane | |
185 * @param {string} title | |
186 * @param {string} graphColor | 184 * @param {string} graphColor |
187 * @param {!WebInspector.MemoryStatistics.Counter} counter | 185 * @param {!WebInspector.Counter} counter |
188 */ | 186 */ |
189 WebInspector.CounterUIBase = function(memoryCountersPane, title, graphColor, cou
nter) | 187 WebInspector.CounterUIBase = function(graphColor, counter) |
190 { | 188 { |
191 this._memoryCountersPane = memoryCountersPane; | |
192 this.counter = counter; | 189 this.counter = counter; |
193 var container = memoryCountersPane.sidebarElement().createChild("div", "memo
ry-counter-sidebar-info"); | |
194 var swatchColor = graphColor; | |
195 this._swatch = new WebInspector.SwatchCheckbox(WebInspector.UIString(title),
swatchColor); | |
196 this._swatch.addEventListener(WebInspector.SwatchCheckbox.Events.Changed, th
is._toggleCounterGraph.bind(this)); | |
197 container.appendChild(this._swatch.element); | |
198 | |
199 this._value = null; | |
200 this.graphColor = graphColor; | 190 this.graphColor = graphColor; |
201 this.strokeColor = graphColor; | 191 this.strokeColor = graphColor; |
202 this.graphYValues = []; | 192 this.graphYValues = []; |
203 } | 193 this._value = null; |
| 194 this._marker = null; |
| 195 }, |
204 | 196 |
205 WebInspector.CounterUIBase.prototype = { | 197 WebInspector.CounterUIBase.prototype = { |
206 _toggleCounterGraph: function(event) | |
207 { | |
208 this._value.classList.toggle("hidden", !this._swatch.checked); | |
209 this._memoryCountersPane.refresh(); | |
210 }, | |
211 | |
212 /** | 198 /** |
213 * @param {number} x | 199 * @param {number} x |
214 * @return {number} | 200 * @return {number} |
215 */ | 201 */ |
216 _recordIndexAt: function(x) | 202 _recordIndexAt: function(x) |
217 { | 203 { |
218 return this.counter.x.upperBound(x, null, this.counter._minimumIndex + 1
, this.counter._maximumIndex + 1) - 1; | 204 return this.counter.x.upperBound(x, null, this.counter._minimumIndex + 1
, this.counter._maximumIndex + 1) - 1; |
219 }, | 205 }, |
220 | 206 |
221 /** | 207 /** |
(...skipping 10 matching lines...) Expand all Loading... |
232 this._marker.style.top = y + "px"; | 218 this._marker.style.top = y + "px"; |
233 this._marker.classList.remove("hidden"); | 219 this._marker.classList.remove("hidden"); |
234 }, | 220 }, |
235 | 221 |
236 clearCurrentValueAndMarker: function() | 222 clearCurrentValueAndMarker: function() |
237 { | 223 { |
238 this._value.textContent = ""; | 224 this._value.textContent = ""; |
239 this._marker.classList.add("hidden"); | 225 this._marker.classList.add("hidden"); |
240 }, | 226 }, |
241 | 227 |
| 228 get visible() { |
| 229 return true; |
| 230 }, |
| 231 } |
| 232 |
| 233 /** |
| 234 * @constructor |
| 235 * @param {!WebInspector.MemoryStatistics} memoryCountersPane |
| 236 * @param {string} title |
| 237 * @param {string} graphColor |
| 238 * @param {!WebInspector.Counter} counter |
| 239 */ |
| 240 WebInspector.MemoryCounterUIBase = function(memoryCountersPane, title, graphColo
r, counter) |
| 241 { |
| 242 WebInspector.CounterUIBase.call(this, graphColor, counter); |
| 243 this._memoryCountersPane = memoryCountersPane; |
| 244 var container = memoryCountersPane.sidebarElement().createChild("div", "memo
ry-counter-sidebar-info"); |
| 245 var swatchColor = graphColor; |
| 246 this._swatch = new WebInspector.SwatchCheckbox(WebInspector.UIString(title),
swatchColor); |
| 247 this._swatch.addEventListener(WebInspector.SwatchCheckbox.Events.Changed, th
is._toggleCounterGraph.bind(this)); |
| 248 container.appendChild(this._swatch.element); |
| 249 } |
| 250 |
| 251 WebInspector.MemoryCounterUIBase.prototype = { |
| 252 _toggleCounterGraph: function(event) |
| 253 { |
| 254 this._value.classList.toggle("hidden", !this._swatch.checked); |
| 255 this._memoryCountersPane.refresh(); |
| 256 }, |
| 257 |
242 get visible() | 258 get visible() |
243 { | 259 { |
244 return this._swatch.checked; | 260 return this._swatch.checked; |
245 }, | 261 }, |
| 262 |
| 263 __proto__: WebInspector.CounterUIBase.prototype |
246 } | 264 } |
247 | 265 |
248 WebInspector.MemoryStatistics.prototype = { | 266 WebInspector.MemoryStatistics.prototype = { |
249 _createCurrentValuesBar: function() | 267 _createCurrentValuesBar: function() |
250 { | 268 { |
251 throw new Error("Not implemented"); | 269 throw new Error("Not implemented"); |
252 }, | 270 }, |
253 | 271 |
254 createAllCounters: function() | 272 createAllCounters: function() |
255 { | 273 { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 450 |
433 /** | 451 /** |
434 * @param {?WebInspector.TimelineModel.Record} record | 452 * @param {?WebInspector.TimelineModel.Record} record |
435 */ | 453 */ |
436 setSelectedRecord: function(record) | 454 setSelectedRecord: function(record) |
437 { | 455 { |
438 }, | 456 }, |
439 | 457 |
440 __proto__: WebInspector.SplitView.prototype | 458 __proto__: WebInspector.SplitView.prototype |
441 } | 459 } |
OLD | NEW |