<!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>[162399] trunk/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/162399">162399</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2014-01-20 18:53:44 -0800 (Mon, 20 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Track callFrames and sourceCodeLocation per TimelineRecord.
https://bugs.webkit.org/show_bug.cgi?id=123359
Reviewed by Joseph Pecoraro.
* UserInterface/LayoutTimelineRecord.js:
(WebInspector.LayoutTimelineRecord): Pass callFrames and sourceCodeLocation to superclass.
* UserInterface/ScriptTimelineRecord.js:
(WebInspector.ScriptTimelineRecord): Pass callFrames and sourceCodeLocation to superclass.
* UserInterface/TimelineManager.js:
(WebInspector.TimelineManager.prototype.eventRecorded.processRecord): Add "Payload" suffix to better track what is a protocol object.
Pass the callFrames and sourceCodeLocation to all the new TimelineRecords.
(WebInspector.TimelineManager.prototype.eventRecorded): Add "Payload" suffix.
* UserInterface/TimelineRecord.js:
(WebInspector.TimelineRecord):
(WebInspector.TimelineRecord.prototype.get callFrames): Added.
(WebInspector.TimelineRecord.prototype.get initiatorCallFrame): Added.
(WebInspector.TimelineRecord.prototype.get sourceCodeLocation): Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceLayoutTimelineRecordjs">trunk/Source/WebInspectorUI/UserInterface/LayoutTimelineRecord.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceScriptTimelineRecordjs">trunk/Source/WebInspectorUI/UserInterface/ScriptTimelineRecord.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineManagerjs">trunk/Source/WebInspectorUI/UserInterface/TimelineManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTimelineRecordjs">trunk/Source/WebInspectorUI/UserInterface/TimelineRecord.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (162398 => 162399)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2014-01-21 02:53:38 UTC (rev 162398)
+++ trunk/Source/WebInspectorUI/ChangeLog        2014-01-21 02:53:44 UTC (rev 162399)
</span><span class="lines">@@ -1,5 +1,27 @@
</span><span class="cx"> 2013-10-25 Timothy Hatcher <timothy@apple.com>
</span><span class="cx">
</span><ins>+ Track callFrames and sourceCodeLocation per TimelineRecord.
+
+ https://bugs.webkit.org/show_bug.cgi?id=123359
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/LayoutTimelineRecord.js:
+ (WebInspector.LayoutTimelineRecord): Pass callFrames and sourceCodeLocation to superclass.
+ * UserInterface/ScriptTimelineRecord.js:
+ (WebInspector.ScriptTimelineRecord): Pass callFrames and sourceCodeLocation to superclass.
+ * UserInterface/TimelineManager.js:
+ (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): Add "Payload" suffix to better track what is a protocol object.
+ Pass the callFrames and sourceCodeLocation to all the new TimelineRecords.
+ (WebInspector.TimelineManager.prototype.eventRecorded): Add "Payload" suffix.
+ * UserInterface/TimelineRecord.js:
+ (WebInspector.TimelineRecord):
+ (WebInspector.TimelineRecord.prototype.get callFrames): Added.
+ (WebInspector.TimelineRecord.prototype.get initiatorCallFrame): Added.
+ (WebInspector.TimelineRecord.prototype.get sourceCodeLocation): Added.
+
+2013-10-25 Timothy Hatcher <timothy@apple.com>
+
</ins><span class="cx"> Change how the load and content ready event timestamps are tracked.
</span><span class="cx">
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=123356
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceLayoutTimelineRecordjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/LayoutTimelineRecord.js (162398 => 162399)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/LayoutTimelineRecord.js        2014-01-21 02:53:38 UTC (rev 162398)
+++ trunk/Source/WebInspectorUI/UserInterface/LayoutTimelineRecord.js        2014-01-21 02:53:44 UTC (rev 162399)
</span><span class="lines">@@ -23,9 +23,9 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.LayoutTimelineRecord = function(eventType, startTime, endTime, callFrames, x, y, width, height, quad)
</del><ins>+WebInspector.LayoutTimelineRecord = function(eventType, startTime, endTime, callFrames, sourceCodeLocation, x, y, width, height, quad)
</ins><span class="cx"> {
</span><del>- WebInspector.TimelineRecord.call(this, WebInspector.TimelineRecord.Type.Layout, startTime, endTime);
</del><ins>+ WebInspector.TimelineRecord.call(this, WebInspector.TimelineRecord.Type.Layout, startTime, endTime, callFrames, sourceCodeLocation);
</ins><span class="cx">
</span><span class="cx"> console.assert(eventType);
</span><span class="cx">
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> eventType = WebInspector.LayoutTimelineRecord.EventType[eventType];
</span><span class="cx">
</span><span class="cx"> this._eventType = eventType;
</span><del>- this._callFrames = callFrames || [];
</del><span class="cx"> this._x = typeof x === "number" ? x : NaN;
</span><span class="cx"> this._y = typeof y === "number" ? y : NaN;
</span><span class="cx"> this._width = typeof width === "number" ? width : NaN;
</span><span class="lines">@@ -75,26 +74,6 @@
</span><span class="cx"> return this._eventType;
</span><span class="cx"> },
</span><span class="cx">
</span><del>- get callFrames()
- {
- return this._callFrames;
- },
-
- get initiatorCallFrame()
- {
- if (!this._callFrames || !this._callFrames.length)
- return null;
-
- // Return the first non-native code call frame as the initiator.
- for (var i = 0; i < this._callFrames.length; ++i) {
- if (this._callFrames[i].nativeCode)
- continue;
- return this._callFrames[i];
- }
-
- return null;
- },
-
</del><span class="cx"> get x()
</span><span class="cx"> {
</span><span class="cx"> return this._x;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceScriptTimelineRecordjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/ScriptTimelineRecord.js (162398 => 162399)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/ScriptTimelineRecord.js        2014-01-21 02:53:38 UTC (rev 162398)
+++ trunk/Source/WebInspectorUI/UserInterface/ScriptTimelineRecord.js        2014-01-21 02:53:44 UTC (rev 162399)
</span><span class="lines">@@ -23,9 +23,9 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.ScriptTimelineRecord = function(eventType, startTime, endTime, details, resource, lineNumber, callFrames)
</del><ins>+WebInspector.ScriptTimelineRecord = function(eventType, startTime, endTime, callFrames, sourceCodeLocation, details)
</ins><span class="cx"> {
</span><del>- WebInspector.TimelineRecord.call(this, WebInspector.TimelineRecord.Type.Script, startTime, endTime);
</del><ins>+ WebInspector.TimelineRecord.call(this, WebInspector.TimelineRecord.Type.Script, startTime, endTime, callFrames, sourceCodeLocation);
</ins><span class="cx">
</span><span class="cx"> console.assert(eventType);
</span><span class="cx">
</span><span class="lines">@@ -34,9 +34,6 @@
</span><span class="cx">
</span><span class="cx"> this._eventType = eventType;
</span><span class="cx"> this._details = details || "";
</span><del>- this._resource = resource || null;
- this._lineNumber = lineNumber || NaN;
- this._callFrames = callFrames || null;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.ScriptTimelineRecord.EventType = {
</span><span class="lines">@@ -79,53 +76,6 @@
</span><span class="cx"> get details()
</span><span class="cx"> {
</span><span class="cx"> return this._details;
</span><del>- },
-
- get resource()
- {
- return this._resource;
- },
-
- get lineNumber()
- {
- return this._lineNumber;
- },
-
- get callFrames()
- {
- return this._callFrames;
- },
-
- get sourceCodeLocation()
- {
- if ("_sourceCodeLocation" in this)
- return this._sourceCodeLocation;
-
- if (!this._resource) {
- this._sourceCodeLocation = null;
- return this._sourceCodeLocation;
- }
-
- // FIXME: Script Timeline Events with a location should always contain a call stack
- // or a complete (url:line:column) triplet.
-
- if (this._callFrames) {
- for (var i = 0; i < this._callFrames.length; ++i) {
- var callFrame = this._callFrames[i];
- if (callFrame.nativeCode)
- continue;
-
- if (!callFrame.sourceCodeLocation)
- break;
-
- this._sourceCodeLocation = callFrame.sourceCodeLocation;
- return this._sourceCodeLocation;
- }
- }
-
- var lineNumber = isNaN(this._lineNumber) ? 0 : this._lineNumber;
- this._sourceCodeLocation = this._resource.createSourceCodeLocation(lineNumber, 0);
- return this._sourceCodeLocation;
</del><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineManager.js (162398 => 162399)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineManager.js        2014-01-21 02:53:38 UTC (rev 162398)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineManager.js        2014-01-21 02:53:44 UTC (rev 162399)
</span><span class="lines">@@ -91,22 +91,34 @@
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.TimelineManager.Event.RecordingStopped);
</span><span class="cx"> },
</span><span class="cx">
</span><del>- eventRecorded: function(originalRecord)
</del><ins>+ eventRecorded: function(originalRecordPayload)
</ins><span class="cx"> {
</span><span class="cx"> // Called from WebInspector.TimelineObserver.
</span><span class="cx">
</span><span class="cx"> if (!this._recording)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- function processRecord(record, parentRecord)
</del><ins>+ function processRecord(recordPayload, parentRecordPayload)
</ins><span class="cx"> {
</span><span class="cx"> // Convert the timestamps to seconds to match the resource timestamps.
</span><del>- var startTime = record.startTime / 1000;
- var endTime = record.endTime / 1000;
</del><ins>+ var startTime = recordPayload.startTime / 1000;
+ var endTime = recordPayload.endTime / 1000;
</ins><span class="cx">
</span><del>- var callFrames = this._callFramesFromPayload(record.stackTrace);
</del><ins>+ var callFrames = this._callFramesFromPayload(recordPayload.stackTrace);
</ins><span class="cx">
</span><del>- switch (record.type) {
</del><ins>+ var significantCallFrame = null;
+ if (callFrames) {
+ for (var i = 0; i < callFrames.length; ++i) {
+ if (callFrames[i].nativeCode)
+ continue;
+ significantCallFrame = callFrames[i];
+ break;
+ }
+ }
+
+ var sourceCodeLocation = significantCallFrame && significantCallFrame.sourceCodeLocation;
+
+ switch (recordPayload.type) {
</ins><span class="cx"> case TimelineAgent.EventType.MarkLoad:
</span><span class="cx"> console.assert(isNaN(endTime));
</span><span class="cx">
</span><span class="lines">@@ -146,50 +158,58 @@
</span><span class="cx">
</span><span class="cx"> case TimelineAgent.EventType.ScheduleStyleRecalculation:
</span><span class="cx"> console.assert(isNaN(endTime));
</span><ins>+
</ins><span class="cx"> // Pass the startTime as the endTime since this record type has no duration.
</span><del>- this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles, startTime, startTime, callFrames));
</del><ins>+ this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles, startTime, startTime, callFrames, sourceCodeLocation));
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case TimelineAgent.EventType.RecalculateStyles:
</span><del>- this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles, startTime, endTime, callFrames));
</del><ins>+ this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles, startTime, endTime, callFrames, sourceCodeLocation));
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case TimelineAgent.EventType.InvalidateLayout:
</span><span class="cx"> console.assert(isNaN(endTime));
</span><ins>+
</ins><span class="cx"> // Pass the startTime as the endTime since this record type has no duration.
</span><del>- this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout, startTime, startTime, callFrames));
</del><ins>+ this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout, startTime, startTime, callFrames, sourceCodeLocation));
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> case TimelineAgent.EventType.Layout:
</span><span class="cx"> // COMPATIBILITY (iOS 6): Layout records did not contain area properties. This is not exposed via a quad "root".
</span><del>- var quad = record.data.root ? new WebInspector.Quad(record.data.root) : null;
</del><ins>+ var quad = recordPayload.data.root ? new WebInspector.Quad(recordPayload.data.root) : null;
</ins><span class="cx"> if (quad)
</span><del>- this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Layout, startTime, endTime, callFrames, quad.points[0].x, quad.points[0].y, quad.width, quad.height, quad));
</del><ins>+ this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Layout, startTime, endTime, callFrames, sourceCodeLocation, quad.points[0].x, quad.points[0].y, quad.width, quad.height, quad));
</ins><span class="cx"> else
</span><del>- this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Layout, startTime, endTime, callFrames));
</del><ins>+ this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Layout, startTime, endTime, callFrames, sourceCodeLocation));
</ins><span class="cx"> break;
</span><span class="cx">
</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 "clip".
</span><del>- var quad = record.data.clip ? new WebInspector.Quad(record.data.clip) : null;
</del><ins>+ var quad = recordPayload.data.clip ? new WebInspector.Quad(recordPayload.data.clip) : null;
</ins><span class="cx"> if (quad)
</span><del>- this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, null, null, quad.width, quad.height, quad));
</del><ins>+ this._addRecord(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>- this._addRecord(new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, record.data.x, record.data.y, record.data.width, record.data.height));
</del><ins>+ this._addRecord(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"> break;
</span><span class="cx">
</span><span class="cx"> case TimelineAgent.EventType.EvaluateScript:
</span><del>- var resource = WebInspector.frameResourceManager.resourceForURL(record.data.url);
</del><ins>+ if (!sourceCodeLocation) {
+ var mainFrame = WebInspector.frameResourceManager.mainFrame;
+ var scriptResource = mainFrame.url === recordPayload.data.url ? mainFrame.mainResource : mainFrame.resourceForURL(recordPayload.data.url, true);
+ if (scriptResource) {
+ // The lineNumber is 1-based, but we expect 0-based.
+ var lineNumber = recordPayload.data.lineNumber - 1;
</ins><span class="cx">
</span><del>- // The lineNumber is 1-based, but we expect 0-based.
- var lineNumber = record.data.lineNumber - 1;
</del><ins>+ sourceCodeLocation = scriptResource.createSourceCodeLocation(lineNumber, 0);
+ }
+ }
</ins><span class="cx">
</span><del>- switch (parent ? parent.type : null) {
</del><ins>+ switch (parentRecordPayload && parentRecordPayload.type) {
</ins><span class="cx"> case TimelineAgent.EventType.TimerFire:
</span><del>- this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerFired, startTime, endTime, parent.data.timerId, resource, lineNumber, callFrames));
</del><ins>+ this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.timerId));
</ins><span class="cx"> break;
</span><span class="cx"> default:
</span><del>- this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated, startTime, endTime, null, resource, lineNumber, callFrames));
</del><ins>+ this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated, startTime, endTime, callFrames, sourceCodeLocation, null));
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -204,29 +224,24 @@
</span><span class="cx"> case TimelineAgent.EventType.FunctionCall:
</span><span class="cx"> // FunctionCall always happens as a child of another record, and since the FunctionCall record
</span><span class="cx"> // has useful info we just make the timeline record here (combining the data from both records).
</span><del>- if (!parent)
</del><ins>+ if (!parentRecordPayload)
</ins><span class="cx"> break;
</span><span class="cx">
</span><del>- var resource = WebInspector.frameResourceManager.resourceForURL(record.data.scriptName);
-
- // The scriptLine is 1-based, but we expect 0-based.
- var lineNumber = record.data.scriptLine - 1;
-
- switch (parent.type) {
</del><ins>+ switch (parentRecordPayload.type) {
</ins><span class="cx"> case TimelineAgent.EventType.TimerFire:
</span><del>- this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerFired, startTime, endTime, parent.data.timerId, resource, lineNumber, callFrames));
</del><ins>+ this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.timerId));
</ins><span class="cx"> break;
</span><span class="cx"> case TimelineAgent.EventType.EventDispatch:
</span><del>- this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, parent.data.type, resource, lineNumber, callFrames));
</del><ins>+ this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.type));
</ins><span class="cx"> break;
</span><span class="cx"> case TimelineAgent.EventType.XHRLoad:
</span><del>- this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, "load", resource, lineNumber, callFrames));
</del><ins>+ this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, callFrames, sourceCodeLocation, "load"));
</ins><span class="cx"> break;
</span><span class="cx"> case TimelineAgent.EventType.XHRReadyStateChange:
</span><del>- this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, "readystatechange", resource, lineNumber, callFrames));
</del><ins>+ this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, callFrames, sourceCodeLocation, "readystatechange"));
</ins><span class="cx"> break;
</span><span class="cx"> case TimelineAgent.EventType.FireAnimationFrame:
</span><del>- this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired, startTime, endTime, parent.data.id, resource, lineNumber, callFrames));
</del><ins>+ this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.id));
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -234,47 +249,30 @@
</span><span class="cx">
</span><span class="cx"> case TimelineAgent.EventType.TimerInstall:
</span><span class="cx"> case TimelineAgent.EventType.TimerRemove:
</span><del>- // COMPATIBILITY (iOS 6): TimerInstall and TimerRemove did not have a stack trace.
- var callFrame = null;
- if (callFrames) {
- for (var i = 0; i < callFrames.length; ++i) {
- if (callFrames[i].nativeCode)
- continue;
- callFrame = callFrames[i];
- break;
- }
- }
-
- var sourceCodeLocation = callFrame && callFrame.sourceCodeLocation;
- var resource = sourceCodeLocation ? sourceCodeLocation.sourceCode : null;
- var lineNumber = sourceCodeLocation ? sourceCodeLocation.lineNumber : null;
-
- if (record.type === TimelineAgent.EventType.TimerInstall)
- this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerInstalled, startTime, endTime, record.data.timerId, resource, lineNumber, callFrames));
</del><ins>+ if (recordPayload.type === TimelineAgent.EventType.TimerInstall)
+ this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerInstalled, startTime, endTime, callFrames, sourceCodeLocation, recordPayload.data.timerId));
</ins><span class="cx"> else
</span><del>- this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerRemoved, startTime, endTime, record.data.timerId, resource, lineNumber, callFrames));
</del><ins>+ this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerRemoved, startTime, endTime, callFrames, sourceCodeLocation, recordPayload.data.timerId));
</ins><span class="cx">
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>-
- return null;
</del><span class="cx"> }
</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: [originalRecord], parent: null, index: 0}];
</del><ins>+ var stack = [{array: [originalRecordPayload], parent: null, index: 0}];
</ins><span class="cx"> while (stack.length) {
</span><span class="cx"> var entry = stack.lastValue;
</span><del>- var records = entry.array;
- var parent = entry.parent;
</del><ins>+ var recordPayloads = entry.array;
+ var parentRecordPayload = entry.parent;
</ins><span class="cx">
</span><del>- if (entry.index < records.length) {
- var record = records[entry.index];
</del><ins>+ if (entry.index < recordPayloads.length) {
+ var recordPayload = recordPayloads[entry.index];
</ins><span class="cx">
</span><del>- processRecord.call(this, record, parent);
</del><ins>+ processRecord.call(this, recordPayload, parentRecordPayload);
</ins><span class="cx">
</span><del>- if (record.children)
- stack.push({array: record.children, parent: record, index: 0});
</del><ins>+ if (recordPayload.children)
+ stack.push({array: recordPayload.children, parent: recordPayload, index: 0});
</ins><span class="cx"> ++entry.index;
</span><span class="cx"> } else
</span><span class="cx"> stack.pop();
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTimelineRecordjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineRecord.js (162398 => 162399)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/TimelineRecord.js        2014-01-21 02:53:38 UTC (rev 162398)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineRecord.js        2014-01-21 02:53:44 UTC (rev 162399)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.TimelineRecord = function(type, startTime, endTime)
</del><ins>+WebInspector.TimelineRecord = function(type, startTime, endTime, callFrames, sourceCodeLocation)
</ins><span class="cx"> {
</span><span class="cx"> WebInspector.Object.call(this);
</span><span class="cx">
</span><span class="lines">@@ -35,6 +35,8 @@
</span><span class="cx"> this._type = type;
</span><span class="cx"> this._startTime = startTime || NaN;
</span><span class="cx"> this._endTime = endTime || NaN;
</span><ins>+ this._callFrames = callFrames || null;
+ this._sourceCodeLocation = sourceCodeLocation || null;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.TimelineRecord.Event = {
</span><span class="lines">@@ -83,6 +85,31 @@
</span><span class="cx"> {
</span><span class="cx"> // Implemented by subclasses if needed.
</span><span class="cx"> return this.duration;
</span><ins>+ },
+
+ get callFrames()
+ {
+ return this._callFrames;
+ },
+
+ get initiatorCallFrame()
+ {
+ if (!this._callFrames || !this._callFrames.length)
+ return null;
+
+ // Return the first non-native code call frame as the initiator.
+ for (var i = 0; i < this._callFrames.length; ++i) {
+ if (this._callFrames[i].nativeCode)
+ continue;
+ return this._callFrames[i];
+ }
+
+ return null;
+ },
+
+ get sourceCodeLocation()
+ {
+ return this._sourceCodeLocation;
</ins><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>