Chromium Code Reviews| 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..e7f943c1e80009ece963192bc621aad2031c5098 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,19 @@ Components.uiLabelForPriority = function(priority) { |
| } |
| return labelMap.get(priority) || Common.UIString('Unknown'); |
| }; |
| + |
| +/** |
| + * @param {string} priorityLabel |
| + * @return {string|undefined} |
| + */ |
| +Components.getPriorityByPriorityLabel = function(priorityLabel) { |
|
allada
2016/12/12 17:29:57
Instead of doing this lets generate an inverse map
Oleksii Kadurin
2016/12/12 21:13:15
1. 'inverse map' - do you mean every time the func
allada
2016/12/12 23:51:08
We already generate a map one time for ENUM => sym
|
| + var labelMap = Components.uiLabelForPriority._priorityToUILabel; |
| + var result; |
| + |
| + labelMap.forEach(function(value, key) { |
| + if (value === priorityLabel) |
| + result = key; |
| + }); |
| + |
| + return result; |
| +}; |