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

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 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 1f8010cc438a373ec4be7777a8204589ccb43ef8..ff6de53735aeda84d065a0b583f94f3a214e1377 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,31 @@ WebInspector.TimelineUIUtils.isMarkerEvent = function(event)
}
/**
+ * @param {!ConsoleAgent.CallFrame} frame
+ * @return {boolean}
+ */
+WebInspector.TimelineUIUtils.isUserFrame = function(frame)
+{
+ if (frame.url.startsWith("native "))
+ return false;
+ if (!frame.url && frame.scriptId === "0")
+ return false;
+ return true;
+}
+
+/**
+ * @param {!WebInspector.TracingModel.Event} event
+ * @return {?ConsoleAgent.CallFrame}
+ */
+WebInspector.TimelineUIUtils.getTopUserFrame = function(event)
caseq 2016/01/26 01:22:04 no get prefixes please.
alph 2016/01/26 02:04:51 Done.
+{
+ var stackTrace = event.stackTrace;
+ if (!stackTrace && event.initiator)
+ stackTrace = event.initiator.stackTrace;
+ return stackTrace && stackTrace.find(WebInspector.TimelineUIUtils.isUserFrame) || null;
+}
+
+/**
* @enum {symbol}
*/
WebInspector.TimelineUIUtils.NetworkCategory = {
@@ -383,16 +408,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.getTopUserFrame(event);
+ return frame ? linkifyLocationAsText(frame.scriptId, frame.lineNumber, frame.columnNumber) : null;
}
}
@@ -487,15 +504,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.getTopUserFrame(event);
+ return frame ? linkifier.linkifyConsoleCallFrame(target, frame, "timeline-details") : null;
}
}

Powered by Google App Engine
This is Rietveld 408576698