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

Side by Side Diff: Source/devtools/front_end/network/NetworkPanel.js

Issue 297893003: Devtools: DataGrid: do not render hidden columns. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comments Created 6 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 columns.push({ 338 columns.push({
339 id: "timeline", 339 id: "timeline",
340 titleDOMFragment: document.createDocumentFragment(), 340 titleDOMFragment: document.createDocumentFragment(),
341 title: WebInspector.UIString("Timeline"), 341 title: WebInspector.UIString("Timeline"),
342 sortable: false, 342 sortable: false,
343 weight: 40, 343 weight: 40,
344 sort: WebInspector.DataGrid.Order.Ascending 344 sort: WebInspector.DataGrid.Order.Ascending
345 }); 345 });
346 346
347 this._dataGrid = new WebInspector.DataGrid(columns); 347 this._dataGrid = new WebInspector.DataGrid(columns);
348 this._updateColumns();
348 this._dataGrid.setName("networkLog"); 349 this._dataGrid.setName("networkLog");
349 this._dataGrid.resizeMethod = WebInspector.DataGrid.ResizeMethod.Last; 350 this._dataGrid.resizeMethod = WebInspector.DataGrid.ResizeMethod.Last;
350 this._dataGrid.element.classList.add("network-log-grid"); 351 this._dataGrid.element.classList.add("network-log-grid");
351 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true); 352 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true);
352 this._dataGrid.show(this.element); 353 this._dataGrid.show(this.element);
353 354
354 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update. 355 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update.
355 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this); 356 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this);
356 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this); 357 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this);
357 358
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 } 730 }
730 731
731 for (var requestId in this._staleRequests) { 732 for (var requestId in this._staleRequests) {
732 var request = this._staleRequests[requestId]; 733 var request = this._staleRequests[requestId];
733 var node = this._requestGridNode(request); 734 var node = this._requestGridNode(request);
734 if (!node) { 735 if (!node) {
735 // Create the timeline tree element and graph. 736 // Create the timeline tree element and graph.
736 node = this._createRequestGridNode(request); 737 node = this._createRequestGridNode(request);
737 this._dataGrid.rootNode().appendChild(node); 738 this._dataGrid.rootNode().appendChild(node);
738 } 739 }
739 node.refreshRequest(); 740 node.refresh();
740 this._applyFilter(node); 741 this._applyFilter(node);
741 742
742 if (this.calculator.updateBoundaries(request)) 743 if (this.calculator.updateBoundaries(request))
743 boundariesChanged = true; 744 boundariesChanged = true;
744 745
745 if (!node.isFilteredOut()) 746 if (!node.isFilteredOut())
746 this._updateHighlightIfMatched(request); 747 this._updateHighlightIfMatched(request);
747 } 748 }
748 749
749 if (boundariesChanged) { 750 if (boundariesChanged) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 row.createChild("td").textContent = stackFrame.functionName || WebIn spector.UIString("(anonymous function)"); 994 row.createChild("td").textContent = stackFrame.functionName || WebIn spector.UIString("(anonymous function)");
994 row.createChild("td").textContent = " @ "; 995 row.createChild("td").textContent = " @ ";
995 row.createChild("td").appendChild(this._linkifier.linkifyLocation(re quest.target(), stackFrame.url, stackFrame.lineNumber - 1, stackFrame.columnNumb er - 1)); 996 row.createChild("td").appendChild(this._linkifier.linkifyLocation(re quest.target(), stackFrame.url, stackFrame.lineNumber - 1, stackFrame.columnNumb er - 1));
996 framesTable.appendChild(row); 997 framesTable.appendChild(row);
997 } 998 }
998 return framesTable; 999 return framesTable;
999 }, 1000 },
1000 1001
1001 _updateColumns: function() 1002 _updateColumns: function()
1002 { 1003 {
1003 var columnsVisibility = this._coulmnsVisibilitySetting.get();
1004 var detailedMode = !!this._detailedMode; 1004 var detailedMode = !!this._detailedMode;
1005 for (var columnIdentifier in columnsVisibility) { 1005 var visibleColumns = {"name": true};
1006 var visible = detailedMode && columnsVisibility[columnIdentifier]; 1006 if (detailedMode) {
1007 this._dataGrid.setColumnVisible(columnIdentifier, visible); 1007 visibleColumns["timeline"] = true;
1008 var columnsVisibility = this._coulmnsVisibilitySetting.get();
1009 for (var columnIdentifier in columnsVisibility)
1010 visibleColumns[columnIdentifier] = columnsVisibility[columnIdent ifier];
1008 } 1011 }
1009 this._dataGrid.setColumnVisible("timeline", detailedMode); 1012
1010 this._dataGrid.applyColumnWeights(); 1013 this._dataGrid.setColumnsVisiblity(visibleColumns);
1011 }, 1014 },
1012 1015
1013 /** 1016 /**
1014 * @param {string} columnIdentifier 1017 * @param {string} columnIdentifier
1015 */ 1018 */
1016 _toggleColumnVisibility: function(columnIdentifier) 1019 _toggleColumnVisibility: function(columnIdentifier)
1017 { 1020 {
1018 var columnsVisibility = this._coulmnsVisibilitySetting.get(); 1021 var columnsVisibility = this._coulmnsVisibilitySetting.get();
1019 columnsVisibility[columnIdentifier] = !columnsVisibility[columnIdentifie r]; 1022 columnsVisibility[columnIdentifier] = !columnsVisibility[columnIdentifie r];
1020 this._coulmnsVisibilitySetting.set(columnsVisibility); 1023 this._coulmnsVisibilitySetting.set(columnsVisibility);
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 WebInspector.DataGridNode.call(this, {}); 2410 WebInspector.DataGridNode.call(this, {});
2408 this._parentView = parentView; 2411 this._parentView = parentView;
2409 this._request = request; 2412 this._request = request;
2410 this._linkifier = new WebInspector.Linkifier(); 2413 this._linkifier = new WebInspector.Linkifier();
2411 } 2414 }
2412 2415
2413 WebInspector.NetworkDataGridNode.prototype = { 2416 WebInspector.NetworkDataGridNode.prototype = {
2414 /** override */ 2417 /** override */
2415 createCells: function() 2418 createCells: function()
2416 { 2419 {
2417 this._nameCell = this._createCell("name"); 2420 delete this._nameCell;
yurys 2014/05/30 11:31:46 this._nameCell = null;
eustas 2014/06/02 08:51:47 Done.
2418 this._methodCell = this._createCell("method"); 2421 delete this._timelineCell;
2419 this._statusCell = this._createCell("status");
2420 this._schemeCell = this._createCell("scheme");
2421 this._domainCell = this._createCell("domain");
2422 this._remoteAddressCell = this._createCell("remoteAddress");
2423 this._typeCell = this._createCell("type");
2424 this._initiatorCell = this._createCell("initiator");
2425 this._cookiesCell = this._createCell("cookies");
2426 this._setCookiesCell = this._createCell("setCookies");
2427 this._sizeCell = this._createCell("size");
2428 this._timeCell = this._createCell("time");
2429 2422
2430 this._responseHeaderCells = {}; 2423 var element = this._element;
2431 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC olumns; 2424 element.classList.toggle("network-error-row", this._isFailed());
2432 for (var i = 0; i < responseHeaderColumns.length; ++i) 2425 element.classList.toggle("resource-cached", this._request.cached);
2433 this._responseHeaderCells[responseHeaderColumns[i]] = this._createCe ll(responseHeaderColumns[i]); 2426 var typeClassName = "network-type-" + this._request.type.name();
2427 if (!element.classList.contains(typeClassName)) {
2428 element.removeMatchingStyleClasses("network-type-\\w+");
2429 element.classList.add(typeClassName);
2430 }
2434 2431
2435 var timelineCell = this._createCell("timeline"); 2432 WebInspector.DataGridNode.prototype.createCells.call(this);
2436 this._timelineCell = timelineCell.createChild("div"); 2433
2437 this._createTimelineBar(this._timelineCell); 2434 this.refreshGraph(this._parentView.calculator);
2438 this._nameCell.addEventListener("click", this._onClick.bind(this), false ); 2435 },
2439 this._nameCell.addEventListener("dblclick", this._openInNewTab.bind(this ), false); 2436
2437 /**
2438 * @override
2439 * @param {string} columnIdentifier
2440 * @return {!Element}
2441 */
2442 createCell: function(columnIdentifier)
2443 {
2444 var cell = this.createTD(columnIdentifier);
2445 switch (columnIdentifier) {
2446 case "name": this._renderNameCell(cell); break;
2447 case "timeline": this._createTimelineBar(cell); break;
2448 case "method": cell.setTextAndTitle(this._request.requestMethod); break;
2449 case "scheme": cell.setTextAndTitle(this._request.scheme); break;
2450 case "domain": cell.setTextAndTitle(this._request.domain); break;
2451 case "remoteAddress": cell.setTextAndTitle(this._request.remoteAddress() ); break;
2452 case "cookies": cell.setTextAndTitle(this._arrayLength(this._request.req uestCookies)); break;
2453 case "setCookies": cell.setTextAndTitle(this._arrayLength(this._request. responseCookies)); break;
2454 case "type": this._renderTypeCell(cell); break;
2455 case "initiator": this._renderInitiatorCell(cell); break;
2456 case "size": this._renderSizeCell(cell); break;
2457 case "time": this._renderTimeCell(cell); break;
2458 default: cell.setTextAndTitle(this._request.responseHeaderValue(columnId entifier) || ""); break;
2459 }
2460
2461 return cell;
2462 },
2463
2464 /**
2465 * @param array {?Array}
2466 * @return {string}
2467 */
2468 _arrayLength: function(array)
2469 {
2470 return array ? "" + array.length : "";
2440 }, 2471 },
2441 2472
2442 wasDetached: function() 2473 wasDetached: function()
2443 { 2474 {
2444 this._linkifier.reset(); 2475 this._linkifier.reset();
2445 }, 2476 },
2446 2477
2447 /** 2478 /**
2448 * @return {boolean} 2479 * @return {boolean}
2449 */ 2480 */
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2481 _openInNewTab: function() 2512 _openInNewTab: function()
2482 { 2513 {
2483 InspectorFrontendHost.openInNewTab(this._request.url); 2514 InspectorFrontendHost.openInNewTab(this._request.url);
2484 }, 2515 },
2485 2516
2486 get selectable() 2517 get selectable()
2487 { 2518 {
2488 return this._parentView._allowRequestSelection && !this.isFilteredOut(); 2519 return this._parentView._allowRequestSelection && !this.isFilteredOut();
2489 }, 2520 },
2490 2521
2491 _createCell: function(columnIdentifier)
2492 {
2493 var td = this.createTD(columnIdentifier);
2494 this._element.appendChild(td);
2495 return td;
2496 },
2497
2498 /** 2522 /**
2499 * @param {!Element} cell 2523 * @param {!Element} cell
2500 */ 2524 */
2501 _createTimelineBar: function(cell) 2525 _createTimelineBar: function(cell)
2502 { 2526 {
2527 cell = cell.createChild("div");
2528 this._timelineCell = cell;
2529
2503 cell.className = "network-graph-side"; 2530 cell.className = "network-graph-side";
2504 2531
2505 this._barAreaElement = document.createElement("div"); 2532 this._barAreaElement = document.createElement("div");
2506 // this._barAreaElement.className = "network-graph-bar-area hidden"; 2533 // this._barAreaElement.className = "network-graph-bar-area hidden";
2507 this._barAreaElement.className = "network-graph-bar-area"; 2534 this._barAreaElement.className = "network-graph-bar-area";
2508 this._barAreaElement.request = this._request; 2535 this._barAreaElement.request = this._request;
2509 cell.appendChild(this._barAreaElement); 2536 cell.appendChild(this._barAreaElement);
2510 2537
2511 this._barLeftElement = document.createElement("div"); 2538 this._barLeftElement = document.createElement("div");
2512 this._barLeftElement.className = "network-graph-bar waiting"; 2539 this._barLeftElement.className = "network-graph-bar waiting";
2513 this._barAreaElement.appendChild(this._barLeftElement); 2540 this._barAreaElement.appendChild(this._barLeftElement);
2514 2541
2515 this._barRightElement = document.createElement("div"); 2542 this._barRightElement = document.createElement("div");
2516 this._barRightElement.className = "network-graph-bar"; 2543 this._barRightElement.className = "network-graph-bar";
2517 this._barAreaElement.appendChild(this._barRightElement); 2544 this._barAreaElement.appendChild(this._barRightElement);
2518 2545
2519 2546
2520 this._labelLeftElement = document.createElement("div"); 2547 this._labelLeftElement = document.createElement("div");
2521 this._labelLeftElement.className = "network-graph-label waiting"; 2548 this._labelLeftElement.className = "network-graph-label waiting";
2522 this._barAreaElement.appendChild(this._labelLeftElement); 2549 this._barAreaElement.appendChild(this._labelLeftElement);
2523 2550
2524 this._labelRightElement = document.createElement("div"); 2551 this._labelRightElement = document.createElement("div");
2525 this._labelRightElement.className = "network-graph-label"; 2552 this._labelRightElement.className = "network-graph-label";
2526 this._barAreaElement.appendChild(this._labelRightElement); 2553 this._barAreaElement.appendChild(this._labelRightElement);
2527 2554
2528 cell.addEventListener("mouseover", this._refreshLabelPositions.bind(this ), false); 2555 cell.addEventListener("mouseover", this._refreshLabelPositions.bind(this ), false);
2529 }, 2556 },
2530 2557
2531 refreshRequest: function()
2532 {
2533 this._refreshNameCell();
2534 this._refreshMethodCell();
2535 this._refreshStatusCell();
2536 this._refreshSchemeCell();
2537 this._refreshDomainCell();
2538 this._refreshRemoteAddressCell();
2539 this._refreshTypeCell();
2540 this._refreshInitiatorCell();
2541 this._refreshCookiesCell();
2542 this._refreshSetCookiesCell();
2543 this._refreshSizeCell();
2544 this._refreshTimeCell();
2545
2546 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC olumns;
2547 for (var i = 0; i < responseHeaderColumns.length; ++i)
2548 this._refreshResponseHeaderCell(responseHeaderColumns[i]);
2549
2550 this._updateElementStyleClasses();
2551 },
2552
2553 /** 2558 /**
2554 * @return {boolean} 2559 * @return {boolean}
2555 */ 2560 */
2556 _isFailed: function() 2561 _isFailed: function()
2557 { 2562 {
2558 return !!this._request.failed || (this._request.statusCode >= 400); 2563 return !!this._request.failed || (this._request.statusCode >= 400);
2559 }, 2564 },
2560 2565
2561 _updateElementStyleClasses: function() 2566 /**
2567 * @param {!Element} cell
2568 */
2569 _renderNameCell: function(cell)
2562 { 2570 {
2563 var element = this._element; 2571 this._nameCell = cell;
2564 element.classList.toggle("network-error-row", this._isFailed()); 2572 cell.addEventListener("click", this._onClick.bind(this), false);
2565 element.classList.toggle("resource-cached", this._request.cached); 2573 cell.addEventListener("dblclick", this._openInNewTab.bind(this), false);
2566 var typeClassName = "network-type-" + this._request.type.name();
2567 if (!element.classList.contains(typeClassName)) {
2568 element.removeMatchingStyleClasses("network-type-\\w+");
2569 element.classList.add(typeClassName);
2570 }
2571 },
2572
2573 _refreshResponseHeaderCell: function(headerName)
2574 {
2575 var cell = this._responseHeaderCells[headerName];
2576 var value = this._request.responseHeaderValue(headerName);
2577 cell.setTextAndTitle(value ? value : "");
2578 },
2579
2580 _refreshNameCell: function()
2581 {
2582 this._nameCell.removeChildren();
2583 2574
2584 if (this._request.type === WebInspector.resourceTypes.Image) { 2575 if (this._request.type === WebInspector.resourceTypes.Image) {
2585 var previewImage = document.createElement("img"); 2576 var previewImage = document.createElement("img");
2586 previewImage.className = "image-network-icon-preview"; 2577 previewImage.className = "image-network-icon-preview";
2587 this._request.populateImageSource(previewImage); 2578 this._request.populateImageSource(previewImage);
2588 2579
2589 var iconElement = document.createElement("div"); 2580 var iconElement = document.createElement("div");
2590 iconElement.className = "icon"; 2581 iconElement.className = "icon";
2591 iconElement.appendChild(previewImage); 2582 iconElement.appendChild(previewImage);
2592 } else { 2583 } else {
2593 var iconElement = document.createElement("img"); 2584 var iconElement = document.createElement("img");
2594 iconElement.className = "icon"; 2585 iconElement.className = "icon";
2595 } 2586 }
2596 this._nameCell.appendChild(iconElement); 2587 cell.appendChild(iconElement);
2597 this._nameCell.appendChild(document.createTextNode(this._request.name()) ); 2588 cell.appendChild(document.createTextNode(this._request.name()));
2598 this._appendSubtitle(this._nameCell, this._request.path()); 2589 this._appendSubtitle(cell, this._request.path());
2599 this._nameCell.title = this._request.url; 2590 cell.title = this._request.url;
2600 }, 2591 },
2601 2592
2602 _refreshMethodCell: function() 2593 /**
2594 * @param {!Element} cell
2595 */
2596 _renderStatusCell: function(cell)
2603 { 2597 {
2604 this._methodCell.setTextAndTitle(this._request.requestMethod); 2598 cell.classList.toggle("network-dim-cell", !this._isFailed() && (this._re quest.cached || !this._request.statusCode));
2605 },
2606
2607 _refreshStatusCell: function()
2608 {
2609 this._statusCell.removeChildren();
2610 this._statusCell.classList.toggle("network-dim-cell", !this._isFailed() && (this._request.cached || !this._request.statusCode));
2611 2599
2612 if (this._request.failed && !this._request.canceled) { 2600 if (this._request.failed && !this._request.canceled) {
2613 var failText = WebInspector.UIString("(failed)"); 2601 var failText = WebInspector.UIString("(failed)");
2614 if (this._request.localizedFailDescription) { 2602 if (this._request.localizedFailDescription) {
2615 this._statusCell.appendChild(document.createTextNode(failText)); 2603 cell.appendChild(document.createTextNode(failText));
2616 this._appendSubtitle(this._statusCell, this._request.localizedFa ilDescription); 2604 this._appendSubtitle(cell, this._request.localizedFailDescriptio n);
2617 this._statusCell.title = failText + " " + this._request.localize dFailDescription; 2605 cell.title = failText + " " + this._request.localizedFailDescrip tion;
2618 } else 2606 } else
2619 this._statusCell.setTextAndTitle(failText); 2607 cell.setTextAndTitle(failText);
2620 } else if (this._request.statusCode) { 2608 } else if (this._request.statusCode) {
2621 this._statusCell.appendChild(document.createTextNode("" + this._requ est.statusCode)); 2609 cell.appendChild(document.createTextNode("" + this._request.statusCo de));
2622 this._appendSubtitle(this._statusCell, this._request.statusText); 2610 this._appendSubtitle(cell, this._request.statusText);
2623 this._statusCell.title = this._request.statusCode + " " + this._requ est.statusText; 2611 cell.title = this._request.statusCode + " " + this._request.statusTe xt;
2624 } else if (this._request.parsedURL.isDataURL()) { 2612 } else if (this._request.parsedURL.isDataURL()) {
2625 this._statusCell.setTextAndTitle(WebInspector.UIString("(data)")); 2613 cell.setTextAndTitle(WebInspector.UIString("(data)"));
2626 } else if (this._request.isPingRequest()) { 2614 } else if (this._request.isPingRequest()) {
2627 this._statusCell.setTextAndTitle(WebInspector.UIString("(ping)")); 2615 cell.setTextAndTitle(WebInspector.UIString("(ping)"));
2628 } else if (this._request.canceled) { 2616 } else if (this._request.canceled) {
2629 this._statusCell.setTextAndTitle(WebInspector.UIString("(canceled)") ); 2617 cell.setTextAndTitle(WebInspector.UIString("(canceled)"));
2630 } else if (this._request.finished) { 2618 } else if (this._request.finished) {
2631 this._statusCell.setTextAndTitle(WebInspector.UIString("Finished")); 2619 cell.setTextAndTitle(WebInspector.UIString("Finished"));
2632 } else { 2620 } else {
2633 this._statusCell.setTextAndTitle(WebInspector.UIString("(pending)")) ; 2621 cell.setTextAndTitle(WebInspector.UIString("(pending)"));
2634 } 2622 }
2635 }, 2623 },
2636 2624
2637 _refreshSchemeCell: function() 2625 /**
2638 { 2626 * @param {!Element} cell
2639 this._schemeCell.setTextAndTitle(this._request.scheme); 2627 */
2640 }, 2628 _renderTypeCell: function(cell)
2641
2642 _refreshDomainCell: function()
2643 {
2644 this._domainCell.setTextAndTitle(this._request.domain);
2645 },
2646
2647 _refreshRemoteAddressCell: function()
2648 {
2649 this._remoteAddressCell.setTextAndTitle(this._request.remoteAddress());
2650 },
2651
2652 _refreshTypeCell: function()
2653 { 2629 {
2654 if (this._request.mimeType) { 2630 if (this._request.mimeType) {
2655 this._typeCell.classList.remove("network-dim-cell"); 2631 cell.setTextAndTitle(this._request.mimeType);
2656 this._typeCell.setTextAndTitle(this._request.mimeType);
2657 } else { 2632 } else {
2658 this._typeCell.classList.toggle("network-dim-cell", !this._request.i sPingRequest()); 2633 cell.classList.toggle("network-dim-cell", !this._request.isPingReque st());
2659 this._typeCell.setTextAndTitle(this._request.requestContentType() || ""); 2634 cell.setTextAndTitle(this._request.requestContentType() || "");
2660 } 2635 }
2661 }, 2636 },
2662 2637
2663 _refreshInitiatorCell: function() 2638 /**
2639 * @param {!Element} cell
2640 */
2641 _renderInitiatorCell: function(cell)
2664 { 2642 {
2665 this._initiatorCell.removeChildren();
2666 this._initiatorCell.classList.remove("network-dim-cell");
2667 this._initiatorCell.classList.remove("network-script-initiated");
2668 delete this._initiatorCell.request;
2669
2670 var request = this._request; 2643 var request = this._request;
2671 var initiator = request.initiatorInfo(); 2644 var initiator = request.initiatorInfo();
2672 2645
2673 switch (initiator.type) { 2646 switch (initiator.type) {
2674 case WebInspector.NetworkRequest.InitiatorType.Parser: 2647 case WebInspector.NetworkRequest.InitiatorType.Parser:
2675 this._initiatorCell.title = initiator.url + ":" + initiator.lineNumb er; 2648 cell.title = initiator.url + ":" + initiator.lineNumber;
2676 this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(i nitiator.url, initiator.lineNumber - 1)); 2649 cell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url, i nitiator.lineNumber - 1));
2677 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Par ser")); 2650 this._appendSubtitle(cell, WebInspector.UIString("Parser"));
2678 break; 2651 break;
2679 2652
2680 case WebInspector.NetworkRequest.InitiatorType.Redirect: 2653 case WebInspector.NetworkRequest.InitiatorType.Redirect:
2681 this._initiatorCell.title = initiator.url; 2654 cell.title = initiator.url;
2682 console.assert(request.redirectSource); 2655 console.assert(request.redirectSource);
2683 var redirectSource = /** @type {!WebInspector.NetworkRequest} */ (re quest.redirectSource); 2656 var redirectSource = /** @type {!WebInspector.NetworkRequest} */ (re quest.redirectSource);
2684 this._initiatorCell.appendChild(WebInspector.linkifyRequestAsNode(re directSource)); 2657 cell.appendChild(WebInspector.linkifyRequestAsNode(redirectSource));
2685 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Red irect")); 2658 this._appendSubtitle(cell, WebInspector.UIString("Redirect"));
2686 break; 2659 break;
2687 2660
2688 case WebInspector.NetworkRequest.InitiatorType.Script: 2661 case WebInspector.NetworkRequest.InitiatorType.Script:
2689 var urlElement = this._linkifier.linkifyLocation(request.target(), i nitiator.url, initiator.lineNumber - 1, initiator.columnNumber - 1); 2662 var urlElement = this._linkifier.linkifyLocation(request.target(), i nitiator.url, initiator.lineNumber - 1, initiator.columnNumber - 1);
2690 urlElement.title = ""; 2663 urlElement.title = "";
2691 this._initiatorCell.appendChild(urlElement); 2664 cell.appendChild(urlElement);
2692 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Scr ipt")); 2665 this._appendSubtitle(cell, WebInspector.UIString("Script"));
2693 this._initiatorCell.classList.add("network-script-initiated"); 2666 cell.classList.add("network-script-initiated");
2694 this._initiatorCell.request = request; 2667 cell.request = request;
2695 break; 2668 break;
2696 2669
2697 default: 2670 default:
2698 this._initiatorCell.title = ""; 2671 cell.title = "";
2699 this._initiatorCell.classList.add("network-dim-cell"); 2672 cell.classList.add("network-dim-cell");
2700 this._initiatorCell.setTextAndTitle(WebInspector.UIString("Other")); 2673 cell.setTextAndTitle(WebInspector.UIString("Other"));
2701 } 2674 }
2702 }, 2675 },
2703 2676
2704 _refreshCookiesCell: function() 2677 /**
2705 { 2678 * @param {!Element} cell
2706 var requestCookies = this._request.requestCookies; 2679 */
2707 this._cookiesCell.setTextAndTitle(requestCookies ? "" + requestCookies.l ength : ""); 2680 _renderSizeCell: function(cell)
2708 },
2709
2710 _refreshSetCookiesCell: function()
2711 {
2712 var responseCookies = this._request.responseCookies;
2713 this._setCookiesCell.setTextAndTitle(responseCookies ? "" + responseCook ies.length : "");
2714 },
2715
2716 _refreshSizeCell: function()
2717 { 2681 {
2718 if (this._request.cached) { 2682 if (this._request.cached) {
2719 this._sizeCell.setTextAndTitle(WebInspector.UIString("(from cache)") ); 2683 cell.setTextAndTitle(WebInspector.UIString("(from cache)"));
2720 this._sizeCell.classList.add("network-dim-cell"); 2684 cell.classList.add("network-dim-cell");
2721 } else { 2685 } else {
2722 var resourceSize = Number.bytesToString(this._request.resourceSize); 2686 var resourceSize = Number.bytesToString(this._request.resourceSize);
2723 var transferSize = Number.bytesToString(this._request.transferSize); 2687 var transferSize = Number.bytesToString(this._request.transferSize);
2724 this._sizeCell.setTextAndTitle(transferSize); 2688 cell.setTextAndTitle(transferSize);
2725 this._sizeCell.classList.remove("network-dim-cell"); 2689 this._appendSubtitle(cell, resourceSize);
2726 this._appendSubtitle(this._sizeCell, resourceSize);
2727 } 2690 }
2728 }, 2691 },
2729 2692
2730 _refreshTimeCell: function() 2693 /**
2694 * @param {!Element} cell
2695 */
2696 _renderTimeCell: function(cell)
2731 { 2697 {
2732 if (this._request.duration > 0) { 2698 if (this._request.duration > 0) {
2733 this._timeCell.classList.remove("network-dim-cell"); 2699 cell.setTextAndTitle(Number.secondsToString(this._request.duration)) ;
2734 this._timeCell.setTextAndTitle(Number.secondsToString(this._request. duration)); 2700 this._appendSubtitle(cell, Number.secondsToString(this._request.late ncy));
2735 this._appendSubtitle(this._timeCell, Number.secondsToString(this._re quest.latency));
2736 } else { 2701 } else {
2737 this._timeCell.classList.add("network-dim-cell"); 2702 cell.classList.add("network-dim-cell");
2738 this._timeCell.setTextAndTitle(WebInspector.UIString("Pending")); 2703 cell.setTextAndTitle(WebInspector.UIString("Pending"));
2739 } 2704 }
2740 }, 2705 },
2741 2706
2742 _appendSubtitle: function(cellElement, subtitleText) 2707 _appendSubtitle: function(cellElement, subtitleText)
2743 { 2708 {
2744 var subtitleElement = document.createElement("div"); 2709 var subtitleElement = document.createElement("div");
2745 subtitleElement.className = "network-cell-subtitle"; 2710 subtitleElement.className = "network-cell-subtitle";
2746 subtitleElement.textContent = subtitleText; 2711 subtitleElement.textContent = subtitleText;
2747 cellElement.appendChild(subtitleElement); 2712 cellElement.appendChild(subtitleElement);
2748 }, 2713 },
2749 2714
2750 refreshGraph: function(calculator) 2715 refreshGraph: function(calculator)
2751 { 2716 {
2717 if (!this._timelineCell)
2718 return;
2719
2752 var percentages = calculator.computeBarGraphPercentages(this._request); 2720 var percentages = calculator.computeBarGraphPercentages(this._request);
2753 this._percentages = percentages; 2721 this._percentages = percentages;
2754 2722
2755 this._barAreaElement.classList.remove("hidden"); 2723 this._barAreaElement.classList.remove("hidden");
2756 2724
2757 this._barLeftElement.style.setProperty("left", percentages.start + "%"); 2725 this._barLeftElement.style.setProperty("left", percentages.start + "%");
2758 this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%"); 2726 this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%");
2759 2727
2760 this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%"); 2728 this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%");
2761 this._barRightElement.style.setProperty("left", percentages.middle + "%" ); 2729 this._barRightElement.style.setProperty("left", percentages.middle + "%" );
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2924 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) 2892 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b)
2925 { 2893 {
2926 var aValue = a._request[propertyName]; 2894 var aValue = a._request[propertyName];
2927 var bValue = b._request[propertyName]; 2895 var bValue = b._request[propertyName];
2928 if (aValue > bValue) 2896 if (aValue > bValue)
2929 return revert ? -1 : 1; 2897 return revert ? -1 : 1;
2930 if (bValue > aValue) 2898 if (bValue > aValue)
2931 return revert ? 1 : -1; 2899 return revert ? 1 : -1;
2932 return 0; 2900 return 0;
2933 } 2901 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/ui/DataGrid.js » ('j') | Source/devtools/front_end/ui/DataGrid.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698