Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkTimelineColumn.js

Issue 2411533002: [Devtools] Added data to networking timeline canvas experiment (Closed)
Patch Set: changes Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** @type {!Array<!WebInspector.NetworkRequest>} */ 25 /** @type {!Array<!WebInspector.NetworkRequest>} */
26 this._requestData = []; 26 this._requestData = [];
27 } 27 }
28 28
29 WebInspector.NetworkTimelineColumn.prototype = { 29 WebInspector.NetworkTimelineColumn.prototype = {
30 wasShown: function()
31 {
32 this.scheduleUpdate();
33 },
34
35 scheduleRefreshData: function()
36 {
37 this._needsRefreshData = true;
38 },
39
40 _refreshDataIfNeeded: function()
41 {
42 if (!this._needsRefreshData)
43 return;
44 this._needsRefreshData = false;
45 var currentNode = this._dataGrid.rootNode();
46 this._requestData = [];
47 while (currentNode = currentNode.traverseNextNode(true))
48 this._requestData.push(currentNode.request());
49 this._update();
50 },
51
30 scheduleUpdate: function() 52 scheduleUpdate: function()
31 { 53 {
32 if (this._updateRequestID) 54 if (this._updateRequestID)
33 return; 55 return;
34 this._updateRequestID = this.element.window().requestAnimationFrame(this ._update.bind(this)); 56 this._updateRequestID = this.element.window().requestAnimationFrame(this ._update.bind(this));
35 }, 57 },
36 58
37 _update: function() 59 _update: function()
38 { 60 {
39 this.element.window().cancelAnimationFrame(this._updateRequestID); 61 this.element.window().cancelAnimationFrame(this._updateRequestID);
40 this._updateRequestID = null; 62 this._updateRequestID = null;
41 63
64 this._refreshDataIfNeeded();
65
42 this._startTime = this._networkLogView.calculator().minimumBoundary(); 66 this._startTime = this._networkLogView.calculator().minimumBoundary();
43 this._endTime = this._networkLogView.calculator().maximumBoundary(); 67 this._endTime = this._networkLogView.calculator().maximumBoundary();
44 this._resetCanvas(); 68 this._resetCanvas();
45 this._draw(); 69 this._draw();
46 }, 70 },
47 71
48 _resetCanvas: function() 72 _resetCanvas: function()
49 { 73 {
50 var ratio = window.devicePixelRatio; 74 var ratio = window.devicePixelRatio;
51 this._canvas.width = this._offsetWidth * ratio; 75 this._canvas.width = this._offsetWidth * ratio;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 context.lineWidth = lineWidth; 227 context.lineWidth = lineWidth;
204 context.strokeStyle = borderColor; 228 context.strokeStyle = borderColor;
205 context.stroke(); 229 context.stroke();
206 } 230 }
207 context.fill(); 231 context.fill();
208 context.restore(); 232 context.restore();
209 }, 233 },
210 234
211 __proto__: WebInspector.VBox.prototype 235 __proto__: WebInspector.VBox.prototype
212 } 236 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698