Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: Source/devtools/front_end/components_lazy/FilmStripModel.js

Issue 1326053002: DevTools: negative time on network filmstrip when reloading page while loading. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/devtools/front_end/network/NetworkPanel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The Chromium Authors. All rights reserved. 2 * Copyright 2015 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * @constructor 8 * @constructor
9 * @param {!WebInspector.TracingModel} tracingModel 9 * @param {!WebInspector.TracingModel} tracingModel
10 * @param {number=} zeroTime
10 */ 11 */
11 WebInspector.FilmStripModel = function(tracingModel) 12 WebInspector.FilmStripModel = function(tracingModel, zeroTime)
12 { 13 {
13 this._tracingModel = tracingModel; 14 this._tracingModel = tracingModel;
15 this._zeroTime = zeroTime || tracingModel.minimumRecordTime();
14 16
15 /** @type {!Array<!WebInspector.FilmStripModel.Frame>} */ 17 /** @type {!Array<!WebInspector.FilmStripModel.Frame>} */
16 this._frames = []; 18 this._frames = [];
17 19
18 var browserProcess = tracingModel.processByName("Browser"); 20 var browserProcess = tracingModel.processByName("Browser");
19 if (!browserProcess) 21 if (!browserProcess)
20 return; 22 return;
21 var mainThread = browserProcess.threadByName("CrBrowserMain"); 23 var mainThread = browserProcess.threadByName("CrBrowserMain");
22 if (!mainThread) 24 if (!mainThread)
23 return; 25 return;
24 26
25 var events = mainThread.events(); 27 var events = mainThread.events();
26 for (var i = 0; i < events.length; ++i) { 28 for (var i = 0; i < events.length; ++i) {
27 if (!events[i].hasCategory(WebInspector.FilmStripModel._category)) 29 var event = events[i];
30 if (event.startTime < this._zeroTime)
28 continue; 31 continue;
29 32 if (!event.hasCategory(WebInspector.FilmStripModel._category))
30 if (events[i].name === WebInspector.FilmStripModel.TraceEvents.CaptureFr ame) { 33 continue;
31 var data = events[i].args["data"]; 34 if (event.name === WebInspector.FilmStripModel.TraceEvents.CaptureFrame) {
35 var data = event.args["data"];
32 if (data) 36 if (data)
33 this._frames.push(WebInspector.FilmStripModel.Frame._fromEvent(t his, events[i], this._frames.length)); 37 this._frames.push(WebInspector.FilmStripModel.Frame._fromEvent(t his, event, this._frames.length));
34 } else if (events[i].name === WebInspector.FilmStripModel.TraceEvents.Sc reenshot) { 38 } else if (event.name === WebInspector.FilmStripModel.TraceEvents.Screen shot) {
35 this._frames.push(WebInspector.FilmStripModel.Frame._fromSnapshot(th is, /** @type {!WebInspector.TracingModel.ObjectSnapshot} */ (events[i]), this._ frames.length)); 39 this._frames.push(WebInspector.FilmStripModel.Frame._fromSnapshot(th is, /** @type {!WebInspector.TracingModel.ObjectSnapshot} */ (event), this._fram es.length));
36 } 40 }
37 } 41 }
38 } 42 }
39 43
40 WebInspector.FilmStripModel._category = "disabled-by-default-devtools.screenshot "; 44 WebInspector.FilmStripModel._category = "disabled-by-default-devtools.screenshot ";
41 45
42 WebInspector.FilmStripModel.TraceEvents = { 46 WebInspector.FilmStripModel.TraceEvents = {
43 CaptureFrame: "CaptureFrame", 47 CaptureFrame: "CaptureFrame",
44 Screenshot: "Screenshot" 48 Screenshot: "Screenshot"
45 } 49 }
46 50
47 WebInspector.FilmStripModel.prototype = { 51 WebInspector.FilmStripModel.prototype = {
48 /** 52 /**
49 * @return {!Array<!WebInspector.FilmStripModel.Frame>} 53 * @return {!Array<!WebInspector.FilmStripModel.Frame>}
50 */ 54 */
51 frames: function() 55 frames: function()
52 { 56 {
53 return this._frames; 57 return this._frames;
54 }, 58 },
55 59
56 /** 60 /**
57 * @return {number} 61 * @return {number}
58 */ 62 */
59 zeroTime: function() 63 zeroTime: function()
60 { 64 {
61 return this._tracingModel.minimumRecordTime(); 65 return this._zeroTime;
62 }, 66 },
63 67
64 /** 68 /**
65 * @param {number} timestamp 69 * @param {number} timestamp
66 * @return {?WebInspector.FilmStripModel.Frame} 70 * @return {?WebInspector.FilmStripModel.Frame}
67 */ 71 */
68 frameByTimestamp: function(timestamp) 72 frameByTimestamp: function(timestamp)
69 { 73 {
70 /** 74 /**
71 * @param {number} timestamp 75 * @param {number} timestamp
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 * @return {!Promise<?string>} 141 * @return {!Promise<?string>}
138 */ 142 */
139 imageDataPromise: function() 143 imageDataPromise: function()
140 { 144 {
141 if (this._imageData || !this._snapshot) 145 if (this._imageData || !this._snapshot)
142 return Promise.resolve(this._imageData); 146 return Promise.resolve(this._imageData);
143 147
144 return /** @type {!Promise<?string>} */ (this._snapshot.objectPromise()) ; 148 return /** @type {!Promise<?string>} */ (this._snapshot.objectPromise()) ;
145 } 149 }
146 } 150 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/network/NetworkPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698