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 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
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.SplitView} | 33 * @extends {WebInspector.SplitWidget} |
34 * @implements {WebInspector.TimelineModeView} | 34 * @implements {WebInspector.TimelineModeView} |
35 * @param {string} title | 35 * @param {string} title |
36 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 36 * @param {!WebInspector.TimelineModeViewDelegate} delegate |
37 * @param {!WebInspector.TimelineModel} model | 37 * @param {!WebInspector.TimelineModel} model |
38 */ | 38 */ |
39 WebInspector.CountersGraph = function(title, delegate, model) | 39 WebInspector.CountersGraph = function(title, delegate, model) |
40 { | 40 { |
41 WebInspector.SplitView.call(this, true, false); | 41 WebInspector.SplitWidget.call(this, true, false); |
42 | 42 |
43 this.element.id = "memory-graphs-container"; | 43 this.element.id = "memory-graphs-container"; |
44 | 44 |
45 this._delegate = delegate; | 45 this._delegate = delegate; |
46 this._model = model; | 46 this._model = model; |
47 this._calculator = new WebInspector.TimelineCalculator(this._model); | 47 this._calculator = new WebInspector.TimelineCalculator(this._model); |
48 | 48 |
49 this._graphsContainer = new WebInspector.VBox(); | 49 this._graphsContainer = new WebInspector.VBox(); |
50 this.setMainView(this._graphsContainer); | 50 this.setMainWidget(this._graphsContainer); |
51 this._createCurrentValuesBar(); | 51 this._createCurrentValuesBar(); |
52 this._canvasView = new WebInspector.VBoxWithResizeCallback(this._resize.bind
(this)); | 52 var canvasWidget = new WebInspector.VBoxWithResizeCallback(this._resize.bind
(this)); |
53 this._canvasView.show(this._graphsContainer.element); | 53 canvasWidget.show(this._graphsContainer.element); |
54 this._canvasContainer = this._canvasView.element; | 54 this._canvasContainer = canvasWidget.element; |
55 this._canvasContainer.id = "memory-graphs-canvas-container"; | 55 this._canvasContainer.id = "memory-graphs-canvas-container"; |
56 this._canvas = this._canvasContainer.createChild("canvas"); | 56 this._canvas = this._canvasContainer.createChild("canvas"); |
57 this._canvas.id = "memory-counters-graph"; | 57 this._canvas.id = "memory-counters-graph"; |
58 | 58 |
59 this._canvasContainer.addEventListener("mouseover", this._onMouseMove.bind(t
his), true); | 59 this._canvasContainer.addEventListener("mouseover", this._onMouseMove.bind(t
his), true); |
60 this._canvasContainer.addEventListener("mousemove", this._onMouseMove.bind(t
his), true); | 60 this._canvasContainer.addEventListener("mousemove", this._onMouseMove.bind(t
his), true); |
61 this._canvasContainer.addEventListener("mouseleave", this._onMouseLeave.bind
(this), true); | 61 this._canvasContainer.addEventListener("mouseleave", this._onMouseLeave.bind
(this), true); |
62 this._canvasContainer.addEventListener("click", this._onClick.bind(this), tr
ue); | 62 this._canvasContainer.addEventListener("click", this._onClick.bind(this), tr
ue); |
63 // We create extra timeline grid here to reuse its event dividers. | 63 // We create extra timeline grid here to reuse its event dividers. |
64 this._timelineGrid = new WebInspector.TimelineGrid(); | 64 this._timelineGrid = new WebInspector.TimelineGrid(); |
65 this._canvasContainer.appendChild(this._timelineGrid.dividersElement); | 65 this._canvasContainer.appendChild(this._timelineGrid.dividersElement); |
66 | 66 |
67 // Populate sidebar | 67 // Populate sidebar |
68 this._infoView = new WebInspector.VBox(); | 68 this._infoWidget = new WebInspector.VBox(); |
69 this._infoView.element.classList.add("sidebar-tree"); | 69 this._infoWidget.element.classList.add("sidebar-tree"); |
70 this._infoView.element.createChild("div", "sidebar-tree-section").textConten
t = title; | 70 this._infoWidget.element.createChild("div", "sidebar-tree-section").textCont
ent = title; |
71 this.setSidebarView(this._infoView); | 71 this.setSidebarWidget(this._infoWidget); |
72 this._counters = []; | 72 this._counters = []; |
73 this._counterUI = []; | 73 this._counterUI = []; |
74 } | 74 } |
75 | 75 |
76 WebInspector.CountersGraph.prototype = { | 76 WebInspector.CountersGraph.prototype = { |
77 /** | 77 /** |
78 * @return {?WebInspector.Target} | 78 * @return {?WebInspector.Target} |
79 */ | 79 */ |
80 target: function() | 80 target: function() |
81 { | 81 { |
(...skipping 15 matching lines...) Expand all Loading... |
97 createCounter: function(uiName, uiValueTemplate, color) | 97 createCounter: function(uiName, uiValueTemplate, color) |
98 { | 98 { |
99 var counter = new WebInspector.CountersGraph.Counter(); | 99 var counter = new WebInspector.CountersGraph.Counter(); |
100 this._counters.push(counter); | 100 this._counters.push(counter); |
101 this._counterUI.push(new WebInspector.CountersGraph.CounterUI(this, uiNa
me, uiValueTemplate, color, counter)); | 101 this._counterUI.push(new WebInspector.CountersGraph.CounterUI(this, uiNa
me, uiValueTemplate, color, counter)); |
102 return counter; | 102 return counter; |
103 }, | 103 }, |
104 | 104 |
105 /** | 105 /** |
106 * @override | 106 * @override |
107 * @return {!WebInspector.View} | 107 * @return {!WebInspector.Widget} |
108 */ | 108 */ |
109 view: function() | 109 view: function() |
110 { | 110 { |
111 return this; | 111 return this; |
112 }, | 112 }, |
113 | 113 |
114 /** | 114 /** |
115 * @override | 115 * @override |
116 */ | 116 */ |
117 dispose: function() | 117 dispose: function() |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 }, | 284 }, |
285 | 285 |
286 /** | 286 /** |
287 * @override | 287 * @override |
288 * @param {?WebInspector.TimelineSelection} selection | 288 * @param {?WebInspector.TimelineSelection} selection |
289 */ | 289 */ |
290 setSelection: function(selection) | 290 setSelection: function(selection) |
291 { | 291 { |
292 }, | 292 }, |
293 | 293 |
294 __proto__: WebInspector.SplitView.prototype | 294 __proto__: WebInspector.SplitWidget.prototype |
295 } | 295 } |
296 | 296 |
297 /** | 297 /** |
298 * @constructor | 298 * @constructor |
299 */ | 299 */ |
300 WebInspector.CountersGraph.Counter = function() | 300 WebInspector.CountersGraph.Counter = function() |
301 { | 301 { |
302 this.times = []; | 302 this.times = []; |
303 this.values = []; | 303 this.values = []; |
304 } | 304 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 * @param {!WebInspector.CountersGraph} memoryCountersPane | 394 * @param {!WebInspector.CountersGraph} memoryCountersPane |
395 * @param {string} title | 395 * @param {string} title |
396 * @param {string} currentValueLabel | 396 * @param {string} currentValueLabel |
397 * @param {string} graphColor | 397 * @param {string} graphColor |
398 * @param {!WebInspector.CountersGraph.Counter} counter | 398 * @param {!WebInspector.CountersGraph.Counter} counter |
399 */ | 399 */ |
400 WebInspector.CountersGraph.CounterUI = function(memoryCountersPane, title, curre
ntValueLabel, graphColor, counter) | 400 WebInspector.CountersGraph.CounterUI = function(memoryCountersPane, title, curre
ntValueLabel, graphColor, counter) |
401 { | 401 { |
402 this._memoryCountersPane = memoryCountersPane; | 402 this._memoryCountersPane = memoryCountersPane; |
403 this.counter = counter; | 403 this.counter = counter; |
404 var container = memoryCountersPane._infoView.element.createChild("div", "mem
ory-counter-sidebar-info"); | 404 var container = memoryCountersPane._infoWidget.element.createChild("div", "m
emory-counter-sidebar-info"); |
405 var swatchColor = graphColor; | 405 var swatchColor = graphColor; |
406 this._swatch = new WebInspector.SwatchCheckbox(WebInspector.UIString(title),
swatchColor); | 406 this._swatch = new WebInspector.SwatchCheckbox(WebInspector.UIString(title),
swatchColor); |
407 this._swatch.addEventListener(WebInspector.SwatchCheckbox.Events.Changed, th
is._toggleCounterGraph.bind(this)); | 407 this._swatch.addEventListener(WebInspector.SwatchCheckbox.Events.Changed, th
is._toggleCounterGraph.bind(this)); |
408 container.appendChild(this._swatch.element); | 408 container.appendChild(this._swatch.element); |
409 this._range = this._swatch.element.createChild("span"); | 409 this._range = this._swatch.element.createChild("span"); |
410 | 410 |
411 this._value = memoryCountersPane._currentValuesBar.createChild("span", "memo
ry-counter-value"); | 411 this._value = memoryCountersPane._currentValuesBar.createChild("span", "memo
ry-counter-value"); |
412 this._value.style.color = graphColor; | 412 this._value.style.color = graphColor; |
413 this.graphColor = graphColor; | 413 this.graphColor = graphColor; |
414 this.limitColor = WebInspector.Color.parse(graphColor).setAlpha(0.3).asStrin
g(WebInspector.Color.Format.RGBA); | 414 this.limitColor = WebInspector.Color.parse(graphColor).setAlpha(0.3).asStrin
g(WebInspector.Color.Format.RGBA); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 }, | 581 }, |
582 | 582 |
583 _toggleCheckbox: function(event) | 583 _toggleCheckbox: function(event) |
584 { | 584 { |
585 this.checked = !this.checked; | 585 this.checked = !this.checked; |
586 this.dispatchEventToListeners(WebInspector.SwatchCheckbox.Events.Changed
); | 586 this.dispatchEventToListeners(WebInspector.SwatchCheckbox.Events.Changed
); |
587 }, | 587 }, |
588 | 588 |
589 __proto__: WebInspector.Object.prototype | 589 __proto__: WebInspector.Object.prototype |
590 } | 590 } |
OLD | NEW |