<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[193042] branches/safari-601-branch/Source/WebInspectorUI</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/193042">193042</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2015-12-03 10:34:33 -0800 (Thu, 03 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/187634">r187634</a>. rdar://problem/23221163</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601branchSourceWebInspectorUIChangeLog">branches/safari-601-branch/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceControllersTimelineManagerjs">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceModelsLayoutTimelineRecordjs">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceModelsRenderingFrameTimelineRecordjs">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceModelsScriptTimelineRecordjs">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceModelsTimelineRecordjs">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceViewsRenderingFrameTimelineViewjs">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601branchSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/ChangeLog (193041 => 193042)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/ChangeLog        2015-12-03 18:34:26 UTC (rev 193041)
+++ branches/safari-601-branch/Source/WebInspectorUI/ChangeLog        2015-12-03 18:34:33 UTC (rev 193042)
</span><span class="lines">@@ -1,5 +1,72 @@
</span><span class="cx"> 2015-12-01  Timothy Hatcher  &lt;timothy@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r187634. rdar://problem/23221163
+
+    2015-07-30  Matt Baker  &lt;mattbaker@apple.com&gt;
+
+            Web Inspector: Better share objects generated from timeline events (Records)
+            https://bugs.webkit.org/show_bug.cgi?id=147029
+
+            Reviewed by Brian Burg.
+
+            This patch changes the way TimelineManager processes events, preserving the event hierarchy after
+            converting payloads to TimelineRecord objects by retaining parent-child relationships between records.
+            This eliminates the need for RenderingFrameTimelineRecord objects to create a separate copy of their child
+            records, and provides richer data for the Timelines UI.
+
+            * UserInterface/Controllers/TimelineManager.js:
+            (WebInspector.TimelineManager.prototype.eventRecorded):
+            Track the parent TimelineRecord as child record payloads are unpacked, and create
+            a hierarchy of TimelineRecords that mirrors the original event payload hierarchy.
+            (WebInspector.TimelineManager.prototype._processRecord):
+            RenderingFrameTimelineRecord is now processed like any other event.
+            (WebInspector.TimelineManager.prototype._processNestedRecords): Deleted.
+            Reverted back to a single pass over the incoming timeline event payload.
+
+            * UserInterface/Models/LayoutTimelineRecord.js:
+            (WebInspector.LayoutTimelineRecord):
+            (WebInspector.LayoutTimelineRecord.prototype.get duringComposite): Deleted.
+            Removed duringComposite property and constructor parameter. No longer needed.
+
+            * UserInterface/Models/RenderingFrameTimelineRecord.js:
+            (WebInspector.RenderingFrameTimelineRecord.prototype.get children): Deleted.
+            Removed children property. It now exists on the base class TimelineRecord.
+            Also removed code that was needed to prevent paint time from being added twice.
+
+            * UserInterface/Models/ScriptTimelineRecord.js:
+            (WebInspector.ScriptTimelineRecord.prototype._initializeProfileFromPayload):
+            (WebInspector.ScriptTimelineRecord):
+            Removed workaround added in:
+            &lt;https://webkit.org/b/147025&gt; Web Inspector: REGRESSION (r186218) ScriptTimelineRecord attempts to access null property
+
+            * UserInterface/Models/TimelineRecord.js:
+            (WebInspector.TimelineRecord):
+            (WebInspector.TimelineRecord.prototype.get children):
+            Added children property.
+
+            * UserInterface/Views/RenderingFrameTimelineView.js:
+            (WebInspector.RenderingFrameTimelineView.prototype._processPendingRecords):
+            Now that we preserve the frame's child record hierarchy, we process the entire tree,
+            yielding richer data grid output:
+
+               Frame X
+                  Styles Recalculated
+                     Layout Invalidated
+                  Composite
+                     Paint
+                     Paint
+
+            Compared to the previous output:
+
+               Frame X
+                  Styles Recalculated
+                  Layout Invalidated
+                  Composite
+                  Paint
+                  Paint
+
+2015-12-01  Timothy Hatcher  &lt;timothy@apple.com&gt;
+
</ins><span class="cx">         Merge r187625. rdar://problem/23221163
</span><span class="cx"> 
</span><span class="cx">     2015-07-30  Devin Rousso  &lt;drousso@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceControllersTimelineManagerjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (193041 => 193042)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js        2015-12-03 18:34:26 UTC (rev 193041)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js        2015-12-03 18:34:33 UTC (rev 193042)
</span><span class="lines">@@ -183,35 +183,11 @@
</span><span class="cx">         if (!this._isCapturing)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        var records = this._processNestedRecords(recordPayload);
-        records.forEach(function(currentValue) {
-            this._addRecord(currentValue);
-        }.bind(this));
-    }
-
-    // Protected
-
-    pageDidLoad(timestamp)
-    {
-        // Called from WebInspector.PageObserver.
-
-        if (isNaN(WebInspector.frameResourceManager.mainFrame.loadEventTimestamp))
-            WebInspector.frameResourceManager.mainFrame.markLoadEvent(this.activeRecording.computeElapsedTime(timestamp));
-    }
-
-    // Private
-
-    _processNestedRecords(childRecordPayloads, parentRecordPayload)
-    {
-        // Convert to a single item array if needed.
-        if (!(childRecordPayloads instanceof Array))
-            childRecordPayloads = [childRecordPayloads];
-
</del><span class="cx">         var records = [];
</span><span class="cx"> 
</span><span class="cx">         // Iterate over the records tree using a stack. Doing this recursively has
</span><span class="cx">         // been known to cause a call stack overflow. https://webkit.org/b/79106
</span><del>-        var stack = [{array: childRecordPayloads, parent: parentRecordPayload || null, index: 0}];
</del><ins>+        var stack = [{array: [recordPayload], parent: null, parentRecord: null, index: 0}];
</ins><span class="cx">         while (stack.length) {
</span><span class="cx">             var entry = stack.lastValue;
</span><span class="cx">             var recordPayloads = entry.array;
</span><span class="lines">@@ -219,19 +195,38 @@
</span><span class="cx">             if (entry.index &lt; recordPayloads.length) {
</span><span class="cx">                 var recordPayload = recordPayloads[entry.index];
</span><span class="cx">                 var record = this._processEvent(recordPayload, entry.parent);
</span><del>-                if (record)
</del><ins>+                if (record) {
</ins><span class="cx">                     records.push(record);
</span><ins>+                    if (entry.parentRecord)
+                        entry.parentRecord.children.push(record);
+                }
</ins><span class="cx"> 
</span><span class="cx">                 if (recordPayload.children)
</span><del>-                    stack.push({array: recordPayload.children, parent: recordPayload, index: 0});
</del><ins>+                    stack.push({array: recordPayload.children, parent: recordPayload, parentRecord: record, index: 0});
</ins><span class="cx">                 ++entry.index;
</span><span class="cx">             } else
</span><span class="cx">                 stack.pop();
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        return records;
</del><ins>+        for (var record of records) {
+            if (record.type === WebInspector.RenderingFrameTimelineRecord &amp;&amp; !record.children.length)
+                continue;
+            this._addRecord(record);
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // Protected
+
+    pageDidLoad(timestamp)
+    {
+        // Called from WebInspector.PageObserver.
+
+        if (isNaN(WebInspector.frameResourceManager.mainFrame.loadEventTimestamp))
+            WebInspector.frameResourceManager.mainFrame.markLoadEvent(this.activeRecording.computeElapsedTime(timestamp));
+    }
+
+    // Private
+
</ins><span class="cx">     _processRecord(recordPayload, parentRecordPayload)
</span><span class="cx">     {
</span><span class="cx">         var startTime = this.activeRecording.computeElapsedTime(recordPayload.startTime);
</span><span class="lines">@@ -279,27 +274,19 @@
</span><span class="cx">         case TimelineAgent.EventType.Paint:
</span><span class="cx">             // COMPATIBILITY (iOS 6): Paint records data contained x, y, width, height properties. This became a quad &quot;clip&quot;.
</span><span class="cx">             var quad = recordPayload.data.clip ? new WebInspector.Quad(recordPayload.data.clip) : null;
</span><del>-            var duringComposite = recordPayload.__duringComposite || false;
</del><span class="cx">             if (quad)
</span><del>-                return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, sourceCodeLocation, null, null, quad.width, quad.height, quad, duringComposite);
</del><ins>+                return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, sourceCodeLocation, null, null, quad.width, quad.height, quad);
</ins><span class="cx">             else
</span><del>-                return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, sourceCodeLocation, recordPayload.data.x, recordPayload.data.y, recordPayload.data.width, recordPayload.data.height, null, duringComposite);
</del><ins>+                return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, sourceCodeLocation, recordPayload.data.x, recordPayload.data.y, recordPayload.data.width, recordPayload.data.height);
</ins><span class="cx"> 
</span><span class="cx">         case TimelineAgent.EventType.Composite:
</span><del>-            recordPayload.children.forEach(function(childRecordPayload) {
-                console.assert(childRecordPayload.type === TimelineAgent.EventType.Paint, childRecordPayload.type);
-                childRecordPayload.__duringComposite = true;
-            });
</del><span class="cx">             return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Composite, startTime, endTime, callFrames, sourceCodeLocation);
</span><span class="cx"> 
</span><span class="cx">         case TimelineAgent.EventType.RenderingFrame:
</span><del>-            if (!recordPayload.children)
</del><ins>+            if (!recordPayload.children || !recordPayload.children.length)
</ins><span class="cx">                 return null;
</span><span class="cx"> 
</span><del>-            var children = this._processNestedRecords(recordPayload.children, recordPayload);
-            if (!children.length)
-                return null;
-            return new WebInspector.RenderingFrameTimelineRecord(startTime, endTime, children);
</del><ins>+            return new WebInspector.RenderingFrameTimelineRecord(startTime, endTime);
</ins><span class="cx"> 
</span><span class="cx">         case TimelineAgent.EventType.EvaluateScript:
</span><span class="cx">             if (!sourceCodeLocation) {
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceModelsLayoutTimelineRecordjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js (193041 => 193042)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js        2015-12-03 18:34:26 UTC (rev 193041)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js        2015-12-03 18:34:33 UTC (rev 193042)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> WebInspector.LayoutTimelineRecord = class LayoutTimelineRecord extends WebInspector.TimelineRecord
</span><span class="cx"> {
</span><del>-    constructor(eventType, startTime, endTime, callFrames, sourceCodeLocation, x, y, width, height, quad, duringComposite)
</del><ins>+    constructor(eventType, startTime, endTime, callFrames, sourceCodeLocation, x, y, width, height, quad)
</ins><span class="cx">     {
</span><span class="cx">         super(WebInspector.TimelineRecord.Type.Layout, startTime, endTime, callFrames, sourceCodeLocation);
</span><span class="cx"> 
</span><span class="lines">@@ -40,7 +40,6 @@
</span><span class="cx">         this._width = typeof width === &quot;number&quot; ? width : NaN;
</span><span class="cx">         this._height = typeof height === &quot;number&quot; ? height : NaN;
</span><span class="cx">         this._quad = quad instanceof WebInspector.Quad ? quad : null;
</span><del>-        this._duringComposite = duringComposite || false;
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Static
</span><span class="lines">@@ -109,11 +108,6 @@
</span><span class="cx">         return this._quad;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    get duringComposite()
-    {
-        return this._duringComposite;
-    }
-
</del><span class="cx">     saveIdentityToCookie(cookie)
</span><span class="cx">     {
</span><span class="cx">         super.saveIdentityToCookie(cookie);
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceModelsRenderingFrameTimelineRecordjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js (193041 => 193042)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js        2015-12-03 18:34:26 UTC (rev 193041)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js        2015-12-03 18:34:33 UTC (rev 193042)
</span><span class="lines">@@ -25,11 +25,10 @@
</span><span class="cx"> 
</span><span class="cx"> WebInspector.RenderingFrameTimelineRecord = class RenderingFrameTimelineRecord extends WebInspector.TimelineRecord
</span><span class="cx"> {
</span><del>-    constructor(startTime, endTime, children)
</del><ins>+    constructor(startTime, endTime)
</ins><span class="cx">     {
</span><span class="cx">         super(WebInspector.TimelineRecord.Type.RenderingFrame, startTime, endTime);
</span><span class="cx"> 
</span><del>-        this._children = children || [];
</del><span class="cx">         this._durationByTaskType = new Map;
</span><span class="cx">         this._frameIndex = WebInspector.RenderingFrameTimelineRecord._nextFrameIndex++;
</span><span class="cx">     }
</span><span class="lines">@@ -67,11 +66,6 @@
</span><span class="cx">         return this._frameIndex + 1;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    get children()
-    {
-        return this._children.slice();
-    }
-
</del><span class="cx">     durationForTask(taskType)
</span><span class="cx">     {
</span><span class="cx">         if (this._durationByTaskType.has(taskType))
</span><span class="lines">@@ -96,7 +90,7 @@
</span><span class="cx">         if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Other)
</span><span class="cx">             duration = this._calculateDurationRemainder();
</span><span class="cx">         else {
</span><del>-            duration = this._children.reduce(function(previousValue, currentValue) {
</del><ins>+            duration = this.children.reduce(function(previousValue, currentValue) {
</ins><span class="cx">                 if (!validRecordForTaskType(currentValue))
</span><span class="cx">                     return previousValue;
</span><span class="cx"> 
</span><span class="lines">@@ -109,18 +103,11 @@
</span><span class="cx">             if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Script) {
</span><span class="cx">                 // Layout events synchronously triggered from JavaScript must be subtracted from the total
</span><span class="cx">                 // script time, to prevent the time from being counted twice.
</span><del>-                duration -= this._children.reduce(function(previousValue, currentValue) {
</del><ins>+                duration -= this.children.reduce(function(previousValue, currentValue) {
</ins><span class="cx">                     if (currentValue.type === WebInspector.TimelineRecord.Type.Layout &amp;&amp; (currentValue.sourceCodeLocation || currentValue.callFrames))
</span><span class="cx">                         return previousValue + currentValue.duration;
</span><span class="cx">                     return previousValue;
</span><span class="cx">                 }, 0);
</span><del>-            } else if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Paint) {
-                // Paint events triggered during a Composite event must be subtracted from the total painting time,
-                // since the compositing time already includes time spent in these Paint events.
-                var paintRecords = this._children.filter(function(record) { return record.eventType === WebInspector.LayoutTimelineRecord.EventType.Paint; });
-                duration -= paintRecords.reduce(function(previousValue, currentValue) {
-                    return currentValue.duringComposite ? previousValue + currentValue.duration : previousValue;
-                }, 0);
</del><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceModelsScriptTimelineRecordjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js (193041 => 193042)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js        2015-12-03 18:34:26 UTC (rev 193041)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js        2015-12-03 18:34:33 UTC (rev 193042)
</span><span class="lines">@@ -73,13 +73,6 @@
</span><span class="cx">         if (this._profile || !this._profilePayload)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        // FIXME: &lt;https://webkit.org/b/147029&gt; Web Inspector: Better share objects generated from timeline events (Records)
-        if (this._profilePayload.__profile) {
-            this._profile = this._profilePayload.__profile;
-            this._profilePayload = undefined;
-            return;
-        }
-
</del><span class="cx">         var payload = this._profilePayload;
</span><span class="cx">         this._profilePayload = undefined;
</span><span class="cx"> 
</span><span class="lines">@@ -151,7 +144,7 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        this._profile = payload.__profile = new WebInspector.Profile(rootNodes);
</del><ins>+        this._profile = new WebInspector.Profile(rootNodes);
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceModelsTimelineRecordjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js (193041 => 193042)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js        2015-12-03 18:34:26 UTC (rev 193041)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/TimelineRecord.js        2015-12-03 18:34:33 UTC (rev 193042)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx">         this._endTime = endTime || NaN;
</span><span class="cx">         this._callFrames = callFrames || null;
</span><span class="cx">         this._sourceCodeLocation = sourceCodeLocation || null;
</span><ins>+        this._children = [];
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Public
</span><span class="lines">@@ -121,6 +122,11 @@
</span><span class="cx">         return this._sourceCodeLocation;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    get children()
+    {
+        return this._children;
+    }
+
</ins><span class="cx">     saveIdentityToCookie(cookie)
</span><span class="cx">     {
</span><span class="cx">         cookie[WebInspector.TimelineRecord.SourceCodeURLCookieKey] = this._sourceCodeLocation ? this._sourceCodeLocation.sourceCode.url ? this._sourceCodeLocation.sourceCode.url.hash : null : null;
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceViewsRenderingFrameTimelineViewjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js (193041 => 193042)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js        2015-12-03 18:34:26 UTC (rev 193041)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js        2015-12-03 18:34:33 UTC (rev 193042)
</span><span class="lines">@@ -263,15 +263,23 @@
</span><span class="cx"> 
</span><span class="cx">             var treeElement = new WebInspector.TimelineRecordTreeElement(renderingFrameTimelineRecord);
</span><span class="cx">             var dataGridNode = new WebInspector.RenderingFrameTimelineDataGridNode(renderingFrameTimelineRecord, this.zeroTime);
</span><del>-
</del><span class="cx">             this._dataGrid.addRowInSortOrder(treeElement, dataGridNode);
</span><span class="cx"> 
</span><del>-            for (var childRecord of renderingFrameTimelineRecord.children) {
</del><ins>+            var stack = [{children: renderingFrameTimelineRecord.children, parentTreeElement: treeElement, index: 0}];
+            while (stack.length) {
+                var entry = stack.lastValue;
+                if (entry.index &gt;= entry.children.length) {
+                    stack.pop();
+                    continue;
+                }
+
+                var childRecord = entry.children[entry.index];
+                var childTreeElement = null;
</ins><span class="cx">                 if (childRecord.type === WebInspector.TimelineRecord.Type.Layout) {
</span><del>-                    var layoutTreeElement = new WebInspector.TimelineRecordTreeElement(childRecord, WebInspector.SourceCodeLocation.NameStyle.Short);
</del><ins>+                    childTreeElement = new WebInspector.TimelineRecordTreeElement(childRecord, WebInspector.SourceCodeLocation.NameStyle.Short);
</ins><span class="cx">                     var layoutDataGridNode = new WebInspector.LayoutTimelineDataGridNode(childRecord, this.zeroTime);
</span><span class="cx"> 
</span><del>-                    this._dataGrid.addRowInSortOrder(layoutTreeElement, layoutDataGridNode, treeElement);
</del><ins>+                    this._dataGrid.addRowInSortOrder(childTreeElement, layoutDataGridNode, entry.parentTreeElement);
</ins><span class="cx">                 } else if (childRecord.type === WebInspector.TimelineRecord.Type.Script) {
</span><span class="cx">                     var rootNodes = [];
</span><span class="cx">                     if (childRecord.profile) {
</span><span class="lines">@@ -279,21 +287,21 @@
</span><span class="cx">                         rootNodes = childRecord.profile.topDownRootNodes;
</span><span class="cx">                     }
</span><span class="cx"> 
</span><del>-                    var zeroTime = this.zeroTime;
-                    var scriptTreeElement = new WebInspector.TimelineRecordTreeElement(childRecord, WebInspector.SourceCodeLocation.NameStyle.Short, rootNodes.length);
-                    var scriptDataGridNode = new WebInspector.ScriptTimelineDataGridNode(childRecord, zeroTime);
</del><ins>+                    childTreeElement = new WebInspector.TimelineRecordTreeElement(childRecord, WebInspector.SourceCodeLocation.NameStyle.Short, rootNodes.length);
+                    var scriptDataGridNode = new WebInspector.ScriptTimelineDataGridNode(childRecord, this.zeroTime);
</ins><span class="cx"> 
</span><del>-                    this._dataGrid.addRowInSortOrder(scriptTreeElement, scriptDataGridNode, treeElement);
</del><ins>+                    this._dataGrid.addRowInSortOrder(childTreeElement, scriptDataGridNode, entry.parentTreeElement);
</ins><span class="cx"> 
</span><del>-                    var startTime = this.startTime;
-                    var endTime = this.endTime;
-
</del><span class="cx">                     for (var profileNode of rootNodes) {
</span><span class="cx">                         var profileNodeTreeElement = new WebInspector.ProfileNodeTreeElement(profileNode, this);
</span><del>-                        var profileNodeDataGridNode = new WebInspector.ProfileNodeDataGridNode(profileNode, zeroTime, startTime, endTime);
-                        this._dataGrid.addRowInSortOrder(profileNodeTreeElement, profileNodeDataGridNode, scriptTreeElement);
</del><ins>+                        var profileNodeDataGridNode = new WebInspector.ProfileNodeDataGridNode(profileNode, this.zeroTime, this.startTime, this.endTime);
+                        this._dataGrid.addRowInSortOrder(profileNodeTreeElement, profileNodeDataGridNode, childTreeElement);
</ins><span class="cx">                     }
</span><span class="cx">                 }
</span><ins>+
+                if (childTreeElement &amp;&amp; childRecord.children.length)
+                    stack.push({children: childRecord.children, parentTreeElement: childTreeElement, index: 0});
+                ++entry.index;
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>