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

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 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 {!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.getTopUserFrame = function(event)
caseq 2016/01/26 01:22:04 no get prefixes please.
alph 2016/01/26 02:04:51 Done.
236 {
237 var stackTrace = event.stackTrace;
238 if (!stackTrace && event.initiator)
239 stackTrace = event.initiator.stackTrace;
240 return stackTrace && stackTrace.find(WebInspector.TimelineUIUtils.isUserFram e) || null;
241 }
242
243 /**
219 * @enum {symbol} 244 * @enum {symbol}
220 */ 245 */
221 WebInspector.TimelineUIUtils.NetworkCategory = { 246 WebInspector.TimelineUIUtils.NetworkCategory = {
222 HTML: Symbol("HTML"), 247 HTML: Symbol("HTML"),
223 Script: Symbol("Script"), 248 Script: Symbol("Script"),
224 Style: Symbol("Style"), 249 Style: Symbol("Style"),
225 Media: Symbol("Media"), 250 Media: Symbol("Media"),
226 Other: Symbol("Other") 251 Other: Symbol("Other")
227 } 252 }
228 253
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 return null; 401 return null;
377 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILo cation(rawLocation); 402 var uiLocation = WebInspector.debuggerWorkspaceBinding.rawLocationToUILo cation(rawLocation);
378 return uiLocation.linkText(); 403 return uiLocation.linkText();
379 } 404 }
380 405
381 /** 406 /**
382 * @return {?string} 407 * @return {?string}
383 */ 408 */
384 function linkifyTopCallFrameAsText() 409 function linkifyTopCallFrameAsText()
385 { 410 {
386 var stackTrace = event.stackTrace; 411 var frame = WebInspector.TimelineUIUtils.getTopUserFrame(event);
387 if (!stackTrace) { 412 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 } 413 }
397 } 414 }
398 415
399 /** 416 /**
400 * @param {!WebInspector.TracingModel.Event} event 417 * @param {!WebInspector.TracingModel.Event} event
401 * @param {?WebInspector.Target} target 418 * @param {?WebInspector.Target} target
402 * @param {!WebInspector.Linkifier} linkifier 419 * @param {!WebInspector.Linkifier} linkifier
403 * @return {?Node} 420 * @return {?Node}
404 */ 421 */
405 WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar get, linkifier) 422 WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar get, linkifier)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 if (columnNumber) 497 if (columnNumber)
481 --columnNumber; 498 --columnNumber;
482 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details"); 499 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details");
483 } 500 }
484 501
485 /** 502 /**
486 * @return {?Element} 503 * @return {?Element}
487 */ 504 */
488 function linkifyTopCallFrame() 505 function linkifyTopCallFrame()
489 { 506 {
490 var stackTrace = event.stackTrace; 507 var frame = WebInspector.TimelineUIUtils.getTopUserFrame(event);
491 if (!stackTrace) { 508 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 } 509 }
500 } 510 }
501 511
502 /** 512 /**
503 * @param {!WebInspector.TracingModel.Event} event 513 * @param {!WebInspector.TracingModel.Event} event
504 * @param {!WebInspector.TimelineModel} model 514 * @param {!WebInspector.TimelineModel} model
505 * @param {!WebInspector.Linkifier} linkifier 515 * @param {!WebInspector.Linkifier} linkifier
506 * @param {boolean} detailed 516 * @param {boolean} detailed
507 * @param {function(!DocumentFragment)} callback 517 * @param {function(!DocumentFragment)} callback
508 */ 518 */
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 case warnings.V8Deopt: 2053 case warnings.V8Deopt:
2044 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", 2054 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53",
2045 WebInspector.UIString("Not optimized"), undefined, true)); 2055 WebInspector.UIString("Not optimized"), undefined, true));
2046 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); 2056 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"]));
2047 break; 2057 break;
2048 default: 2058 default:
2049 console.assert(false, "Unhandled TimelineModel.WarningType"); 2059 console.assert(false, "Unhandled TimelineModel.WarningType");
2050 } 2060 }
2051 return span; 2061 return span;
2052 } 2062 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698