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

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

Issue 572653003: DevTools: correctly close all async records when there are no subsequent top level records (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TracingTimelineModel.js
diff --git a/Source/devtools/front_end/timeline/TracingTimelineModel.js b/Source/devtools/front_end/timeline/TracingTimelineModel.js
index 99a364ef56a6492e321705182a8981d034b54304..e46b3cdd69db291bc50d412f1dc6db9f182be250 100644
--- a/Source/devtools/front_end/timeline/TracingTimelineModel.js
+++ b/Source/devtools/front_end/timeline/TracingTimelineModel.js
@@ -356,6 +356,19 @@ WebInspector.TracingTimelineModel.prototype = {
{
var recordStack = [];
var mainThreadEvents = this.mainThreadEvents();
+
+ /**
+ * @param {!WebInspector.TracingTimelineModel.TraceEventRecord} top
+ */
+ function copyChildrenToNextTop(top) {
caseq 2014/09/15 14:07:41 { => next line
yurys 2014/09/15 14:36:45 Done.
+ var nextTop = recordStack.peekLast();
caseq 2014/09/15 14:07:41 I'd rather pass this one explicitly to reduce surp
yurys 2014/09/15 14:36:45 Done.
+ var parentChildren = nextTop.children();
+ var children = top.children();
+ for (var j = 0; j < children.length; ++j)
+ children[j].parent = nextTop;
+ parentChildren.splice.apply(parentChildren, [parentChildren.indexOf(top), 1].concat(children));
+ }
+
for (var i = 0, size = mainThreadEvents.length; i < size; ++i) {
var event = mainThreadEvents[i];
while (recordStack.length) {
@@ -374,14 +387,9 @@ WebInspector.TracingTimelineModel.prototype = {
}
break;
}
- // Delete incomple async record from parent and adopt its children.
+ // Delete incomplete async record from parent and adopt its children.
recordStack.pop();
- var nextTop = recordStack.peekLast();
- var parentChildren = nextTop.children();
- var children = top.children();
- for (var j = 0; j < children.length; ++j)
- children[j].parent = nextTop;
- parentChildren.splice.apply(parentChildren, [parentChildren.indexOf(top), 1].concat(children));
+ copyChildrenToNextTop(top);
continue;
} else if (top._event.endTime >= event.startTime) {
break;
@@ -403,6 +411,16 @@ WebInspector.TracingTimelineModel.prototype = {
if (event.endTime || (event.phase === WebInspector.TracingModel.Phase.AsyncBegin && parentRecord))
recordStack.push(record);
}
+
+ // Close all remaining incomplete async events.
+ while (recordStack.length > 1) {
+ var top = recordStack.pop();
+ if (!top._event.endTime) {
+ // Delete incomplete async record from parent and adopt its children.
+ copyChildrenToNextTop(top);
+ }
+ }
+
if (recordStack.length)
this._addTopLevelRecord(recordStack[0]);
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698