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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js

Issue 2562193002: Add filtering by priority in the Network filter area. (Closed)
Patch Set: Changes made according to reviewer comments Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js b/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
index fc19d6e08fe92bae648728321f050f37230e72b3..6f96f8fee3283a00aaf376868669617f5fe7bb01 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
@@ -501,3 +501,21 @@ Components.uiLabelForPriority = function(priority) {
}
return labelMap.get(priority) || Common.UIString('Unknown');
};
+
+/**
+ * @param {string} priorityLabel
+ * @return {string}
+ */
+Components.priorityByUiLabel = function(priorityLabel) {
allada 2016/12/17 01:20:20 nit: lets rename to: "uiLabelToPriority"
+ var labelToPriorityMap = Components.priorityByUiLabel._uILabelToPriority;
allada 2016/12/17 01:20:20 Lets restructure this function to something like:
+ var labelMap;
+
+ if (!labelToPriorityMap) {
+ labelMap = Components.uiLabelForPriority._priorityToUILabel;
allada 2016/12/17 01:20:20 This may not be set yet.
+ labelToPriorityMap = Object.keys(Protocol.Network.ResourcePriority)
+ .reduce(((map, priority) => map.set(labelMap.get(priority), priority)), new Map());
Oleksii Kadurin 2016/12/13 19:43:37 * I know that such a huge indentation here looks u
+ Components.priorityByUiLabel._uILabelToPriority = labelToPriorityMap;
+ }
+
+ return labelToPriorityMap.get(priorityLabel);
+};

Powered by Google App Engine
This is Rietveld 408576698