Chromium Code Reviews| Index: Source/devtools/front_end/network/NetworkDataGridNode.js |
| diff --git a/Source/devtools/front_end/network/NetworkDataGridNode.js b/Source/devtools/front_end/network/NetworkDataGridNode.js |
| index d8ad7d13c2465650ad9d44614255ad07f3fa0492..c62403cc51f47dc7a29676677a0d1f27b2fc5d42 100644 |
| --- a/Source/devtools/front_end/network/NetworkDataGridNode.js |
| +++ b/Source/devtools/front_end/network/NetworkDataGridNode.js |
| @@ -106,6 +106,7 @@ WebInspector.NetworkDataGridNode.prototype = { |
| case "remoteAddress": cell.setTextAndTitle(this._request.remoteAddress()); break; |
| case "cookies": cell.setTextAndTitle(this._arrayLength(this._request.requestCookies)); break; |
| case "setCookies": cell.setTextAndTitle(this._arrayLength(this._request.responseCookies)); break; |
| + case "priority": cell.setTextAndTitle(this._uiLabelForPriority(this._request.initialPriority())); break; |
| case "connectionId": cell.setTextAndTitle(this._request.connectionId); break; |
| case "type": this._renderTypeCell(cell); break; |
| case "initiator": this._renderInitiatorCell(cell); break; |
| @@ -531,6 +532,24 @@ WebInspector.NetworkDataGridNode.prototype = { |
| } |
| }, |
| + /** |
| + * @param {?NetworkAgent.ResourcePriority} priority |
|
alph
2015/09/02 21:21:15
so, what about @return?
|
| + */ |
| + _uiLabelForPriority: function(priority) |
| + { |
| + var labelMap = WebInspector.NetworkDataGridNode._priorityToUILabel; |
| + if (!labelMap) { |
| + WebInspector.NetworkDataGridNode._priorityToUILabel = new Map(); |
| + labelMap = WebInspector.NetworkDataGridNode._priorityToUILabel; |
| + labelMap.set(NetworkAgent.ResourcePriority.VeryLow, WebInspector.UIString("Lowest")); |
| + labelMap.set(NetworkAgent.ResourcePriority.Low, WebInspector.UIString("Low")); |
| + labelMap.set(NetworkAgent.ResourcePriority.Medium, WebInspector.UIString("Medium")); |
| + labelMap.set(NetworkAgent.ResourcePriority.High, WebInspector.UIString("High")); |
| + labelMap.set(NetworkAgent.ResourcePriority.VeryHigh, WebInspector.UIString("Highest")); |
| + } |
| + return priority ? labelMap.get(priority) : WebInspector.UIString("Unknown"); |
| + }, |
| + |
| __proto__: WebInspector.SortableDataGridNode.prototype |
| } |
| @@ -643,6 +662,29 @@ WebInspector.NetworkDataGridNode.ResponseCookiesCountComparator = function(a, b) |
| } |
| /** |
| + * @param {!WebInspector.NetworkDataGridNode} a |
| + * @param {!WebInspector.NetworkDataGridNode} b |
| + * @return {number} |
| + */ |
| +WebInspector.NetworkDataGridNode.InitialPriorityComparator = function(a, b) |
| +{ |
| + var priorityMap = WebInspector.NetworkDataGridNode._symbolicToNumericPriority; |
| + if (!priorityMap) { |
| + WebInspector.NetworkDataGridNode._symbolicToNumericPriority = new Map(); |
| + priorityMap = WebInspector.NetworkDataGridNode._symbolicToNumericPriority; |
| + priorityMap.set(NetworkAgent.ResourcePriority.VeryLow, 1); |
| + priorityMap.set(NetworkAgent.ResourcePriority.Low, 2); |
| + priorityMap.set(NetworkAgent.ResourcePriority.Medium, 3); |
| + priorityMap.set(NetworkAgent.ResourcePriority.High, 4); |
| + priorityMap.set(NetworkAgent.ResourcePriority.VeryHigh, 5); |
| + } |
| + var aScore = priorityMap.get(a._request.initialPriority()) || 0; |
| + var bScore = priorityMap.get(b._request.initialPriority()) || 0; |
| + |
| + return aScore - bScore || a._request.indentityCompare(b._request); |
| +} |
| + |
| +/** |
| * @param {string} propertyName |
| * @param {boolean} revert |
| * @param {!WebInspector.NetworkDataGridNode} a |