| 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 |
| 35 */ | 36 */ |
| 36 WebInspector.TimelineOverviewPane = function(model) | 37 WebInspector.TimelineOverviewPane = function(model, uiUtils) |
| 37 { | 38 { |
| 38 WebInspector.VBox.call(this); | 39 WebInspector.VBox.call(this); |
| 40 this._uiUtils = uiUtils; |
| 39 this.element.id = "timeline-overview-pane"; | 41 this.element.id = "timeline-overview-pane"; |
| 40 | 42 |
| 41 this._eventDividers = []; | 43 this._eventDividers = []; |
| 42 | 44 |
| 43 this._model = model; | 45 this._model = model; |
| 44 | 46 |
| 45 this._overviewGrid = new WebInspector.OverviewGrid("timeline"); | 47 this._overviewGrid = new WebInspector.OverviewGrid("timeline"); |
| 46 this.element.appendChild(this._overviewGrid.element); | 48 this.element.appendChild(this._overviewGrid.element); |
| 47 | 49 |
| 48 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator(); | 50 this._overviewCalculator = new WebInspector.TimelineOverviewCalculator(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 { | 105 { |
| 104 var records = this._eventDividers; | 106 var records = this._eventDividers; |
| 105 this._overviewGrid.removeEventDividers(); | 107 this._overviewGrid.removeEventDividers(); |
| 106 var dividers = []; | 108 var dividers = []; |
| 107 for (var i = 0; i < records.length; ++i) { | 109 for (var i = 0; i < records.length; ++i) { |
| 108 var record = records[i]; | 110 var record = records[i]; |
| 109 var positions = this._overviewCalculator.computeBarGraphPercentages(
record); | 111 var positions = this._overviewCalculator.computeBarGraphPercentages(
record); |
| 110 var dividerPosition = Math.round(positions.start * 10); | 112 var dividerPosition = Math.round(positions.start * 10); |
| 111 if (dividers[dividerPosition]) | 113 if (dividers[dividerPosition]) |
| 112 continue; | 114 continue; |
| 113 var divider = WebInspector.TimelineUIUtils.createEventDivider(record
.type()); | 115 var divider = this._uiUtils.createEventDivider(record.type()); |
| 114 divider.style.left = positions.start + "%"; | 116 divider.style.left = positions.start + "%"; |
| 115 dividers[dividerPosition] = divider; | 117 dividers[dividerPosition] = divider; |
| 116 } | 118 } |
| 117 this._overviewGrid.addEventDividers(dividers); | 119 this._overviewGrid.addEventDividers(dividers); |
| 118 }, | 120 }, |
| 119 | 121 |
| 120 /** | 122 /** |
| 121 * @param {!WebInspector.TimelineModel.Record} record | 123 * @param {!WebInspector.TimelineModel.Record} record |
| 122 */ | 124 */ |
| 123 addRecord: function(record) | 125 addRecord: function(record) |
| 124 { | 126 { |
| 125 var eventDividers = this._eventDividers; | 127 var eventDividers = this._eventDividers; |
| 128 var uiUtils = this._uiUtils; |
| 126 function addEventDividers(record) | 129 function addEventDividers(record) |
| 127 { | 130 { |
| 128 if (WebInspector.TimelineUIUtils.isEventDivider(record)) | 131 if (uiUtils.isEventDivider(record)) |
| 129 eventDividers.push(record); | 132 eventDividers.push(record); |
| 130 } | 133 } |
| 131 WebInspector.TimelineModel.forAllRecords([record], addEventDividers); | 134 WebInspector.TimelineModel.forAllRecords([record], addEventDividers); |
| 132 this._scheduleRefresh(); | 135 this._scheduleRefresh(); |
| 133 }, | 136 }, |
| 134 | 137 |
| 135 _reset: function() | 138 _reset: function() |
| 136 { | 139 { |
| 137 this._overviewCalculator.reset(); | 140 this._overviewCalculator.reset(); |
| 138 this._overviewGrid.reset(); | 141 this._overviewGrid.reset(); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 }, | 420 }, |
| 418 | 421 |
| 419 resetCanvas: function() | 422 resetCanvas: function() |
| 420 { | 423 { |
| 421 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; | 424 this._canvas.width = this.element.clientWidth * window.devicePixelRatio; |
| 422 this._canvas.height = this.element.clientHeight * window.devicePixelRati
o; | 425 this._canvas.height = this.element.clientHeight * window.devicePixelRati
o; |
| 423 }, | 426 }, |
| 424 | 427 |
| 425 __proto__: WebInspector.VBox.prototype | 428 __proto__: WebInspector.VBox.prototype |
| 426 } | 429 } |
| OLD | NEW |