OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 /** | 4 /** |
5 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 Components.NetworkConditionsSelector = class { | 7 Components.NetworkConditionsSelector = class { |
8 /** | 8 /** |
9 * @param {function(!Array<!Components.NetworkConditionsGroup>):!Array<?SDK.Ne tworkManager.Conditions>} populateCallback | 9 * @param {function(!Array<!Components.NetworkConditionsGroup>):!Array<?SDK.Ne tworkManager.Conditions>} populateCallback |
10 * @param {function(number)} selectCallback | 10 * @param {function(number)} selectCallback |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 [Protocol.Network.ResourcePriority.VeryLow, Common.UIString('Lowest')], | 494 [Protocol.Network.ResourcePriority.VeryLow, Common.UIString('Lowest')], |
495 [Protocol.Network.ResourcePriority.Low, Common.UIString('Low')], | 495 [Protocol.Network.ResourcePriority.Low, Common.UIString('Low')], |
496 [Protocol.Network.ResourcePriority.Medium, Common.UIString('Medium')], | 496 [Protocol.Network.ResourcePriority.Medium, Common.UIString('Medium')], |
497 [Protocol.Network.ResourcePriority.High, Common.UIString('High')], | 497 [Protocol.Network.ResourcePriority.High, Common.UIString('High')], |
498 [Protocol.Network.ResourcePriority.VeryHigh, Common.UIString('Highest')] | 498 [Protocol.Network.ResourcePriority.VeryHigh, Common.UIString('Highest')] |
499 ]); | 499 ]); |
500 Components.uiLabelForPriority._priorityToUILabel = labelMap; | 500 Components.uiLabelForPriority._priorityToUILabel = labelMap; |
501 } | 501 } |
502 return labelMap.get(priority) || Common.UIString('Unknown'); | 502 return labelMap.get(priority) || Common.UIString('Unknown'); |
503 }; | 503 }; |
504 | |
505 /** | |
506 * @param {string} priorityLabel | |
507 * @return {string|undefined} | |
508 */ | |
509 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
| |
510 var labelMap = Components.uiLabelForPriority._priorityToUILabel; | |
511 var result; | |
512 | |
513 labelMap.forEach(function(value, key) { | |
514 if (value === priorityLabel) | |
515 result = key; | |
516 }); | |
517 | |
518 return result; | |
519 }; | |
OLD | NEW |