| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 * @param {!WebInspector.NetworkLogView} networkLogView | 8 * @param {!WebInspector.NetworkLogView} networkLogView |
| 9 * @param {!WebInspector.SortableDataGrid} dataGrid | 9 * @param {!WebInspector.SortableDataGrid} dataGrid |
| 10 */ | 10 */ |
| 11 WebInspector.NetworkTimelineColumn = function(networkLogView, dataGrid) | 11 WebInspector.NetworkTimelineColumn = function(networkLogView, dataGrid) |
| 12 { | 12 { |
| 13 WebInspector.VBox.call(this, true); | 13 WebInspector.VBox.call(this, true); |
| 14 this._canvas = this.contentElement.createChild("canvas"); | 14 this._canvas = this.contentElement.createChild("canvas"); |
| 15 this._canvas.tabIndex = 1; | 15 this._canvas.tabIndex = 1; |
| 16 this.setDefaultFocusedElement(this._canvas); | 16 this.setDefaultFocusedElement(this._canvas); |
| 17 | 17 |
| 18 /** @const */ | 18 /** @const */ |
| 19 this._leftPadding = 5; | 19 this._leftPadding = 5; |
| 20 /** @const */ | 20 /** @const */ |
| 21 this._rightPadding = 5; | 21 this._rightPadding = 5; |
| 22 | 22 |
| 23 this._dataGrid = dataGrid; | 23 this._dataGrid = dataGrid; |
| 24 this._networkLogView = networkLogView; | 24 this._networkLogView = networkLogView; |
| 25 |
| 26 this._networkLogView.addEventListener(WebInspector.NetworkLogView.Events.Req
uestsSorted, this._onRefreshData, this); |
| 27 this._networkLogView.addEventListener(WebInspector.NetworkLogView.Events.Dat
aRefreshed, this._onRefreshData, this); |
| 28 |
| 25 /** @type {!Array<!WebInspector.NetworkRequest>} */ | 29 /** @type {!Array<!WebInspector.NetworkRequest>} */ |
| 26 this._requestData = []; | 30 this._requestData = []; |
| 31 this._onRefreshData(); |
| 27 } | 32 } |
| 28 | 33 |
| 29 WebInspector.NetworkTimelineColumn.prototype = { | 34 WebInspector.NetworkTimelineColumn.prototype = { |
| 35 _onRefreshData: function() |
| 36 { |
| 37 var currentNode = this._dataGrid.rootNode(); |
| 38 this._requestData = []; |
| 39 while (currentNode = currentNode.traverseNextNode(true)) |
| 40 this._requestData.push(currentNode.request()); |
| 41 |
| 42 this.scheduleUpdate(); |
| 43 }, |
| 44 |
| 30 scheduleUpdate: function() | 45 scheduleUpdate: function() |
| 31 { | 46 { |
| 32 if (this._updateRequestID) | 47 if (this._updateRequestID) |
| 33 return; | 48 return; |
| 34 this._updateRequestID = this.element.window().requestAnimationFrame(this
._update.bind(this)); | 49 this._updateRequestID = this.element.window().requestAnimationFrame(this
._update.bind(this)); |
| 35 }, | 50 }, |
| 36 | 51 |
| 37 _update: function() | 52 _update: function() |
| 38 { | 53 { |
| 39 this.element.window().cancelAnimationFrame(this._updateRequestID); | 54 this.element.window().cancelAnimationFrame(this._updateRequestID); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 context.lineWidth = lineWidth; | 218 context.lineWidth = lineWidth; |
| 204 context.strokeStyle = borderColor; | 219 context.strokeStyle = borderColor; |
| 205 context.stroke(); | 220 context.stroke(); |
| 206 } | 221 } |
| 207 context.fill(); | 222 context.fill(); |
| 208 context.restore(); | 223 context.restore(); |
| 209 }, | 224 }, |
| 210 | 225 |
| 211 __proto__: WebInspector.VBox.prototype | 226 __proto__: WebInspector.VBox.prototype |
| 212 } | 227 } |
| OLD | NEW |