Chromium Code Reviews| 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..bff6f0e74b37cddd0106c3953a4f8174688a775b 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(); |
|
caseq
2017/03/17 00:16:29
Let's make it private, this is just what you need
allada
2017/03/17 01:16:09
Done.
|
| 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) { |
|
caseq
2017/03/17 00:16:29
style: functions start with lowercase.
allada
2017/03/17 01:16:09
I am keeping it consistent with the other comparat
|
| + 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.lookupColumnValue(aRequest); |
| + var bValue = instance.lookupColumnValue(bRequest); |
| + if (aValue === bValue) |
| + return aRequest.indentityCompare(bRequest); |
| + return aValue > bValue ? 1 : -1; |
|
caseq
2017/03/17 00:16:29
Let's rather make comparison a part of extension i
allada
2017/03/17 01:16:09
Done.
|
| + } |
| + |
| + /** |
| * @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.lookupColumnValue(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)) |
| + return cell; |
| if (columnIdentifier === 'name') { |
| var leftPadding = this.leftPadding ? this.leftPadding + 'px' : ''; |
| cell.style.setProperty('padding-left', leftPadding); |