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

Change how the load and content ready event timestamps are tracked.

https://bugs.webkit.org/show_bug.cgi?id=123356

Reviewed by Joseph Pecoraro.

* UserInterface/DashboardManager.js:
(WebInspector.DashboardManager.prototype._updateTime): Use the timestamps on the main frame.
* UserInterface/Frame.js:
(WebInspector.Frame):
(WebInspector.Frame.prototype.get domContentReadyEventTimestamp): Added.
(WebInspector.Frame.prototype.get loadEventTimestamp): Added.
(WebInspector.Frame.prototype.markDOMContentReadyEvent): Added.
(WebInspector.Frame.prototype.markLoadEvent): Added.
* UserInterface/TimelineManager.js:
(WebInspector.TimelineManager.prototype.eventRecorded.processRecord): Use markLoadEvent and markDOMContentReadyEvent.
Do it for all frames, not just the main frame.
(WebInspector.TimelineManager.prototype.pageDidLoad): Call markLoadEvent on the Frame.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162398 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3d837ef6
2013-10-25 Timothy Hatcher <timothy@apple.com>
Change how the load and content ready event timestamps are tracked.
https://bugs.webkit.org/show_bug.cgi?id=123356
Reviewed by Joseph Pecoraro.
* UserInterface/DashboardManager.js:
(WebInspector.DashboardManager.prototype._updateTime): Use the timestamps on the main frame.
* UserInterface/Frame.js:
(WebInspector.Frame):
(WebInspector.Frame.prototype.get domContentReadyEventTimestamp): Added.
(WebInspector.Frame.prototype.get loadEventTimestamp): Added.
(WebInspector.Frame.prototype.markDOMContentReadyEvent): Added.
(WebInspector.Frame.prototype.markLoadEvent): Added.
* UserInterface/TimelineManager.js:
(WebInspector.TimelineManager.prototype.eventRecorded.processRecord): Use markLoadEvent and markDOMContentReadyEvent.
Do it for all frames, not just the main frame.
(WebInspector.TimelineManager.prototype.pageDidLoad): Call markLoadEvent on the Frame.
2013-10-25 Timothy Hatcher <timothy@apple.com>
Remove a lot of the current Timelines code to make room for a new implementation.
......
......@@ -135,16 +135,16 @@ WebInspector.DashboardManager.prototype = {
this._timeIntervalIdentifier = setInterval(this._updateTime.bind(this), this._timeIntervalDelay);
}
var timelineManager = WebInspector.timelineManager;
var mainFrameLoadEventTime = timelineManager.mainFrameLoadEventTime;
var mainFrame = WebInspector.frameResourceManager.mainFrame;
var mainFrameStartTime = mainFrame.mainResource.firstTimestamp;
var mainFrameLoadEventTime = mainFrame.loadEventTimestamp;
if (isNaN(mainFrameLoadEventTime)) {
this._view.time = (Date.now() - this._timelineBaseTime) / 1000;
if (isNaN(mainFrameStartTime) || isNaN(mainFrameLoadEventTime)) {
this._view.time = duration / 1000;
return;
}
var networkRecords = timelineManager.recordsWithType(WebInspector.TimelineRecord.Type.Network);
this._view.time = mainFrameLoadEventTime - networkRecords[0].startTime;
this._view.time = mainFrameLoadEventTime - mainFrameStartTime;
this._stopUpdatingTime();
},
......
......@@ -43,6 +43,9 @@ WebInspector.Frame = function(id, name, securityOrigin, loaderIdentifier, mainRe
this._parentFrame = null;
this._isMainFrame = false;
this._domContentReadyEventTimestamp = NaN;
this._loadEventTimestamp = NaN;
this._executionContextList = new WebInspector.ExecutionContextList;
this.initialize(name, securityOrigin, loaderIdentifier, mainResource);
......@@ -137,6 +140,9 @@ WebInspector.Frame.prototype = {
this._loaderIdentifier = this._provisionalLoaderIdentifier;
this._mainResource = this._provisionalMainResource;
this._domContentReadyEventTimestamp = NaN;
this._loadEventTimestamp = NaN;
if (oldMainResource && this._mainResource !== oldMainResource)
this._disassociateWithResource(oldMainResource);
......@@ -254,6 +260,16 @@ WebInspector.Frame.prototype = {
return this._childFrames;
},
get domContentReadyEventTimestamp()
{
return this._domContentReadyEventTimestamp;
},
get loadEventTimestamp()
{
return this._loadEventTimestamp;
},
isMainFrame: function()
{
return this._isMainFrame;
......@@ -269,6 +285,16 @@ WebInspector.Frame.prototype = {
this._isMainFrame = false;
},
markDOMContentReadyEvent: function(timestamp)
{
this._domContentReadyEventTimestamp = timestamp || NaN;
},
markLoadEvent: function(timestamp)
{
this._loadEventTimestamp = timestamp || NaN;
},
isDetached: function()
{
var frame = this;
......
......@@ -56,11 +56,6 @@ WebInspector.TimelineManager.prototype = {
return this._recording;
},
get mainFrameLoadEventTime()
{
return this._loadEventTime;
},
startRecording: function()
{
if (this._recording)
......@@ -113,13 +108,17 @@ WebInspector.TimelineManager.prototype = {
switch (record.type) {
case TimelineAgent.EventType.MarkLoad:
var mainFrame = WebInspector.frameResourceManager.mainFrame;
console.assert(mainFrame);
console.assert(isNaN(endTime));
if (!mainFrame || record.frameId !== mainFrame.id)
var frame = WebInspector.frameResourceManager.frameForIdentifier(recordPayload.frameId);
console.assert(frame);
if (!frame)
break;
this._loadEventTime = startTime;
frame.markLoadEvent(startTime);
if (!frame.isMainFrame())
break;
var eventMarker = new WebInspector.TimelineEventMarker(startTime, WebInspector.TimelineEventMarker.Type.LoadEvent);
this._eventMarkers.push(eventMarker);
......@@ -128,10 +127,16 @@ WebInspector.TimelineManager.prototype = {
break;
case TimelineAgent.EventType.MarkDOMContent:
var mainFrame = WebInspector.frameResourceManager.mainFrame;
console.assert(mainFrame);
console.assert(isNaN(endTime));
var frame = WebInspector.frameResourceManager.frameForIdentifier(recordPayload.frameId);
console.assert(frame);
if (!frame)
break;
frame.markDOMContentReadyEvent(startTime);
if (!mainFrame || record.frameId !== mainFrame.id)
if (!frame.isMainFrame())
break;
var eventMarker = new WebInspector.TimelineEventMarker(startTime, WebInspector.TimelineEventMarker.Type.DOMContentEvent);
......@@ -278,8 +283,8 @@ WebInspector.TimelineManager.prototype = {
pageDidLoad: function(timestamp)
{
if (isNaN(this._loadEventTime))
this._loadEventTime = timestamp;
if (isNaN(WebInspector.frameResourceManager.mainFrame.loadEventTimestamp))
WebInspector.frameResourceManager.mainFrame.markLoadEvent(timestamp);
},
// Private
......@@ -320,7 +325,7 @@ WebInspector.TimelineManager.prototype = {
// FIXME: Implement.
// Only worry about dead time after the load event.
if (!isNaN(this._loadEventTime))
if (!isNaN(WebInspector.frameResourceManager.mainFrame.loadEventTimestamp))
this._resetAutoRecordingDeadTimeTimeout();
},
......
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