Commit d002bcf3 authored by timothy@apple.com's avatar timothy@apple.com

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162399 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fd0f9339
2013-10-25 Timothy Hatcher <timothy@apple.com>
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>
Change how the load and content ready event timestamps are tracked.
......
......@@ -23,9 +23,9 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WebInspector.LayoutTimelineRecord = function(eventType, startTime, endTime, callFrames, x, y, width, height, quad)
WebInspector.LayoutTimelineRecord = function(eventType, startTime, endTime, callFrames, sourceCodeLocation, x, y, width, height, quad)
{
WebInspector.TimelineRecord.call(this, WebInspector.TimelineRecord.Type.Layout, startTime, endTime);
WebInspector.TimelineRecord.call(this, WebInspector.TimelineRecord.Type.Layout, startTime, endTime, callFrames, sourceCodeLocation);
console.assert(eventType);
......@@ -33,7 +33,6 @@ WebInspector.LayoutTimelineRecord = function(eventType, startTime, endTime, call
eventType = WebInspector.LayoutTimelineRecord.EventType[eventType];
this._eventType = eventType;
this._callFrames = callFrames || [];
this._x = typeof x === "number" ? x : NaN;
this._y = typeof y === "number" ? y : NaN;
this._width = typeof width === "number" ? width : NaN;
......@@ -75,26 +74,6 @@ WebInspector.LayoutTimelineRecord.prototype = {
return this._eventType;
},
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 x()
{
return this._x;
......
......@@ -23,9 +23,9 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WebInspector.ScriptTimelineRecord = function(eventType, startTime, endTime, details, resource, lineNumber, callFrames)
WebInspector.ScriptTimelineRecord = function(eventType, startTime, endTime, callFrames, sourceCodeLocation, details)
{
WebInspector.TimelineRecord.call(this, WebInspector.TimelineRecord.Type.Script, startTime, endTime);
WebInspector.TimelineRecord.call(this, WebInspector.TimelineRecord.Type.Script, startTime, endTime, callFrames, sourceCodeLocation);
console.assert(eventType);
......@@ -34,9 +34,6 @@ WebInspector.ScriptTimelineRecord = function(eventType, startTime, endTime, deta
this._eventType = eventType;
this._details = details || "";
this._resource = resource || null;
this._lineNumber = lineNumber || NaN;
this._callFrames = callFrames || null;
};
WebInspector.ScriptTimelineRecord.EventType = {
......@@ -79,53 +76,6 @@ WebInspector.ScriptTimelineRecord.prototype = {
get details()
{
return this._details;
},
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;
}
};
......
......@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
WebInspector.TimelineRecord = function(type, startTime, endTime)
WebInspector.TimelineRecord = function(type, startTime, endTime, callFrames, sourceCodeLocation)
{
WebInspector.Object.call(this);
......@@ -35,6 +35,8 @@ WebInspector.TimelineRecord = function(type, startTime, endTime)
this._type = type;
this._startTime = startTime || NaN;
this._endTime = endTime || NaN;
this._callFrames = callFrames || null;
this._sourceCodeLocation = sourceCodeLocation || null;
};
WebInspector.TimelineRecord.Event = {
......@@ -83,6 +85,31 @@ WebInspector.TimelineRecord.prototype = {
{
// Implemented by subclasses if needed.
return this.duration;
},
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;
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment