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

Unified Diff: Source/devtools/front_end/timeline/TimelineFlameChart.js

Issue 431273005: DevTools: Collect JS samples when recording timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaseline Created 6 years, 4 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: Source/devtools/front_end/timeline/TimelineFlameChart.js
diff --git a/Source/devtools/front_end/timeline/TimelineFlameChart.js b/Source/devtools/front_end/timeline/TimelineFlameChart.js
index 2a6572740951905febfcdda1de9cc9648e5e7a92..dd78e3b1b43b9327428b029bed86c500a263d9a9 100644
--- a/Source/devtools/front_end/timeline/TimelineFlameChart.js
+++ b/Source/devtools/front_end/timeline/TimelineFlameChart.js
@@ -237,12 +237,30 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
{
return e.endTime || e.startTime + WebInspector.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs;
}
+ function isJSInvocationEvent(e)
+ {
+ switch (e.name) {
+ case WebInspector.TracingTimelineModel.RecordType.FunctionCall:
+ case WebInspector.TracingTimelineModel.RecordType.EvaluateScript:
+ return true;
+ }
+ return false;
+ }
var jsFrameEvents = [];
var stackTraceOpenEvents = [];
+ var currentJSInvocationEndTime = 0;
var coalesceThresholdMs = WebInspector.TimelineFlameChartDataProvider.JSFrameCoalsceThresholdMs;
for (var i = 0; i < events.length; ++i) {
var e = events[i];
- if (!e.stackTrace || !this._isVisible(e))
+ if (e.startTime >= currentJSInvocationEndTime) {
+ stackTraceOpenEvents.length = 0;
+ currentJSInvocationEndTime = 0;
+ }
+ if (isJSInvocationEvent(e))
+ currentJSInvocationEndTime = e.endTime;
+ if (!currentJSInvocationEndTime)
+ continue;
+ if (!e.stackTrace)
continue;
while (stackTraceOpenEvents.length && eventEndTime(stackTraceOpenEvents.peekLast()) + coalesceThresholdMs <= e.startTime)
stackTraceOpenEvents.pop();
« no previous file with comments | « Source/devtools/front_end/sdk/CPUProfileDataModel.js ('k') | Source/devtools/front_end/timeline/TimelineJSProfile.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698