Index: third_party/WebKit/Source/devtools/front_end/network/NetworkDataGridNode.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkDataGridNode.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkDataGridNode.js |
index a584c6edda243766f2016ab2bdffedcda8f33d3f..f04f23da81b6c328dd09147105ad1269eb027a2e 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/network/NetworkDataGridNode.js |
+++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkDataGridNode.js |
@@ -38,6 +38,11 @@ Network.NetworkNode = class extends DataGrid.SortableDataGridNode { |
constructor(parentView) { |
super({}); |
this._parentView = parentView; |
+ /** |
+ * @protected |
+ * @type {!Map<string, ?Network.NetworkColumnExtensionInterface>} |
+ */ |
+ this.columnExtensions = new Map(); |
this._isHovered = false; |
this._showingInitiatorChain = false; |
/** @type {?SDK.NetworkRequest} */ |
@@ -74,6 +79,13 @@ Network.NetworkNode = class extends DataGrid.SortableDataGridNode { |
} |
/** |
+ * @param {!Map<string, ?Network.NetworkColumnExtensionInterface>} columnExtensions |
+ */ |
+ setColumnExtensions(columnExtensions) { |
+ this.columnExtensions = columnExtensions; |
+ } |
+ |
+ /** |
* @param {boolean} hovered |
* @param {boolean} showInitiatorChain |
*/ |
@@ -464,6 +476,28 @@ Network.NetworkRequestNode = class extends Network.NetworkNode { |
} |
/** |
+ * @param {!Map<string, ?Network.NetworkColumnExtensionInterface>} extensionsMap |
+ * @param {string} extensionId |
+ * @param {!Network.NetworkNode} a |
+ * @param {!Network.NetworkNode} b |
+ * @return {number} |
+ */ |
+ static ExtensionColumnComparator(extensionsMap, extensionId, a, b) { |
+ var aRequest = a.requestOrFirstKnownChildRequest(); |
+ var bRequest = b.requestOrFirstKnownChildRequest(); |
+ if (!aRequest || !bRequest) |
+ return !aRequest ? -1 : 1; |
+ var instance = extensionsMap.get(extensionId); |
+ if (!instance) |
+ return aRequest.indentityCompare(bRequest); |
+ var aValue = instance.lookup(aRequest) || ''; |
+ var bValue = instance.lookup(bRequest) || ''; |
+ if (aValue === bValue) |
+ return aRequest.indentityCompare(bRequest); |
+ return aValue > bValue ? 1 : -1; |
+ } |
+ |
+ /** |
* @override |
*/ |
showingInitiatorChainChanged() { |
@@ -604,6 +638,14 @@ Network.NetworkRequestNode = class extends Network.NetworkNode { |
*/ |
createCell(columnIdentifier) { |
var cell = this.createTD(columnIdentifier); |
+ // If the key exists but the value is null it means the extension instance has not resolved yet. |
+ // The view controller will force all rows to update when extension is resolved. |
+ if (this.columnExtensions.has(columnIdentifier)) { |
+ var instance = this.columnExtensions.get(columnIdentifier); |
+ if (instance) |
+ this._setTextAndTitle(cell, instance.lookup(this._request) || ''); |
+ return cell; |
+ } |
switch (columnIdentifier) { |
case 'name': |
this._renderNameCell(cell); |
@@ -954,6 +996,8 @@ Network.NetworkGroupNode = class extends Network.NetworkNode { |
*/ |
createCell(columnIdentifier) { |
var cell = this.createTD(columnIdentifier); |
+ if (this.columnExtensions.has(columnIdentifier)) |
allada
2017/03/15 21:42:02
This is the createCell for group nodes which we cu
|
+ return cell; |
if (columnIdentifier === 'name') { |
var leftPadding = this.leftPadding ? this.leftPadding + 'px' : ''; |
cell.style.setProperty('padding-left', leftPadding); |