Commit 1333b4a5 authored by yurys@chromium.org's avatar yurys@chromium.org

Nuke TimelineAllEventsReceived event

BUG=403684,398785
R=pfeldman@chromium.org

Review URL: https://codereview.chromium.org/476773002

git-svn-id: svn://svn.chromium.org/blink/trunk@180349 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 1d07b16c
......@@ -88,6 +88,7 @@ Timeline 'two' started.
timestamp 2
Running: testRacyStart2
timestamp 0
Timeline 'one' started.
timestamp 1
Timeline 'two' started.
......
......@@ -78,24 +78,38 @@ function startTimeline()
function test()
{
WebInspector.inspectorView.showPanel("timeline");
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, eventRecorded);
var panel = WebInspector.inspectorView.panel("timeline");
panel._model._currentTarget = WebInspector.targetManager.mainTarget();
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded, eventRecorded, this);
InspectorTest.runTestSuite([
function testStartStopTimeline(next)
{
InspectorTest.evaluateInPage("startStopTimeline()", next);
InspectorTest.evaluateInPage("startStopTimeline()");
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStopped, allEventsReceived, this);
function allEventsReceived()
{
panel._model.removeEventListener(WebInspector.TimelineModel.Events.RecordingStopped, allEventsReceived, this);
next();
}
},
function testStartStopMultiple(next)
{
InspectorTest.evaluateInPage("startStopMultiple()", next);
InspectorTest.evaluateInPage("startStopMultiple()");
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStopped, allEventsReceived, this);
function allEventsReceived()
{
panel._model.removeEventListener(WebInspector.TimelineModel.Events.RecordingStopped, allEventsReceived, this);
next();
}
},
function testStartMultipleStopInsideEvals(next)
{
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, finish);
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStopped, finish, this);
InspectorTest.evaluateInPage("startMultiple()", step2);
......@@ -111,7 +125,7 @@ function test()
function finish()
{
WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, finish);
panel._model.removeEventListener(WebInspector.TimelineModel.Events.RecordingStopped, finish, this);
next();
}
},
......@@ -124,7 +138,7 @@ function test()
function testStartFromPanel(next)
{
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStarted, recordingStarted);
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, finish);
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStopped, finish, this);
panel._toggleTimelineButtonClicked();
function recordingStarted()
......@@ -140,14 +154,14 @@ function test()
function finish()
{
WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, finish);
panel._model.removeEventListener(WebInspector.TimelineModel.Events.RecordingStopped, finish, this);
next();
}
},
function testStopFromPanel(next)
{
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, finish);
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStopped, finish, this);
InspectorTest.evaluateInPage("startTimeline()", step2);
......@@ -158,50 +172,50 @@ function test()
function finish()
{
WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, finish);
panel._model.removeEventListener(WebInspector.TimelineModel.Events.RecordingStopped, finish, this);
next();
}
},
},
function testRacyStart(next)
{
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStarted, timelineStarted);
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, finish);
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStarted, timelineStarted);
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStopped, finish, this);
InspectorTest.evaluateInPage("startTimeline()");
panel._toggleTimelineButtonClicked();
function timelineStarted()
{
WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineStarted, timelineStarted);
panel._model.removeEventListener(WebInspector.TimelineModel.Events.RecordingStarted, timelineStarted);
panel._toggleTimelineButtonClicked();
}
function finish()
{
WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, finish);
panel._model.removeEventListener(WebInspector.TimelineModel.Events.RecordingStopped, finish, this);
next();
}
},
function testRacyStart2(next)
{
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStarted, timelineStarted);
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, finish);
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStarted, timelineStarted);
panel._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStopped, finish, this);
panel._toggleTimelineButtonClicked();
InspectorTest.evaluateInPage("startTimeline()");
function timelineStarted()
{
WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineStarted, timelineStarted);
panel._model.removeEventListener(WebInspector.TimelineModel.Events.RecordingStarted, timelineStarted);
// Fool listener order execution.
setTimeout(panel._toggleTimelineButtonClicked.bind(panel));
}
function finish()
{
WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, finish);
panel._model.removeEventListener(WebInspector.TimelineModel.Events.RecordingStopped, finish, this);
next();
}
}
......@@ -211,11 +225,11 @@ function test()
{
function print(record)
{
if (record.type === "TimeStamp")
InspectorTest.addResult(record.data.message);
if (record.type() === "TimeStamp")
InspectorTest.addResult(record.data().message);
for (var i = 0; record.children && i < record.children.length; ++i)
print(record.children[i]);
for (var i = 0; i < record.children().length; ++i)
print(record.children()[i]);
}
print(event.data);
}
......
......@@ -46,7 +46,6 @@ WebInspector.TimelineManager.EventTypes = {
TimelineStarted: "TimelineStarted",
TimelineStopped: "TimelineStopped",
TimelineEventRecorded: "TimelineEventRecorded",
TimelineAllEventsReceived: "TimelineAllEventsReceived",
TimelineProgress: "TimelineProgress"
}
......@@ -139,12 +138,11 @@ WebInspector.TimelineManager.prototype = {
*/
_stopped: function(consoleTimeline, events)
{
this.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStopped, consoleTimeline);
if (events) {
for (var i = 0; i < events.length; ++i)
this._dispatcher.eventRecorded(events[i]);
}
this.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, 0);
var data = {
consoleTimeline: consoleTimeline,
events: events || []
};
this.dispatchEventToListeners(WebInspector.TimelineManager.EventTypes.TimelineStopped, data);
},
_configureCpuProfilerSamplingInterval: function()
......
......@@ -20,7 +20,6 @@ WebInspector.TimelineModelImpl = function()
WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, this._onRecordAdded, this);
WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, WebInspector.TimelineManager.EventTypes.TimelineStarted, this._onStarted, this);
WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, WebInspector.TimelineManager.EventTypes.TimelineStopped, this._onStopped, this);
WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, WebInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, this._onAllEventsReceived, this);
WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, WebInspector.TimelineManager.EventTypes.TimelineProgress, this._onProgress, this);
WebInspector.targetManager.observeTargets(this);
}
......@@ -133,20 +132,16 @@ WebInspector.TimelineModelImpl.prototype = {
// We were buffering events, discard those that got through, the real ones are coming!
this.reset();
this._currentTarget = timelineManager.target();
if (event.data) {
var events = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ (event.data.events);
for (var i = 0; i < events.length; ++i)
this._addRecord(events[i]);
if (event.data.consoleTimeline) {
// Stopped from console.
this._fireRecordingStopped(null, null);
}
},
/**
* @param {!WebInspector.Event} event
*/
_onAllEventsReceived: function(event)
{
var timelineManager = /** @type {!WebInspector.TimelineManager} */ (event.target);
if (timelineManager.target() !== this._currentTarget)
return;
this._collectionEnabled = false;
},
......
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