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

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

Issue 2495903003: DevTools: Show friendly names for Parse/Compile RCS (Closed)
Patch Set: Created 4 years, 1 month 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 [inputEvent.TouchStart, WebInspector.UIString('Touch Start')], 217 [inputEvent.TouchStart, WebInspector.UIString('Touch Start')],
218 [inputEvent.PinchBegin, WebInspector.UIString('Pinch Begin')], 218 [inputEvent.PinchBegin, WebInspector.UIString('Pinch Begin')],
219 [inputEvent.PinchEnd, WebInspector.UIString('Pinch End')], 219 [inputEvent.PinchEnd, WebInspector.UIString('Pinch End')],
220 [inputEvent.PinchUpdate, WebInspector.UIString('Pinch Update')] 220 [inputEvent.PinchUpdate, WebInspector.UIString('Pinch Update')]
221 ]); 221 ]);
222 } 222 }
223 return WebInspector.TimelineUIUtils._inputEventToDisplayName.get(inputEventT ype) || null; 223 return WebInspector.TimelineUIUtils._inputEventToDisplayName.get(inputEventT ype) || null;
224 } 224 }
225 225
226 /** 226 /**
227 * @param {!Protocol.Runtime.CallFrame} frame
228 * @return {string}
229 */
230 static frameDisplayName(frame) {
231 if (WebInspector.TimelineJSProfileProcessor.isNativeRuntimeFrame(frame)) {
caseq 2016/11/11 23:30:38 if (!..) return
232 const nativeGroup = WebInspector.TimelineJSProfileProcessor.nativeGroup(fr ame.functionName);
233 const groups = WebInspector.TimelineJSProfileProcessor.NativeGroups;
234 switch (nativeGroup) {
235 case groups.Compile: return WebInspector.UIString('Compile');
236 case groups.Parse: return WebInspector.UIString('Parse');
237 }
238 return frame.functionName;
239 }
240 return WebInspector.beautifyFunctionName(frame.functionName);
241 }
242
243 /**
227 * @param {!WebInspector.TracingModel.Event} traceEvent 244 * @param {!WebInspector.TracingModel.Event} traceEvent
228 * @param {!RegExp} regExp 245 * @param {!RegExp} regExp
229 * @return {boolean} 246 * @return {boolean}
230 */ 247 */
231 static testContentMatching(traceEvent, regExp) { 248 static testContentMatching(traceEvent, regExp) {
232 var title = WebInspector.TimelineUIUtils.eventStyle(traceEvent).title; 249 var title = WebInspector.TimelineUIUtils.eventStyle(traceEvent).title;
233 var tokens = [title]; 250 var tokens = [title];
234 var url = WebInspector.TimelineData.forEvent(traceEvent).url; 251 var url = WebInspector.TimelineData.forEvent(traceEvent).url;
235 if (url) 252 if (url)
236 tokens.push(url); 253 tokens.push(url);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 case recordType.MinorGC: 448 case recordType.MinorGC:
432 var delta = event.args['usedHeapSizeBefore'] - event.args['usedHeapSizeA fter']; 449 var delta = event.args['usedHeapSizeBefore'] - event.args['usedHeapSizeA fter'];
433 detailsText = WebInspector.UIString('%s collected', Number.bytesToString (delta)); 450 detailsText = WebInspector.UIString('%s collected', Number.bytesToString (delta));
434 break; 451 break;
435 case recordType.FunctionCall: 452 case recordType.FunctionCall:
436 // Omit internally generated script names. 453 // Omit internally generated script names.
437 if (eventData) 454 if (eventData)
438 detailsText = linkifyLocationAsText(eventData['scriptId'], eventData[' lineNumber'], 0); 455 detailsText = linkifyLocationAsText(eventData['scriptId'], eventData[' lineNumber'], 0);
439 break; 456 break;
440 case recordType.JSFrame: 457 case recordType.JSFrame:
441 detailsText = WebInspector.beautifyFunctionName(eventData['functionName' ]); 458 detailsText = WebInspector.TimelineUIUtils.frameDisplayName(eventData);
442 break; 459 break;
443 case recordType.EventDispatch: 460 case recordType.EventDispatch:
444 detailsText = eventData ? eventData['type'] : null; 461 detailsText = eventData ? eventData['type'] : null;
445 break; 462 break;
446 case recordType.Paint: 463 case recordType.Paint:
447 var width = WebInspector.TimelineUIUtils.quadWidth(eventData.clip); 464 var width = WebInspector.TimelineUIUtils.quadWidth(eventData.clip);
448 var height = WebInspector.TimelineUIUtils.quadHeight(eventData.clip); 465 var height = WebInspector.TimelineUIUtils.quadHeight(eventData.clip);
449 if (width && height) 466 if (width && height)
450 detailsText = WebInspector.UIString('%d\u2009\u00d7\u2009%d', width, h eight); 467 detailsText = WebInspector.UIString('%d\u2009\u00d7\u2009%d', width, h eight);
451 break; 468 break;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 case recordType.ResourceReceivedData: 610 case recordType.ResourceReceivedData:
594 case recordType.ResourceReceiveResponse: 611 case recordType.ResourceReceiveResponse:
595 case recordType.ResourceFinish: 612 case recordType.ResourceFinish:
596 var url = WebInspector.TimelineData.forEvent(event).url; 613 var url = WebInspector.TimelineData.forEvent(event).url;
597 if (url) 614 if (url)
598 details = WebInspector.linkifyResourceAsNode(url); 615 details = WebInspector.linkifyResourceAsNode(url);
599 break; 616 break;
600 case recordType.FunctionCall: 617 case recordType.FunctionCall:
601 case recordType.JSFrame: 618 case recordType.JSFrame:
602 details = createElement('span'); 619 details = createElement('span');
603 details.createTextChild(WebInspector.beautifyFunctionName(eventData['fun ctionName'])); 620 details.createTextChild(WebInspector.TimelineUIUtils.frameDisplayName(ev entData));
604 var location = linkifyLocation( 621 const location = linkifyLocation(
605 eventData['scriptId'], eventData['url'], eventData['lineNumber'], ev entData['columnNumber']); 622 eventData['scriptId'], eventData['url'], eventData['lineNumber'], ev entData['columnNumber']);
606 if (location) { 623 if (location) {
607 details.createTextChild(' @ '); 624 details.createTextChild(' @ ');
608 details.appendChild(location); 625 details.appendChild(location);
609 } 626 }
610 break; 627 break;
611 case recordType.CompileScript: 628 case recordType.CompileScript:
612 case recordType.EvaluateScript: 629 case recordType.EvaluateScript:
613 var url = eventData['url']; 630 var url = eventData['url'];
614 if (url) 631 if (url)
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 if (reason) 1825 if (reason)
1809 title.createTextChild(WebInspector.UIString('%s for ', reason)); 1826 title.createTextChild(WebInspector.UIString('%s for ', reason));
1810 else 1827 else
1811 title.createTextChild(WebInspector.UIString('Unknown cause for ')); 1828 title.createTextChild(WebInspector.UIString('Unknown cause for '));
1812 1829
1813 this._appendTruncatedNodeList(title, this._invalidations); 1830 this._appendTruncatedNodeList(title, this._invalidations);
1814 1831
1815 if (topFrame && this._contentHelper.linkifier()) { 1832 if (topFrame && this._contentHelper.linkifier()) {
1816 title.createTextChild(WebInspector.UIString('. ')); 1833 title.createTextChild(WebInspector.UIString('. '));
1817 var stack = title.createChild('span', 'monospace'); 1834 var stack = title.createChild('span', 'monospace');
1818 stack.createChild('span').textContent = WebInspector.beautifyFunctionName( topFrame.functionName); 1835 stack.createChild('span').textContent = WebInspector.TimelineUIUtils.frame DisplayName(topFrame);
1819 var link = this._contentHelper.linkifier().maybeLinkifyConsoleCallFrame(ta rget, topFrame); 1836 var link = this._contentHelper.linkifier().maybeLinkifyConsoleCallFrame(ta rget, topFrame);
1820 if (link) { 1837 if (link) {
1821 stack.createChild('span').textContent = ' @ '; 1838 stack.createChild('span').textContent = ' @ ';
1822 stack.createChild('span').appendChild(link); 1839 stack.createChild('span').appendChild(link);
1823 } 1840 }
1824 } 1841 }
1825 1842
1826 return title; 1843 return title;
1827 } 1844 }
1828 1845
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 /** 2230 /**
2214 * @param {!WebInspector.TracingModel.Event} event 2231 * @param {!WebInspector.TracingModel.Event} event
2215 * @param {string=} warningType 2232 * @param {string=} warningType
2216 */ 2233 */
2217 appendWarningRow(event, warningType) { 2234 appendWarningRow(event, warningType) {
2218 var warning = WebInspector.TimelineUIUtils.eventWarning(event, warningType); 2235 var warning = WebInspector.TimelineUIUtils.eventWarning(event, warningType);
2219 if (warning) 2236 if (warning)
2220 this.appendElementRow(WebInspector.UIString('Warning'), warning, true); 2237 this.appendElementRow(WebInspector.UIString('Warning'), warning, true);
2221 } 2238 }
2222 }; 2239 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698