| OLD | NEW |
| 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 Loading... |
| 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)) |
| 232 return WebInspector.beautifyFunctionName(frame.functionName); |
| 233 const nativeGroup = WebInspector.TimelineJSProfileProcessor.nativeGroup(fram
e.functionName); |
| 234 const groups = WebInspector.TimelineJSProfileProcessor.NativeGroups; |
| 235 switch (nativeGroup) { |
| 236 case groups.Compile: return WebInspector.UIString('Compile'); |
| 237 case groups.Parse: return WebInspector.UIString('Parse'); |
| 238 } |
| 239 return frame.functionName; |
| 240 } |
| 241 |
| 242 /** |
| 227 * @param {!WebInspector.TracingModel.Event} traceEvent | 243 * @param {!WebInspector.TracingModel.Event} traceEvent |
| 228 * @param {!RegExp} regExp | 244 * @param {!RegExp} regExp |
| 229 * @return {boolean} | 245 * @return {boolean} |
| 230 */ | 246 */ |
| 231 static testContentMatching(traceEvent, regExp) { | 247 static testContentMatching(traceEvent, regExp) { |
| 232 var title = WebInspector.TimelineUIUtils.eventStyle(traceEvent).title; | 248 var title = WebInspector.TimelineUIUtils.eventStyle(traceEvent).title; |
| 233 var tokens = [title]; | 249 var tokens = [title]; |
| 234 var url = WebInspector.TimelineData.forEvent(traceEvent).url; | 250 var url = WebInspector.TimelineData.forEvent(traceEvent).url; |
| 235 if (url) | 251 if (url) |
| 236 tokens.push(url); | 252 tokens.push(url); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return WebInspector.TimelineUIUtils.colorForURL(frame.url); | 304 return WebInspector.TimelineUIUtils.colorForURL(frame.url); |
| 289 } | 305 } |
| 290 return WebInspector.TimelineUIUtils.eventStyle(event).category.color; | 306 return WebInspector.TimelineUIUtils.eventStyle(event).category.color; |
| 291 } | 307 } |
| 292 | 308 |
| 293 /** | 309 /** |
| 294 * @param {!WebInspector.TracingModel.Event} event | 310 * @param {!WebInspector.TracingModel.Event} event |
| 295 * @return {string} | 311 * @return {string} |
| 296 */ | 312 */ |
| 297 static eventTitle(event) { | 313 static eventTitle(event) { |
| 298 var title = WebInspector.TimelineUIUtils.eventStyle(event).title; | 314 const recordType = WebInspector.TimelineModel.RecordType; |
| 315 const eventData = event.args['data']; |
| 316 if (event.name === recordType.JSFrame) |
| 317 return WebInspector.TimelineUIUtils.frameDisplayName(eventData); |
| 318 const title = WebInspector.TimelineUIUtils.eventStyle(event).title; |
| 299 if (event.hasCategory(WebInspector.TimelineModel.Category.Console)) | 319 if (event.hasCategory(WebInspector.TimelineModel.Category.Console)) |
| 300 return title; | 320 return title; |
| 301 if (event.name === WebInspector.TimelineModel.RecordType.TimeStamp) | 321 if (event.name === recordType.TimeStamp) |
| 302 return WebInspector.UIString('%s: %s', title, event.args['data']['message'
]); | 322 return WebInspector.UIString('%s: %s', title, eventData['message']); |
| 303 if (event.name === WebInspector.TimelineModel.RecordType.Animation && event.
args['data'] && | 323 if (event.name === recordType.Animation && eventData && eventData['name']) |
| 304 event.args['data']['name']) | 324 return WebInspector.UIString('%s: %s', title, eventData['name']); |
| 305 return WebInspector.UIString('%s: %s', title, event.args['data']['name']); | |
| 306 return title; | 325 return title; |
| 307 } | 326 } |
| 308 | 327 |
| 309 /** | 328 /** |
| 310 * !Map<!WebInspector.TimelineIRModel.Phases, !{color: string, label: string}> | 329 * !Map<!WebInspector.TimelineIRModel.Phases, !{color: string, label: string}> |
| 311 */ | 330 */ |
| 312 static _interactionPhaseStyles() { | 331 static _interactionPhaseStyles() { |
| 313 var map = WebInspector.TimelineUIUtils._interactionPhaseStylesMap; | 332 var map = WebInspector.TimelineUIUtils._interactionPhaseStylesMap; |
| 314 if (!map) { | 333 if (!map) { |
| 315 map = new Map([ | 334 map = new Map([ |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 case recordType.MinorGC: | 450 case recordType.MinorGC: |
| 432 var delta = event.args['usedHeapSizeBefore'] - event.args['usedHeapSizeA
fter']; | 451 var delta = event.args['usedHeapSizeBefore'] - event.args['usedHeapSizeA
fter']; |
| 433 detailsText = WebInspector.UIString('%s collected', Number.bytesToString
(delta)); | 452 detailsText = WebInspector.UIString('%s collected', Number.bytesToString
(delta)); |
| 434 break; | 453 break; |
| 435 case recordType.FunctionCall: | 454 case recordType.FunctionCall: |
| 436 // Omit internally generated script names. | 455 // Omit internally generated script names. |
| 437 if (eventData) | 456 if (eventData) |
| 438 detailsText = linkifyLocationAsText(eventData['scriptId'], eventData['
lineNumber'], 0); | 457 detailsText = linkifyLocationAsText(eventData['scriptId'], eventData['
lineNumber'], 0); |
| 439 break; | 458 break; |
| 440 case recordType.JSFrame: | 459 case recordType.JSFrame: |
| 441 detailsText = WebInspector.beautifyFunctionName(eventData['functionName'
]); | 460 detailsText = WebInspector.TimelineUIUtils.frameDisplayName(eventData); |
| 442 break; | 461 break; |
| 443 case recordType.EventDispatch: | 462 case recordType.EventDispatch: |
| 444 detailsText = eventData ? eventData['type'] : null; | 463 detailsText = eventData ? eventData['type'] : null; |
| 445 break; | 464 break; |
| 446 case recordType.Paint: | 465 case recordType.Paint: |
| 447 var width = WebInspector.TimelineUIUtils.quadWidth(eventData.clip); | 466 var width = WebInspector.TimelineUIUtils.quadWidth(eventData.clip); |
| 448 var height = WebInspector.TimelineUIUtils.quadHeight(eventData.clip); | 467 var height = WebInspector.TimelineUIUtils.quadHeight(eventData.clip); |
| 449 if (width && height) | 468 if (width && height) |
| 450 detailsText = WebInspector.UIString('%d\u2009\u00d7\u2009%d', width, h
eight); | 469 detailsText = WebInspector.UIString('%d\u2009\u00d7\u2009%d', width, h
eight); |
| 451 break; | 470 break; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 case recordType.ResourceReceivedData: | 612 case recordType.ResourceReceivedData: |
| 594 case recordType.ResourceReceiveResponse: | 613 case recordType.ResourceReceiveResponse: |
| 595 case recordType.ResourceFinish: | 614 case recordType.ResourceFinish: |
| 596 var url = WebInspector.TimelineData.forEvent(event).url; | 615 var url = WebInspector.TimelineData.forEvent(event).url; |
| 597 if (url) | 616 if (url) |
| 598 details = WebInspector.linkifyResourceAsNode(url); | 617 details = WebInspector.linkifyResourceAsNode(url); |
| 599 break; | 618 break; |
| 600 case recordType.FunctionCall: | 619 case recordType.FunctionCall: |
| 601 case recordType.JSFrame: | 620 case recordType.JSFrame: |
| 602 details = createElement('span'); | 621 details = createElement('span'); |
| 603 details.createTextChild(WebInspector.beautifyFunctionName(eventData['fun
ctionName'])); | 622 details.createTextChild(WebInspector.TimelineUIUtils.frameDisplayName(ev
entData)); |
| 604 var location = linkifyLocation( | 623 const location = linkifyLocation( |
| 605 eventData['scriptId'], eventData['url'], eventData['lineNumber'], ev
entData['columnNumber']); | 624 eventData['scriptId'], eventData['url'], eventData['lineNumber'], ev
entData['columnNumber']); |
| 606 if (location) { | 625 if (location) { |
| 607 details.createTextChild(' @ '); | 626 details.createTextChild(' @ '); |
| 608 details.appendChild(location); | 627 details.appendChild(location); |
| 609 } | 628 } |
| 610 break; | 629 break; |
| 611 case recordType.CompileScript: | 630 case recordType.CompileScript: |
| 612 case recordType.EvaluateScript: | 631 case recordType.EvaluateScript: |
| 613 var url = eventData['url']; | 632 var url = eventData['url']; |
| 614 if (url) | 633 if (url) |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1808 if (reason) | 1827 if (reason) |
| 1809 title.createTextChild(WebInspector.UIString('%s for ', reason)); | 1828 title.createTextChild(WebInspector.UIString('%s for ', reason)); |
| 1810 else | 1829 else |
| 1811 title.createTextChild(WebInspector.UIString('Unknown cause for ')); | 1830 title.createTextChild(WebInspector.UIString('Unknown cause for ')); |
| 1812 | 1831 |
| 1813 this._appendTruncatedNodeList(title, this._invalidations); | 1832 this._appendTruncatedNodeList(title, this._invalidations); |
| 1814 | 1833 |
| 1815 if (topFrame && this._contentHelper.linkifier()) { | 1834 if (topFrame && this._contentHelper.linkifier()) { |
| 1816 title.createTextChild(WebInspector.UIString('. ')); | 1835 title.createTextChild(WebInspector.UIString('. ')); |
| 1817 var stack = title.createChild('span', 'monospace'); | 1836 var stack = title.createChild('span', 'monospace'); |
| 1818 stack.createChild('span').textContent = WebInspector.beautifyFunctionName(
topFrame.functionName); | 1837 stack.createChild('span').textContent = WebInspector.TimelineUIUtils.frame
DisplayName(topFrame); |
| 1819 var link = this._contentHelper.linkifier().maybeLinkifyConsoleCallFrame(ta
rget, topFrame); | 1838 var link = this._contentHelper.linkifier().maybeLinkifyConsoleCallFrame(ta
rget, topFrame); |
| 1820 if (link) { | 1839 if (link) { |
| 1821 stack.createChild('span').textContent = ' @ '; | 1840 stack.createChild('span').textContent = ' @ '; |
| 1822 stack.createChild('span').appendChild(link); | 1841 stack.createChild('span').appendChild(link); |
| 1823 } | 1842 } |
| 1824 } | 1843 } |
| 1825 | 1844 |
| 1826 return title; | 1845 return title; |
| 1827 } | 1846 } |
| 1828 | 1847 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2213 /** | 2232 /** |
| 2214 * @param {!WebInspector.TracingModel.Event} event | 2233 * @param {!WebInspector.TracingModel.Event} event |
| 2215 * @param {string=} warningType | 2234 * @param {string=} warningType |
| 2216 */ | 2235 */ |
| 2217 appendWarningRow(event, warningType) { | 2236 appendWarningRow(event, warningType) { |
| 2218 var warning = WebInspector.TimelineUIUtils.eventWarning(event, warningType); | 2237 var warning = WebInspector.TimelineUIUtils.eventWarning(event, warningType); |
| 2219 if (warning) | 2238 if (warning) |
| 2220 this.appendElementRow(WebInspector.UIString('Warning'), warning, true); | 2239 this.appendElementRow(WebInspector.UIString('Warning'), warning, true); |
| 2221 } | 2240 } |
| 2222 }; | 2241 }; |
| OLD | NEW |