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

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

Issue 2647803002: [Devtools] Fixed network to sort items as they are received. (Closed)
Patch Set: changes Created 3 years, 11 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/NetworkLogViewColumns.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 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Network.NetworkWaterfallColumn = class extends UI.VBox { 7 Network.NetworkWaterfallColumn = class extends UI.VBox {
8 /** 8 /**
9 * @param {number} rowHeight 9 * @param {number} rowHeight
10 * @param {!Network.NetworkTimeCalculator} calculator 10 * @param {!Network.NetworkTimeCalculator} calculator
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 context.save(); 300 context.save();
301 context.scale(window.devicePixelRatio, window.devicePixelRatio); 301 context.scale(window.devicePixelRatio, window.devicePixelRatio);
302 context.translate(0, this._headerHeight); 302 context.translate(0, this._headerHeight);
303 context.rect(0, 0, this._offsetWidth, this._offsetHeight); 303 context.rect(0, 0, this._offsetWidth, this._offsetHeight);
304 context.clip(); 304 context.clip();
305 var firstRequestIndex = Math.floor(this._scrollTop / this._rowHeight); 305 var firstRequestIndex = Math.floor(this._scrollTop / this._rowHeight);
306 var lastRequestIndex = Math.min(nodes.length, firstRequestIndex + Math.ceil( this._offsetHeight / this._rowHeight)); 306 var lastRequestIndex = Math.min(nodes.length, firstRequestIndex + Math.ceil( this._offsetHeight / this._rowHeight));
307 for (var i = firstRequestIndex; i < lastRequestIndex; i++) { 307 for (var i = firstRequestIndex; i < lastRequestIndex; i++) {
308 var rowOffset = this._rowHeight * i; 308 var rowOffset = this._rowHeight * i;
309 var node = nodes[i]; 309 var node = nodes[i];
310 this._decorateRow(context, node, i, rowOffset - this._scrollTop); 310 this._decorateRow(context, node, rowOffset - this._scrollTop);
311 var drawNodes = []; 311 var drawNodes = [];
312 if (node.hasChildren() && !node.expanded) 312 if (node.hasChildren() && !node.expanded)
313 drawNodes = /** @type {!Array<!Network.NetworkNode>} */ (node.flatChildr en()); 313 drawNodes = /** @type {!Array<!Network.NetworkNode>} */ (node.flatChildr en());
314 drawNodes.push(node); 314 drawNodes.push(node);
315 for (var drawNode of drawNodes) { 315 for (var drawNode of drawNodes) {
316 if (useTimingBars) 316 if (useTimingBars)
317 this._drawTimingBars(context, drawNode, rowOffset - this._scrollTop); 317 this._drawTimingBars(context, drawNode, rowOffset - this._scrollTop);
318 else 318 else
319 this._drawSimplifiedBars(context, drawNode, rowOffset - this._scrollTo p); 319 this._drawSimplifiedBars(context, drawNode, rowOffset - this._scrollTo p);
320 } 320 }
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 context.stroke(); 589 context.stroke();
590 } 590 }
591 context.fill(); 591 context.fill();
592 } 592 }
593 context.restore(); 593 context.restore();
594 } 594 }
595 595
596 /** 596 /**
597 * @param {!CanvasRenderingContext2D} context 597 * @param {!CanvasRenderingContext2D} context
598 * @param {!Network.NetworkNode} node 598 * @param {!Network.NetworkNode} node
599 * @param {number} rowNumber
600 * @param {number} y 599 * @param {number} y
601 */ 600 */
602 _decorateRow(context, node, rowNumber, y) { 601 _decorateRow(context, node, y) {
603 var isOddRow = rowNumber % 2 === 1; 602 var isStriped = node.isStriped();
604 if (isOddRow && !node.hovered() && !node.isNavigationRequest() && !node.isOn InitiatorPath() && 603 if (!isStriped && !node.hovered() && !node.isNavigationRequest() && !node.is OnInitiatorPath() &&
605 !node.isOnInitiatedPath()) 604 !node.isOnInitiatedPath())
606 return; 605 return;
607 606
608 var color = getRowColor.call(this); 607 var color = getRowColor.call(this);
609 if (color === 'transparent') 608 if (color === 'transparent')
610 return; 609 return;
611 context.save(); 610 context.save();
612 context.beginPath(); 611 context.beginPath();
613 context.fillStyle = color; 612 context.fillStyle = color;
614 context.rect(0, y, this._offsetWidth, this._rowHeight); 613 context.rect(0, y, this._offsetWidth, this._rowHeight);
615 context.fill(); 614 context.fill();
616 context.restore(); 615 context.restore();
617 616
618 /** 617 /**
619 * @return {string} 618 * @return {string}
620 * @this {Network.NetworkWaterfallColumn} 619 * @this {Network.NetworkWaterfallColumn}
621 */ 620 */
622 function getRowColor() { 621 function getRowColor() {
623 if (node.hovered()) 622 if (node.hovered())
624 return this._rowHoverColor; 623 return this._rowHoverColor;
625 if (node.isOnInitiatorPath()) 624 if (node.isOnInitiatorPath())
626 return this._parentInitiatorColor; 625 return this._parentInitiatorColor;
627 if (node.isOnInitiatedPath()) 626 if (node.isOnInitiatedPath())
628 return this._initiatedColor; 627 return this._initiatedColor;
629 if (node.isNavigationRequest()) 628 if (node.isNavigationRequest())
630 return this._rowNavigationRequestColor; 629 return this._rowNavigationRequestColor;
631 if (rowNumber % 2 === 1) 630 if (!isStriped)
632 return 'transparent'; 631 return 'transparent';
633 return this._rowStripeColor; 632 return this._rowStripeColor;
634 } 633 }
635 } 634 }
636 }; 635 };
637 636
638 /** @enum {string} */ 637 /** @enum {string} */
639 Network.NetworkWaterfallColumn._colorsForResourceType = { 638 Network.NetworkWaterfallColumn._colorsForResourceType = {
640 document: 'hsl(215, 100%, 80%)', 639 document: 'hsl(215, 100%, 80%)',
641 font: 'hsl(8, 100%, 80%)', 640 font: 'hsl(8, 100%, 80%)',
642 media: 'hsl(90, 50%, 80%)', 641 media: 'hsl(90, 50%, 80%)',
643 image: 'hsl(90, 50%, 80%)', 642 image: 'hsl(90, 50%, 80%)',
644 script: 'hsl(31, 100%, 80%)', 643 script: 'hsl(31, 100%, 80%)',
645 stylesheet: 'hsl(272, 64%, 80%)', 644 stylesheet: 'hsl(272, 64%, 80%)',
646 texttrack: 'hsl(8, 100%, 80%)', 645 texttrack: 'hsl(8, 100%, 80%)',
647 websocket: 'hsl(0, 0%, 95%)', 646 websocket: 'hsl(0, 0%, 95%)',
648 xhr: 'hsl(53, 100%, 80%)', 647 xhr: 'hsl(53, 100%, 80%)',
649 other: 'hsl(0, 0%, 95%)' 648 other: 'hsl(0, 0%, 95%)'
650 }; 649 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/network/NetworkLogViewColumns.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698