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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/FilterSuggestionBuilder.js

Issue 2915883002: DevTools: prepare to unify Network and CPU throttling UI (Closed)
Patch Set: gs Created 3 years, 6 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 var result = /** @type {!Array<string>} */ (this._valueLists[key]); 82 var result = /** @type {!Array<string>} */ (this._valueLists[key]);
83 83
84 if (!result) 84 if (!result)
85 return []; 85 return [];
86 86
87 if (key === Network.NetworkLogView.FilterType.Priority) { 87 if (key === Network.NetworkLogView.FilterType.Priority) {
88 var resultSet = new Set(result); 88 var resultSet = new Set(result);
89 result = []; 89 result = [];
90 /** @type {!Map<number, !Protocol.Network.ResourcePriority>} */ 90 /** @type {!Map<number, !Protocol.Network.ResourcePriority>} */
91 var numericToPriorityMap = new Map(); 91 var numericToPriorityMap = new Map();
92 NetworkConditions.prioritySymbolToNumericMap().forEach((value, key) => num ericToPriorityMap.set(value, key)); 92 NetworkPriorities.prioritySymbolToNumericMap().forEach((value, key) => num ericToPriorityMap.set(value, key));
93 var sortedNumericPriorities = numericToPriorityMap.keysArray(); 93 var sortedNumericPriorities = numericToPriorityMap.keysArray();
94 sortedNumericPriorities.sortNumbers(); 94 sortedNumericPriorities.sortNumbers();
95 var sortedPriorities = sortedNumericPriorities.map(value => numericToPrior ityMap.get(value)); 95 var sortedPriorities = sortedNumericPriorities.map(value => numericToPrior ityMap.get(value));
96 var sortedPriorityLabels = sortedPriorities.map(value => NetworkConditions .uiLabelForPriority(value)); 96 var sortedPriorityLabels = sortedPriorities.map(value => NetworkPriorities .uiLabelForPriority(value));
97 97
98 for (var value of sortedPriorityLabels) { 98 for (var value of sortedPriorityLabels) {
99 if (!resultSet.has(value)) 99 if (!resultSet.has(value))
100 continue; 100 continue;
101 result.push(value); 101 result.push(value);
102 } 102 }
103 } else { 103 } else {
104 result.sort(); 104 result.sort();
105 } 105 }
106 106
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 var value = part.substring(colonIndex + 1); 159 var value = part.substring(colonIndex + 1);
160 filters.push({type: key, data: value, negative: negative}); 160 filters.push({type: key, data: value, negative: negative});
161 } 161 }
162 return {text: text, filters: filters}; 162 return {text: text, filters: filters};
163 } 163 }
164 }; 164 };
165 165
166 /** @typedef {{type: string, data: string, negative: boolean}} */ 166 /** @typedef {{type: string, data: string, negative: boolean}} */
167 Network.FilterSuggestionBuilder.Filter; 167 Network.FilterSuggestionBuilder.Filter;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698