| OLD | NEW |
| 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 14 matching lines...) Expand all Loading... |
| 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.VBox} | 33 * @extends {WebInspector.VBox} |
| 34 * @param {!WebInspector.TimelineModel} model | 34 * @param {!WebInspector.TimelineModel} model |
| 35 * @param {!WebInspector.TimelineUIUtils} uiUtils | |
| 36 */ | 35 */ |
| 37 WebInspector.TimelineOverviewPane = function(model, uiUtils) | 36 WebInspector.TimelineOverviewPane = function(model) |
| 38 { | 37 { |
| 39 WebInspector.VBox.call(this); | 38 WebInspector.VBox.call(this); |
| 40 this._uiUtils = uiUtils; | |
| 41 this.element.id = "timeline-overview-pane"; | 39 this.element.id = "timeline-overview-pane"; |
| 42 | 40 |
| 43 this._model = model; | 41 this._model = model; |
| 44 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator(); | 42 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator(); |
| 45 | 43 |
| 46 this._overviewGrid = new WebInspector.OverviewGrid("timeline"); | 44 this._overviewGrid = new WebInspector.OverviewGrid("timeline"); |
| 47 this.element.appendChild(this._overviewGrid.element); | 45 this.element.appendChild(this._overviewGrid.element); |
| 48 | 46 |
| 49 model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared, thi
s._reset, this); | 47 model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleared, thi
s._reset, this); |
| 50 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowC
hanged, this._onWindowChanged, this); | 48 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowC
hanged, this._onWindowChanged, this); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 { | 105 { |
| 108 var records = this._model.eventDividerRecords(); | 106 var records = this._model.eventDividerRecords(); |
| 109 this._overviewGrid.removeEventDividers(); | 107 this._overviewGrid.removeEventDividers(); |
| 110 var dividers = []; | 108 var dividers = []; |
| 111 for (var i = 0; i < records.length; ++i) { | 109 for (var i = 0; i < records.length; ++i) { |
| 112 var record = records[i]; | 110 var record = records[i]; |
| 113 var positions = this._overviewCalculator.computeBarGraphPercentages(
record); | 111 var positions = this._overviewCalculator.computeBarGraphPercentages(
record); |
| 114 var dividerPosition = Math.round(positions.start * 10); | 112 var dividerPosition = Math.round(positions.start * 10); |
| 115 if (dividers[dividerPosition]) | 113 if (dividers[dividerPosition]) |
| 116 continue; | 114 continue; |
| 117 var title = this._uiUtils.titleForRecord(record); | 115 var title = WebInspector.TimelineUIUtils.titleForRecord(record); |
| 118 var divider = this._uiUtils.createEventDivider(record.type(), title)
; | 116 var divider = WebInspector.TimelineUIUtils.createEventDivider(record
.type(), title); |
| 119 divider.style.left = positions.start + "%"; | 117 divider.style.left = positions.start + "%"; |
| 120 dividers[dividerPosition] = divider; | 118 dividers[dividerPosition] = divider; |
| 121 } | 119 } |
| 122 this._overviewGrid.addEventDividers(dividers); | 120 this._overviewGrid.addEventDividers(dividers); |
| 123 }, | 121 }, |
| 124 | 122 |
| 125 _reset: function() | 123 _reset: function() |
| 126 { | 124 { |
| 127 this._overviewCalculator.reset(); | 125 this._overviewCalculator.reset(); |
| 128 this._overviewGrid.reset(); | 126 this._overviewGrid.reset(); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 }, | 395 }, |
| 398 | 396 |
| 399 resetCanvas: function() | 397 resetCanvas: function() |
| 400 { | 398 { |
| 401 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; | 399 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; |
| 402 this._canvas.height = this.element.clientHeight * window.devicePixelRati
o; | 400 this._canvas.height = this.element.clientHeight * window.devicePixelRati
o; |
| 403 }, | 401 }, |
| 404 | 402 |
| 405 __proto__: WebInspector.VBox.prototype | 403 __proto__: WebInspector.VBox.prototype |
| 406 } | 404 } |
| OLD | NEW |