| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Network.NetworkOverview = class extends UI.TimelineOverviewBase { | 7 Network.NetworkOverview = class extends UI.TimelineOverviewBase { |
| 8 constructor() { | 8 constructor() { |
| 9 super(); | 9 super(); |
| 10 this.element.classList.add('network-overview'); | 10 this.element.classList.add('network-overview'); |
| 11 | 11 |
| 12 /** @type {number} */ | 12 /** @type {number} */ |
| 13 this._numBands = 1; | 13 this._numBands = 1; |
| 14 /** @type {number} */ | |
| 15 this._windowStart = 0; | |
| 16 /** @type {number} */ | |
| 17 this._windowEnd = 0; | |
| 18 /** @type {boolean} */ | |
| 19 this._restoringWindow = false; | |
| 20 /** @type {boolean} */ | 14 /** @type {boolean} */ |
| 21 this._updateScheduled = false; | 15 this._updateScheduled = false; |
| 22 | 16 |
| 23 SDK.targetManager.addModelListener( | 17 SDK.targetManager.addModelListener( |
| 24 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.Load, this._loadEven
tFired, this); | 18 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.Load, this._loadEven
tFired, this); |
| 25 SDK.targetManager.addModelListener( | 19 SDK.targetManager.addModelListener( |
| 26 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.DOMContentLoaded, th
is._domContentLoadedEventFired, this); | 20 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.DOMContentLoaded, th
is._domContentLoadedEventFired, this); |
| 27 | 21 |
| 28 this.reset(); | 22 this.reset(); |
| 29 } | 23 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 this.resetCanvas(); | 105 this.resetCanvas(); |
| 112 var numBands = (((height - 1) / Network.NetworkOverview._bandHeight) - 1) |
0; | 106 var numBands = (((height - 1) / Network.NetworkOverview._bandHeight) - 1) |
0; |
| 113 this._numBands = (numBands > 0) ? numBands : 1; | 107 this._numBands = (numBands > 0) ? numBands : 1; |
| 114 this.scheduleUpdate(); | 108 this.scheduleUpdate(); |
| 115 } | 109 } |
| 116 | 110 |
| 117 /** | 111 /** |
| 118 * @override | 112 * @override |
| 119 */ | 113 */ |
| 120 reset() { | 114 reset() { |
| 121 this._windowStart = 0; | |
| 122 this._windowEnd = 0; | |
| 123 /** @type {?Components.FilmStripModel} */ | 115 /** @type {?Components.FilmStripModel} */ |
| 124 this._filmStripModel = null; | 116 this._filmStripModel = null; |
| 125 | 117 |
| 126 /** @type {number} */ | 118 /** @type {number} */ |
| 127 this._span = 1; | 119 this._span = 1; |
| 128 /** @type {?Network.NetworkTimeBoundary} */ | 120 /** @type {?Network.NetworkTimeBoundary} */ |
| 129 this._lastBoundary = null; | 121 this._lastBoundary = null; |
| 130 /** @type {number} */ | 122 /** @type {number} */ |
| 131 this._nextBand = 0; | 123 this._nextBand = 0; |
| 132 /** @type {!Map.<string, number>} */ | 124 /** @type {!Map.<string, number>} */ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 160 update() { | 152 update() { |
| 161 this._updateScheduled = false; | 153 this._updateScheduled = false; |
| 162 | 154 |
| 163 var calculator = this.calculator(); | 155 var calculator = this.calculator(); |
| 164 | 156 |
| 165 var newBoundary = new Network.NetworkTimeBoundary(calculator.minimumBoundary
(), calculator.maximumBoundary()); | 157 var newBoundary = new Network.NetworkTimeBoundary(calculator.minimumBoundary
(), calculator.maximumBoundary()); |
| 166 if (!this._lastBoundary || !newBoundary.equals(this._lastBoundary)) { | 158 if (!this._lastBoundary || !newBoundary.equals(this._lastBoundary)) { |
| 167 var span = calculator.boundarySpan(); | 159 var span = calculator.boundarySpan(); |
| 168 while (this._span < span) | 160 while (this._span < span) |
| 169 this._span *= 1.25; | 161 this._span *= 1.25; |
| 162 |
| 170 calculator.setBounds(calculator.minimumBoundary(), calculator.minimumBound
ary() + this._span); | 163 calculator.setBounds(calculator.minimumBoundary(), calculator.minimumBound
ary() + this._span); |
| 171 this._lastBoundary = new Network.NetworkTimeBoundary(calculator.minimumBou
ndary(), calculator.maximumBoundary()); | 164 this._lastBoundary = new Network.NetworkTimeBoundary(calculator.minimumBou
ndary(), calculator.maximumBoundary()); |
| 172 if (this._windowStart || this._windowEnd) { | |
| 173 this._restoringWindow = true; | |
| 174 var startTime = calculator.minimumBoundary(); | |
| 175 var totalTime = calculator.boundarySpan(); | |
| 176 var left = (this._windowStart - startTime) / totalTime; | |
| 177 var right = (this._windowEnd - startTime) / totalTime; | |
| 178 this._restoringWindow = false; | |
| 179 } | |
| 180 } | 165 } |
| 181 | 166 |
| 182 var context = this.context(); | 167 var context = this.context(); |
| 183 var linesByType = {}; | 168 var linesByType = {}; |
| 184 var paddingTop = 2; | 169 var paddingTop = 2; |
| 185 | 170 |
| 186 /** | 171 /** |
| 187 * @param {string} type | 172 * @param {string} type |
| 188 * @param {string} strokeStyle | 173 * @param {string} strokeStyle |
| 189 */ | 174 */ |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } | 269 } |
| 285 context.restore(); | 270 context.restore(); |
| 286 } | 271 } |
| 287 }; | 272 }; |
| 288 | 273 |
| 289 /** @type {number} */ | 274 /** @type {number} */ |
| 290 Network.NetworkOverview._bandHeight = 3; | 275 Network.NetworkOverview._bandHeight = 3; |
| 291 | 276 |
| 292 /** @typedef {{start: number, end: number}} */ | 277 /** @typedef {{start: number, end: number}} */ |
| 293 Network.NetworkOverview.Window; | 278 Network.NetworkOverview.Window; |
| OLD | NEW |