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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 this._canvasContainer.addEventListener("mouseover", this._onMouseMove.bind(t
his), true); | 65 this._canvasContainer.addEventListener("mouseover", this._onMouseMove.bind(t
his), true); |
66 this._canvasContainer.addEventListener("mousemove", this._onMouseMove.bind(t
his), true); | 66 this._canvasContainer.addEventListener("mousemove", this._onMouseMove.bind(t
his), true); |
67 this._canvasContainer.addEventListener("mouseleave", this._onMouseLeave.bind
(this), true); | 67 this._canvasContainer.addEventListener("mouseleave", this._onMouseLeave.bind
(this), true); |
68 this._canvasContainer.addEventListener("click", this._onClick.bind(this), tr
ue); | 68 this._canvasContainer.addEventListener("click", this._onClick.bind(this), tr
ue); |
69 // We create extra timeline grid here to reuse its event dividers. | 69 // We create extra timeline grid here to reuse its event dividers. |
70 this._timelineGrid = new WebInspector.TimelineGrid(); | 70 this._timelineGrid = new WebInspector.TimelineGrid(); |
71 this._canvasContainer.appendChild(this._timelineGrid.dividersElement); | 71 this._canvasContainer.appendChild(this._timelineGrid.dividersElement); |
72 | 72 |
73 this._counters = []; | 73 this._counters = []; |
74 this._counterUI = []; | 74 this._counterUI = []; |
75 } | 75 }; |
76 | 76 |
77 WebInspector.CountersGraph.prototype = { | 77 WebInspector.CountersGraph.prototype = { |
78 _createCurrentValuesBar: function() | 78 _createCurrentValuesBar: function() |
79 { | 79 { |
80 this._currentValuesBar = this._graphsContainer.element.createChild("div"
); | 80 this._currentValuesBar = this._graphsContainer.element.createChild("div"
); |
81 this._currentValuesBar.id = "counter-values-bar"; | 81 this._currentValuesBar.id = "counter-values-bar"; |
82 }, | 82 }, |
83 | 83 |
84 /** | 84 /** |
85 * @param {string} uiName | 85 * @param {string} uiName |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 /** | 266 /** |
267 * @override | 267 * @override |
268 * @param {?WebInspector.TimelineSelection} selection | 268 * @param {?WebInspector.TimelineSelection} selection |
269 */ | 269 */ |
270 setSelection: function(selection) | 270 setSelection: function(selection) |
271 { | 271 { |
272 }, | 272 }, |
273 | 273 |
274 __proto__: WebInspector.VBox.prototype | 274 __proto__: WebInspector.VBox.prototype |
275 } | 275 }; |
276 | 276 |
277 /** | 277 /** |
278 * @constructor | 278 * @constructor |
279 */ | 279 */ |
280 WebInspector.CountersGraph.Counter = function() | 280 WebInspector.CountersGraph.Counter = function() |
281 { | 281 { |
282 this.times = []; | 282 this.times = []; |
283 this.values = []; | 283 this.values = []; |
284 } | 284 }; |
285 | 285 |
286 WebInspector.CountersGraph.Counter.prototype = { | 286 WebInspector.CountersGraph.Counter.prototype = { |
287 /** | 287 /** |
288 * @param {number} time | 288 * @param {number} time |
289 * @param {number} value | 289 * @param {number} value |
290 */ | 290 */ |
291 appendSample: function(time, value) | 291 appendSample: function(time, value) |
292 { | 292 { |
293 if (this.values.length && this.values.peekLast() === value) | 293 if (this.values.length && this.values.peekLast() === value) |
294 return; | 294 return; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 { | 360 { |
361 if (!this.values.length) | 361 if (!this.values.length) |
362 return; | 362 return; |
363 | 363 |
364 var xFactor = width / (this._maxTime - this._minTime); | 364 var xFactor = width / (this._maxTime - this._minTime); |
365 | 365 |
366 this.x = new Array(this.values.length); | 366 this.x = new Array(this.values.length); |
367 for (var i = this._minimumIndex + 1; i <= this._maximumIndex; i++) | 367 for (var i = this._minimumIndex + 1; i <= this._maximumIndex; i++) |
368 this.x[i] = xFactor * (this.times[i] - this._minTime); | 368 this.x[i] = xFactor * (this.times[i] - this._minTime); |
369 } | 369 } |
370 } | 370 }; |
371 | 371 |
372 /** | 372 /** |
373 * @constructor | 373 * @constructor |
374 * @param {!WebInspector.CountersGraph} memoryCountersPane | 374 * @param {!WebInspector.CountersGraph} memoryCountersPane |
375 * @param {string} title | 375 * @param {string} title |
376 * @param {string} currentValueLabel | 376 * @param {string} currentValueLabel |
377 * @param {string} graphColor | 377 * @param {string} graphColor |
378 * @param {!WebInspector.CountersGraph.Counter} counter | 378 * @param {!WebInspector.CountersGraph.Counter} counter |
379 * @param {(function(number): string)|undefined} formatter | 379 * @param {(function(number): string)|undefined} formatter |
380 */ | 380 */ |
(...skipping 20 matching lines...) Expand all Loading... |
401 this._value.style.color = graphColor; | 401 this._value.style.color = graphColor; |
402 this.graphColor = graphColor; | 402 this.graphColor = graphColor; |
403 this.limitColor = WebInspector.Color.parse(graphColor).setAlpha(0.3).asStrin
g(WebInspector.Color.Format.RGBA); | 403 this.limitColor = WebInspector.Color.parse(graphColor).setAlpha(0.3).asStrin
g(WebInspector.Color.Format.RGBA); |
404 this.graphYValues = []; | 404 this.graphYValues = []; |
405 this._verticalPadding = 10; | 405 this._verticalPadding = 10; |
406 | 406 |
407 this._currentValueLabel = currentValueLabel; | 407 this._currentValueLabel = currentValueLabel; |
408 this._marker = memoryCountersPane._canvasContainer.createChild("div", "memor
y-counter-marker"); | 408 this._marker = memoryCountersPane._canvasContainer.createChild("div", "memor
y-counter-marker"); |
409 this._marker.style.backgroundColor = graphColor; | 409 this._marker.style.backgroundColor = graphColor; |
410 this._clearCurrentValueAndMarker(); | 410 this._clearCurrentValueAndMarker(); |
411 } | 411 }; |
412 | 412 |
413 WebInspector.CountersGraph.CounterUI.prototype = { | 413 WebInspector.CountersGraph.CounterUI.prototype = { |
414 reset: function() | 414 reset: function() |
415 { | 415 { |
416 this._range.textContent = ""; | 416 this._range.textContent = ""; |
417 }, | 417 }, |
418 | 418 |
419 /** | 419 /** |
420 * @param {number} minValue | 420 * @param {number} minValue |
421 * @param {number} maxValue | 421 * @param {number} maxValue |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 ctx.restore(); | 531 ctx.restore(); |
532 }, | 532 }, |
533 | 533 |
534 /** | 534 /** |
535 * @return {boolean} | 535 * @return {boolean} |
536 */ | 536 */ |
537 visible: function() | 537 visible: function() |
538 { | 538 { |
539 return this._filter.checked(); | 539 return this._filter.checked(); |
540 } | 540 } |
541 } | 541 }; |
542 | 542 |
543 /** | 543 /** |
544 * @constructor | 544 * @constructor |
545 * @param {!WebInspector.TimelineModel} model | 545 * @param {!WebInspector.TimelineModel} model |
546 * @implements {WebInspector.TimelineGrid.Calculator} | 546 * @implements {WebInspector.TimelineGrid.Calculator} |
547 */ | 547 */ |
548 WebInspector.CounterGraphCalculator = function(model) | 548 WebInspector.CounterGraphCalculator = function(model) |
549 { | 549 { |
550 this._model = model; | 550 this._model = model; |
551 } | 551 }; |
552 | 552 |
553 WebInspector.CounterGraphCalculator._minWidth = 5; | 553 WebInspector.CounterGraphCalculator._minWidth = 5; |
554 | 554 |
555 WebInspector.CounterGraphCalculator.prototype = { | 555 WebInspector.CounterGraphCalculator.prototype = { |
556 /** | 556 /** |
557 * @override | 557 * @override |
558 * @return {number} | 558 * @return {number} |
559 */ | 559 */ |
560 paddingLeft: function() | 560 paddingLeft: function() |
561 { | 561 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 }, | 627 }, |
628 | 628 |
629 /** | 629 /** |
630 * @override | 630 * @override |
631 * @return {number} | 631 * @return {number} |
632 */ | 632 */ |
633 boundarySpan: function() | 633 boundarySpan: function() |
634 { | 634 { |
635 return this._maximumBoundary - this._minimumBoundary; | 635 return this._maximumBoundary - this._minimumBoundary; |
636 } | 636 } |
637 } | 637 }; |
OLD | NEW |