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

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 caseq@ comments Created 4 years, 10 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 {!WebInspector.TracingModel.Event} event
220 * @return {?ConsoleAgent.CallFrame}
221 */
222 WebInspector.TimelineUIUtils.topStackFrame = function(event)
223 {
224 var stackTrace = event.stackTrace || event.initiator && event.initiator.stac kTrace;
225 return stackTrace && stackTrace.length ? stackTrace[0] : null;
226 }
227
228 /**
219 * @enum {symbol} 229 * @enum {symbol}
220 */ 230 */
221 WebInspector.TimelineUIUtils.NetworkCategory = { 231 WebInspector.TimelineUIUtils.NetworkCategory = {
222 HTML: Symbol("HTML"), 232 HTML: Symbol("HTML"),
223 Script: Symbol("Script"), 233 Script: Symbol("Script"),
224 Style: Symbol("Style"), 234 Style: Symbol("Style"),
225 Media: Symbol("Media"), 235 Media: Symbol("Media"),
226 Other: Symbol("Other") 236 Other: Symbol("Other")
227 } 237 }
228 238
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 return null; 386 return null;
377 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILo cation(rawLocation); 387 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILo cation(rawLocation);
378 return uiLocation.linkText(); 388 return uiLocation.linkText();
379 } 389 }
380 390
381 /** 391 /**
382 * @return {?string} 392 * @return {?string}
383 */ 393 */
384 function linkifyTopCallFrameAsText() 394 function linkifyTopCallFrameAsText()
385 { 395 {
386 var stackTrace = event.stackTrace; 396 var frame = WebInspector.TimelineUIUtils.topStackFrame(event);
387 if (!stackTrace) { 397 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 } 398 }
397 } 399 }
398 400
399 /** 401 /**
400 * @param {!WebInspector.TracingModel.Event} event 402 * @param {!WebInspector.TracingModel.Event} event
401 * @param {?WebInspector.Target} target 403 * @param {?WebInspector.Target} target
402 * @param {!WebInspector.Linkifier} linkifier 404 * @param {!WebInspector.Linkifier} linkifier
403 * @return {?Node} 405 * @return {?Node}
404 */ 406 */
405 WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar get, linkifier) 407 WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar get, linkifier)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 if (columnNumber) 482 if (columnNumber)
481 --columnNumber; 483 --columnNumber;
482 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details"); 484 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details");
483 } 485 }
484 486
485 /** 487 /**
486 * @return {?Element} 488 * @return {?Element}
487 */ 489 */
488 function linkifyTopCallFrame() 490 function linkifyTopCallFrame()
489 { 491 {
490 var stackTrace = event.stackTrace; 492 var frame = WebInspector.TimelineUIUtils.topStackFrame(event);
491 if (!stackTrace) { 493 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 } 494 }
500 } 495 }
501 496
502 /** 497 /**
503 * @param {!WebInspector.TracingModel.Event} event 498 * @param {!WebInspector.TracingModel.Event} event
504 * @param {!WebInspector.TimelineModel} model 499 * @param {!WebInspector.TimelineModel} model
505 * @param {!WebInspector.Linkifier} linkifier 500 * @param {!WebInspector.Linkifier} linkifier
506 * @param {boolean} detailed 501 * @param {boolean} detailed
507 * @param {function(!DocumentFragment)} callback 502 * @param {function(!DocumentFragment)} callback
508 */ 503 */
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 case warnings.V8Deopt: 2006 case warnings.V8Deopt:
2012 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", 2007 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53",
2013 WebInspector.UIString("Not optimized"), undefined, true)); 2008 WebInspector.UIString("Not optimized"), undefined, true));
2014 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); 2009 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"]));
2015 break; 2010 break;
2016 default: 2011 default:
2017 console.assert(false, "Unhandled TimelineModel.WarningType"); 2012 console.assert(false, "Unhandled TimelineModel.WarningType");
2018 } 2013 }
2019 return span; 2014 return span;
2020 } 2015 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698