Commit 5de12507 authored by caseq@chromium.org's avatar caseq@chromium.org

Timeline: fix reset logic of TracingTimelineModel & co

The way we perform reset (i.e. clear records) was
badly wrong in a couple of places:
 - we generally should only reset the objects that we own,
so TimelineTracingView should have not tried to reset TracingModel;
 - TracingTimelineModel should reset before the record is
started,not after.

BUG=361045

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175810 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent bba7e6f4
...@@ -709,6 +709,8 @@ WebInspector.TimelinePanel.prototype = { ...@@ -709,6 +709,8 @@ WebInspector.TimelinePanel.prototype = {
_onClearButtonClick: function() _onClearButtonClick: function()
{ {
if (this._tracingModel)
this._tracingModel.reset();
this._model.reset(); this._model.reset();
}, },
......
...@@ -55,7 +55,6 @@ WebInspector.TimelineTracingView.prototype = { ...@@ -55,7 +55,6 @@ WebInspector.TimelineTracingView.prototype = {
reset: function() reset: function()
{ {
this._tracingModel.reset();
this._dataProvider.reset(); this._dataProvider.reset();
this._mainView.setWindowTimes(0, Infinity); this._mainView.setWindowTimes(0, Infinity);
}, },
......
...@@ -101,6 +101,7 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -101,6 +101,7 @@ WebInspector.TracingTimelineModel.prototype = {
*/ */
startRecording: function(captureStacks, captureMemory) startRecording: function(captureStacks, captureMemory)
{ {
this.reset();
var categories; var categories;
if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) {
categories = WebInspector.TracingTimelineModel.defaultTracingCategoryFilter; categories = WebInspector.TracingTimelineModel.defaultTracingCategoryFilter;
...@@ -124,6 +125,7 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -124,6 +125,7 @@ WebInspector.TracingTimelineModel.prototype = {
*/ */
setEventsForTest: function(sessionId, events) setEventsForTest: function(sessionId, events)
{ {
this.reset();
this._didStartRecordingTraceEvents(); this._didStartRecordingTraceEvents();
this._tracingModel.setEventsForTest(sessionId, events); this._tracingModel.setEventsForTest(sessionId, events);
this._didStopRecordingTraceEvents(); this._didStopRecordingTraceEvents();
...@@ -139,7 +141,6 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -139,7 +141,6 @@ WebInspector.TracingTimelineModel.prototype = {
_didStartRecordingTraceEvents: function() _didStartRecordingTraceEvents: function()
{ {
this.reset();
this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordingStarted); this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordingStarted);
}, },
......
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