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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
index cf40c9bd06079fa4d1251a78a6e0c9277a8f3558..93fc5fa2decd4f0c9a7ad381d8a5e139472551f1 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
@@ -216,6 +216,16 @@ WebInspector.TimelineUIUtils.isMarkerEvent = function(event)
}
/**
+ * @param {!WebInspector.TracingModel.Event} event
+ * @return {?ConsoleAgent.CallFrame}
+ */
+WebInspector.TimelineUIUtils.topStackFrame = function(event)
+{
+ var stackTrace = event.stackTrace || event.initiator && event.initiator.stackTrace;
+ return stackTrace && stackTrace.length ? stackTrace[0] : null;
+}
+
+/**
* @enum {symbol}
*/
WebInspector.TimelineUIUtils.NetworkCategory = {
@@ -383,16 +393,8 @@ WebInspector.TimelineUIUtils.buildDetailsTextForTraceEvent = function(event, tar
*/
function linkifyTopCallFrameAsText()
{
- var stackTrace = event.stackTrace;
- if (!stackTrace) {
- var initiator = event.initiator;
- if (initiator)
- stackTrace = initiator.stackTrace;
- }
- if (!stackTrace || !stackTrace.length)
- return null;
- var callFrame = stackTrace[0];
- return linkifyLocationAsText(callFrame.scriptId, callFrame.lineNumber, callFrame.columnNumber);
+ var frame = WebInspector.TimelineUIUtils.topStackFrame(event);
+ return frame ? linkifyLocationAsText(frame.scriptId, frame.lineNumber, frame.columnNumber) : null;
}
}
@@ -487,15 +489,8 @@ WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar
*/
function linkifyTopCallFrame()
{
- var stackTrace = event.stackTrace;
- if (!stackTrace) {
- var initiator = event.initiator;
- if (initiator)
- stackTrace = initiator.stackTrace;
- }
- if (!stackTrace || !stackTrace.length)
- return null;
- return linkifier.linkifyConsoleCallFrame(target, stackTrace[0], "timeline-details");
+ var frame = WebInspector.TimelineUIUtils.topStackFrame(event);
+ return frame ? linkifier.linkifyConsoleCallFrame(target, frame, "timeline-details") : null;
}
}

Powered by Google App Engine
This is Rietveld 408576698