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