Commit 64bcba64 authored by alph@chromium.org's avatar alph@chromium.org

DevTools: negative time on network filmstrip when reloading page while loading.

BUG=526826

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

git-svn-id: svn://svn.chromium.org/blink/trunk@201688 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 2fec41d2
......@@ -7,10 +7,12 @@
/**
* @constructor
* @param {!WebInspector.TracingModel} tracingModel
* @param {number=} zeroTime
*/
WebInspector.FilmStripModel = function(tracingModel)
WebInspector.FilmStripModel = function(tracingModel, zeroTime)
{
this._tracingModel = tracingModel;
this._zeroTime = zeroTime || tracingModel.minimumRecordTime();
/** @type {!Array<!WebInspector.FilmStripModel.Frame>} */
this._frames = [];
......@@ -24,15 +26,17 @@ WebInspector.FilmStripModel = function(tracingModel)
var events = mainThread.events();
for (var i = 0; i < events.length; ++i) {
if (!events[i].hasCategory(WebInspector.FilmStripModel._category))
var event = events[i];
if (event.startTime < this._zeroTime)
continue;
if (events[i].name === WebInspector.FilmStripModel.TraceEvents.CaptureFrame) {
var data = events[i].args["data"];
if (!event.hasCategory(WebInspector.FilmStripModel._category))
continue;
if (event.name === WebInspector.FilmStripModel.TraceEvents.CaptureFrame) {
var data = event.args["data"];
if (data)
this._frames.push(WebInspector.FilmStripModel.Frame._fromEvent(this, events[i], this._frames.length));
} else if (events[i].name === WebInspector.FilmStripModel.TraceEvents.Screenshot) {
this._frames.push(WebInspector.FilmStripModel.Frame._fromSnapshot(this, /** @type {!WebInspector.TracingModel.ObjectSnapshot} */ (events[i]), this._frames.length));
this._frames.push(WebInspector.FilmStripModel.Frame._fromEvent(this, event, this._frames.length));
} else if (event.name === WebInspector.FilmStripModel.TraceEvents.Screenshot) {
this._frames.push(WebInspector.FilmStripModel.Frame._fromSnapshot(this, /** @type {!WebInspector.TracingModel.ObjectSnapshot} */ (event), this._frames.length));
}
}
}
......@@ -58,7 +62,7 @@ WebInspector.FilmStripModel.prototype = {
*/
zeroTime: function()
{
return this._tracingModel.minimumRecordTime();
return this._zeroTime;
},
/**
......
......@@ -299,7 +299,7 @@ WebInspector.NetworkPanel.prototype = {
this._filmStripView = new WebInspector.FilmStripView();
this._filmStripView.setMode(WebInspector.FilmStripView.Modes.FrameBased);
this._filmStripView.element.classList.add("network-film-strip");
this._filmStripRecorder = new WebInspector.NetworkPanel.FilmStripRecorder(this._filmStripView);
this._filmStripRecorder = new WebInspector.NetworkPanel.FilmStripRecorder(this._networkLogView.timeCalculator(), this._filmStripView);
this._filmStripView.show(this._searchableView.element, this._searchableView.element.firstElementChild);
this._filmStripView.addEventListener(WebInspector.FilmStripView.Events.FrameSelected, this._onFilmFrameSelected, this);
this._filmStripView.addEventListener(WebInspector.FilmStripView.Events.FrameEnter, this._onFilmFrameEnter, this);
......@@ -670,10 +670,12 @@ WebInspector.NetworkPanelFactory.prototype = {
/**
* @constructor
* @implements {WebInspector.TracingManagerClient}
* @param {!WebInspector.NetworkTimeCalculator} timeCalculator
* @param {!WebInspector.FilmStripView} filmStripView
*/
WebInspector.NetworkPanel.FilmStripRecorder = function(filmStripView)
WebInspector.NetworkPanel.FilmStripRecorder = function(timeCalculator, filmStripView)
{
this._timeCalculator = timeCalculator;
this._filmStripView = filmStripView;
}
......@@ -703,7 +705,7 @@ WebInspector.NetworkPanel.FilmStripRecorder.prototype = {
if (!this._tracingModel)
return;
this._tracingModel.tracingComplete();
this._callback(new WebInspector.FilmStripModel(this._tracingModel));
this._callback(new WebInspector.FilmStripModel(this._tracingModel, this._timeCalculator.minimumBoundary() * 1000));
delete this._callback;
},
......
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