Commit a45c2c7c authored by yurys@chromium.org's avatar yurys@chromium.org

DevTools: loading timeline pretends it is recording w/ 0 events collected.

When loading timeline data from file the progress pane message is set to "Loading from file..."

BUG=426123
R=loislo@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@184980 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a77c041f
...@@ -481,8 +481,18 @@ WebInspector.TimelinePanel.prototype = { ...@@ -481,8 +481,18 @@ WebInspector.TimelinePanel.prototype = {
this._updateToggleTimelineButton(false); this._updateToggleTimelineButton(false);
this._stopRecording(); this._stopRecording();
} }
/**
* @this {!WebInspector.TimelinePanel}
*/
function finishLoading()
{
this._setOperationInProgress(null);
this._updateToggleTimelineButton(false);
this._hideProgressPane();
}
var progressIndicator = new WebInspector.ProgressIndicator(); var progressIndicator = new WebInspector.ProgressIndicator();
progressIndicator.addEventListener(WebInspector.Progress.Events.Done, this._setOperationInProgress.bind(this, null)); progressIndicator.addEventListener(WebInspector.Progress.Events.Done, finishLoading.bind(this));
this._setOperationInProgress(progressIndicator); this._setOperationInProgress(progressIndicator);
return progressIndicator; return progressIndicator;
}, },
...@@ -751,10 +761,16 @@ WebInspector.TimelinePanel.prototype = { ...@@ -751,10 +761,16 @@ WebInspector.TimelinePanel.prototype = {
this._updateSelectionDetails(); this._updateSelectionDetails();
}, },
_onRecordingStarted: function() /**
* @param {!WebInspector.Event} event
*/
_onRecordingStarted: function(event)
{ {
this._updateToggleTimelineButton(true); this._updateToggleTimelineButton(true);
this._updateProgress(WebInspector.UIString("%d events collected", 0)); if (event.data && event.data.fromFile)
this._updateProgress(WebInspector.UIString("Loading from file..."));
else
this._updateProgress(WebInspector.UIString("%d events collected", 0));
}, },
_recordingInProgress: function() _recordingInProgress: function()
......
...@@ -178,7 +178,7 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -178,7 +178,7 @@ WebInspector.TracingTimelineModel.prototype = {
*/ */
setEventsForTest: function(events) setEventsForTest: function(events)
{ {
this._onTracingStarted(); this._startCollectingTraceEvents(false);
this._tracingModel.addEvents(events); this._tracingModel.addEvents(events);
this._onTracingComplete(); this._onTracingComplete();
}, },
...@@ -204,10 +204,18 @@ WebInspector.TracingTimelineModel.prototype = { ...@@ -204,10 +204,18 @@ WebInspector.TracingTimelineModel.prototype = {
}, },
_onTracingStarted: function() _onTracingStarted: function()
{
this._startCollectingTraceEvents(false);
},
/**
* @param {boolean} fromFile
*/
_startCollectingTraceEvents: function(fromFile)
{ {
this.reset(); this.reset();
this._tracingModel.reset(); this._tracingModel.reset();
this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordingStarted); this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordingStarted, { fromFile: fromFile });
}, },
/** /**
...@@ -1046,7 +1054,7 @@ WebInspector.TracingModelLoader.prototype = { ...@@ -1046,7 +1054,7 @@ WebInspector.TracingModelLoader.prototype = {
return; return;
if (this._firstChunk) { if (this._firstChunk) {
this._model._onTracingStarted(); this._model._startCollectingTraceEvents(true);
} else { } else {
var commaIndex = json.indexOf(","); var commaIndex = json.indexOf(",");
if (commaIndex !== -1) if (commaIndex !== -1)
......
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