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

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

Issue 2378843003: Timeline: fix screenshots for headless shell (Closed)
Patch Set: review comments addressed Created 4 years, 2 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
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 * @param {number=} zeroTime
(...skipping 15 matching lines...) Expand all
26 * @param {!WebInspector.TracingModel} tracingModel 26 * @param {!WebInspector.TracingModel} tracingModel
27 * @param {number=} zeroTime 27 * @param {number=} zeroTime
28 */ 28 */
29 reset: function(tracingModel, zeroTime) 29 reset: function(tracingModel, zeroTime)
30 { 30 {
31 this._zeroTime = zeroTime || tracingModel.minimumRecordTime(); 31 this._zeroTime = zeroTime || tracingModel.minimumRecordTime();
32 this._spanTime = tracingModel.maximumRecordTime() - this._zeroTime; 32 this._spanTime = tracingModel.maximumRecordTime() - this._zeroTime;
33 33
34 /** @type {!Array<!WebInspector.FilmStripModel.Frame>} */ 34 /** @type {!Array<!WebInspector.FilmStripModel.Frame>} */
35 this._frames = []; 35 this._frames = [];
36 36 var browserMain = WebInspector.TracingModel.browserMainThread(tracingMod el);
37 var browserProcess = tracingModel.processByName("Browser"); 37 if (!browserMain)
38 if (!browserProcess)
39 return;
40 var mainThread = browserProcess.threadByName("CrBrowserMain");
41 if (!mainThread)
42 return; 38 return;
43 39
44 var events = mainThread.events(); 40 var events = browserMain.events();
45 for (var i = 0; i < events.length; ++i) { 41 for (var i = 0; i < events.length; ++i) {
46 var event = events[i]; 42 var event = events[i];
47 if (event.startTime < this._zeroTime) 43 if (event.startTime < this._zeroTime)
48 continue; 44 continue;
49 if (!event.hasCategory(WebInspector.FilmStripModel._category)) 45 if (!event.hasCategory(WebInspector.FilmStripModel._category))
50 continue; 46 continue;
51 if (event.name === WebInspector.FilmStripModel.TraceEvents.CaptureFr ame) { 47 if (event.name === WebInspector.FilmStripModel.TraceEvents.CaptureFr ame) {
52 var data = event.args["data"]; 48 var data = event.args["data"];
53 if (data) 49 if (data)
54 this._frames.push(WebInspector.FilmStripModel.Frame._fromEve nt(this, event, this._frames.length)); 50 this._frames.push(WebInspector.FilmStripModel.Frame._fromEve nt(this, event, this._frames.length));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 * @return {!Promise<?string>} 145 * @return {!Promise<?string>}
150 */ 146 */
151 imageDataPromise: function() 147 imageDataPromise: function()
152 { 148 {
153 if (this._imageData || !this._snapshot) 149 if (this._imageData || !this._snapshot)
154 return Promise.resolve(this._imageData); 150 return Promise.resolve(this._imageData);
155 151
156 return /** @type {!Promise<?string>} */ (this._snapshot.objectPromise()) ; 152 return /** @type {!Promise<?string>} */ (this._snapshot.objectPromise()) ;
157 } 153 }
158 } 154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698