Chromium Code Reviews

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

Issue 1624783002: DevTools: Switch to using fast stack iterator to collect stacks during timeline recording. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing pfeldman@ comments. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 198 matching lines...)
209 return true; 209 return true;
210 case recordTypes.MarkDOMContent: 210 case recordTypes.MarkDOMContent:
211 case recordTypes.MarkLoad: 211 case recordTypes.MarkLoad:
212 return event.args["data"]["isMainFrame"]; 212 return event.args["data"]["isMainFrame"];
213 default: 213 default:
214 return false; 214 return false;
215 } 215 }
216 } 216 }
217 217
218 /** 218 /**
219 * @param {!ConsoleAgent.CallFrame} frame
220 * @return {boolean}
221 */
222 WebInspector.TimelineUIUtils.isUserFrame = function(frame)
223 {
224 if (frame.url.startsWith("native "))
225 return false;
226 if (!frame.url && frame.scriptId === "0")
227 return false;
228 return true;
229 }
230
231 /**
232 * @param {!WebInspector.TracingModel.Event} event
233 * @return {?ConsoleAgent.CallFrame}
234 */
235 WebInspector.TimelineUIUtils.topUserFrame = function(event)
caseq 2016/01/27 23:03:56 is this still necessary?
alph 2016/01/27 23:16:20 Acknowledged.
236 {
237 var stackTrace = event.stackTrace || event.initiator && event.initiator.stac kTrace;
238 return stackTrace && stackTrace.find(WebInspector.TimelineUIUtils.isUserFram e) || null;
239 }
240
241 /**
219 * @enum {symbol} 242 * @enum {symbol}
220 */ 243 */
221 WebInspector.TimelineUIUtils.NetworkCategory = { 244 WebInspector.TimelineUIUtils.NetworkCategory = {
222 HTML: Symbol("HTML"), 245 HTML: Symbol("HTML"),
223 Script: Symbol("Script"), 246 Script: Symbol("Script"),
224 Style: Symbol("Style"), 247 Style: Symbol("Style"),
225 Media: Symbol("Media"), 248 Media: Symbol("Media"),
226 Other: Symbol("Other") 249 Other: Symbol("Other")
227 } 250 }
228 251
(...skipping 147 matching lines...)
376 return null; 399 return null;
377 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILo cation(rawLocation); 400 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILo cation(rawLocation);
378 return uiLocation.linkText(); 401 return uiLocation.linkText();
379 } 402 }
380 403
381 /** 404 /**
382 * @return {?string} 405 * @return {?string}
383 */ 406 */
384 function linkifyTopCallFrameAsText() 407 function linkifyTopCallFrameAsText()
385 { 408 {
386 var stackTrace = event.stackTrace; 409 var frame = WebInspector.TimelineUIUtils.topUserFrame(event);
387 if (!stackTrace) { 410 return frame ? linkifyLocationAsText(frame.scriptId, frame.lineNumber, f rame.columnNumber) : null;
388 var initiator = event.initiator;
389 if (initiator)
390 stackTrace = initiator.stackTrace;
391 }
392 if (!stackTrace || !stackTrace.length)
393 return null;
394 var callFrame = stackTrace[0];
395 return linkifyLocationAsText(callFrame.scriptId, callFrame.lineNumber, c allFrame.columnNumber);
396 } 411 }
397 } 412 }
398 413
399 /** 414 /**
400 * @param {!WebInspector.TracingModel.Event} event 415 * @param {!WebInspector.TracingModel.Event} event
401 * @param {?WebInspector.Target} target 416 * @param {?WebInspector.Target} target
402 * @param {!WebInspector.Linkifier} linkifier 417 * @param {!WebInspector.Linkifier} linkifier
403 * @return {?Node} 418 * @return {?Node}
404 */ 419 */
405 WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar get, linkifier) 420 WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar get, linkifier)
(...skipping 74 matching lines...)
480 if (columnNumber) 495 if (columnNumber)
481 --columnNumber; 496 --columnNumber;
482 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details"); 497 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details");
483 } 498 }
484 499
485 /** 500 /**
486 * @return {?Element} 501 * @return {?Element}
487 */ 502 */
488 function linkifyTopCallFrame() 503 function linkifyTopCallFrame()
489 { 504 {
490 var stackTrace = event.stackTrace; 505 var frame = WebInspector.TimelineUIUtils.topUserFrame(event);
491 if (!stackTrace) { 506 return frame ? linkifier.linkifyConsoleCallFrame(target, frame, "timelin e-details") : null;
492 var initiator = event.initiator;
493 if (initiator)
494 stackTrace = initiator.stackTrace;
495 }
496 if (!stackTrace || !stackTrace.length)
497 return null;
498 return linkifier.linkifyConsoleCallFrame(target, stackTrace[0], "timelin e-details");
499 } 507 }
500 } 508 }
501 509
502 /** 510 /**
503 * @param {!WebInspector.TracingModel.Event} event 511 * @param {!WebInspector.TracingModel.Event} event
504 * @param {!WebInspector.TimelineModel} model 512 * @param {!WebInspector.TimelineModel} model
505 * @param {!WebInspector.Linkifier} linkifier 513 * @param {!WebInspector.Linkifier} linkifier
506 * @param {boolean} detailed 514 * @param {boolean} detailed
507 * @param {function(!DocumentFragment)} callback 515 * @param {function(!DocumentFragment)} callback
508 */ 516 */
(...skipping 1502 matching lines...)
2011 case warnings.V8Deopt: 2019 case warnings.V8Deopt:
2012 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", 2020 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53",
2013 WebInspector.UIString("Not optimized"), undefined, true)); 2021 WebInspector.UIString("Not optimized"), undefined, true));
2014 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); 2022 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"]));
2015 break; 2023 break;
2016 default: 2024 default:
2017 console.assert(false, "Unhandled TimelineModel.WarningType"); 2025 console.assert(false, "Unhandled TimelineModel.WarningType");
2018 } 2026 }
2019 return span; 2027 return span;
2020 } 2028 }
OLDNEW

Powered by Google App Engine