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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js

Issue 2163093003: [DevTools] Remove Object.values and Object.isEmpty from utilities.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 invalidationsTreeOutline.element.classList.add("invalidations-tree"); 1149 invalidationsTreeOutline.element.classList.add("invalidations-tree");
1150 1150
1151 var invalidationGroups = groupInvalidationsByCause(invalidations); 1151 var invalidationGroups = groupInvalidationsByCause(invalidations);
1152 invalidationGroups.forEach(function(group) { 1152 invalidationGroups.forEach(function(group) {
1153 var groupElement = new WebInspector.TimelineUIUtils.InvalidationsGroupEl ement(target, relatedNodesMap, contentHelper, group); 1153 var groupElement = new WebInspector.TimelineUIUtils.InvalidationsGroupEl ement(target, relatedNodesMap, contentHelper, group);
1154 invalidationsTreeOutline.appendChild(groupElement); 1154 invalidationsTreeOutline.appendChild(groupElement);
1155 }); 1155 });
1156 contentHelper.appendElementRow(title, invalidationsTreeOutline.element, fals e, true); 1156 contentHelper.appendElementRow(title, invalidationsTreeOutline.element, fals e, true);
1157 1157
1158 /** 1158 /**
1159 * @param {!Array.<!WebInspector.InvalidationTrackingEvent>} invalidations 1159 * @param {!Array<!WebInspector.InvalidationTrackingEvent>} invalidations
1160 * @return {!Array<!Array<!WebInspector.InvalidationTrackingEvent>>}
1160 */ 1161 */
1161 function groupInvalidationsByCause(invalidations) 1162 function groupInvalidationsByCause(invalidations)
1162 { 1163 {
1163 var causeToInvalidationMap = {}; 1164 /** @type {!Map<string, !Array<!WebInspector.InvalidationTrackingEvent>> } */
1165 var causeToInvalidationMap = new Map();
1164 for (var index = 0; index < invalidations.length; index++) { 1166 for (var index = 0; index < invalidations.length; index++) {
1165 var invalidation = invalidations[index]; 1167 var invalidation = invalidations[index];
1166 var causeKey = ""; 1168 var causeKey = "";
1167 if (invalidation.cause.reason) 1169 if (invalidation.cause.reason)
1168 causeKey += invalidation.cause.reason + "."; 1170 causeKey += invalidation.cause.reason + ".";
1169 if (invalidation.cause.stackTrace) { 1171 if (invalidation.cause.stackTrace) {
1170 invalidation.cause.stackTrace.forEach(function(stackFrame) { 1172 invalidation.cause.stackTrace.forEach(function(stackFrame) {
1171 causeKey += stackFrame["functionName"] + "."; 1173 causeKey += stackFrame["functionName"] + ".";
1172 causeKey += stackFrame["scriptId"] + "."; 1174 causeKey += stackFrame["scriptId"] + ".";
1173 causeKey += stackFrame["url"] + "."; 1175 causeKey += stackFrame["url"] + ".";
1174 causeKey += stackFrame["lineNumber"] + "."; 1176 causeKey += stackFrame["lineNumber"] + ".";
1175 causeKey += stackFrame["columnNumber"] + "."; 1177 causeKey += stackFrame["columnNumber"] + ".";
1176 }); 1178 });
1177 } 1179 }
1178 1180
1179 if (causeToInvalidationMap[causeKey]) 1181 if (causeToInvalidationMap.has(causeKey))
1180 causeToInvalidationMap[causeKey].push(invalidation); 1182 causeToInvalidationMap.get(causeKey).push(invalidation);
1181 else 1183 else
1182 causeToInvalidationMap[causeKey] = [ invalidation ]; 1184 causeToInvalidationMap.set(causeKey, [ invalidation ]);
1183 } 1185 }
1184 return Object.values(causeToInvalidationMap); 1186 return causeToInvalidationMap.valuesArray();
1185 } 1187 }
1186 } 1188 }
1187 1189
1188 /** 1190 /**
1189 * @param {!Set<number>} nodeIds 1191 * @param {!Set<number>} nodeIds
1190 * @param {!WebInspector.InvalidationTrackingEvent} invalidations 1192 * @param {!WebInspector.InvalidationTrackingEvent} invalidations
1191 */ 1193 */
1192 WebInspector.TimelineUIUtils._collectInvalidationNodeIds = function(nodeIds, inv alidations) 1194 WebInspector.TimelineUIUtils._collectInvalidationNodeIds = function(nodeIds, inv alidations)
1193 { 1195 {
1194 for (var i = 0; i < invalidations.length; ++i) { 1196 for (var i = 0; i < invalidations.length; ++i) {
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
2150 case warnings.V8Deopt: 2152 case warnings.V8Deopt:
2151 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", 2153 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53",
2152 WebInspector.UIString("Not optimized"), undefined, true)); 2154 WebInspector.UIString("Not optimized"), undefined, true));
2153 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); 2155 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"]));
2154 break; 2156 break;
2155 default: 2157 default:
2156 console.assert(false, "Unhandled TimelineModel.WarningType"); 2158 console.assert(false, "Unhandled TimelineModel.WarningType");
2157 } 2159 }
2158 return span; 2160 return span;
2159 } 2161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698