| OLD | NEW |
| 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 |
| 11 */ | 11 */ |
| 12 WebInspector.FilmStripModel = function(tracingModel, zeroTime) | 12 WebInspector.FilmStripModel = function(tracingModel, zeroTime) |
| 13 { | 13 { |
| 14 this.reset(tracingModel, zeroTime); | 14 this.reset(tracingModel, zeroTime); |
| 15 } | 15 }; |
| 16 | 16 |
| 17 WebInspector.FilmStripModel._category = "disabled-by-default-devtools.screenshot
"; | 17 WebInspector.FilmStripModel._category = "disabled-by-default-devtools.screenshot
"; |
| 18 | 18 |
| 19 WebInspector.FilmStripModel.TraceEvents = { | 19 WebInspector.FilmStripModel.TraceEvents = { |
| 20 CaptureFrame: "CaptureFrame", | 20 CaptureFrame: "CaptureFrame", |
| 21 Screenshot: "Screenshot" | 21 Screenshot: "Screenshot" |
| 22 } | 22 }; |
| 23 | 23 |
| 24 WebInspector.FilmStripModel.prototype = { | 24 WebInspector.FilmStripModel.prototype = { |
| 25 /** | 25 /** |
| 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; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * @param {number} timestamp | 82 * @param {number} timestamp |
| 83 * @return {?WebInspector.FilmStripModel.Frame} | 83 * @return {?WebInspector.FilmStripModel.Frame} |
| 84 */ | 84 */ |
| 85 frameByTimestamp: function(timestamp) | 85 frameByTimestamp: function(timestamp) |
| 86 { | 86 { |
| 87 var index = this._frames.upperBound(timestamp, (timestamp, frame) => tim
estamp - frame.timestamp) - 1; | 87 var index = this._frames.upperBound(timestamp, (timestamp, frame) => tim
estamp - frame.timestamp) - 1; |
| 88 return index >= 0 ? this._frames[index] : null; | 88 return index >= 0 ? this._frames[index] : null; |
| 89 } | 89 } |
| 90 } | 90 }; |
| 91 | 91 |
| 92 /** | 92 /** |
| 93 * @constructor | 93 * @constructor |
| 94 * @param {!WebInspector.FilmStripModel} model | 94 * @param {!WebInspector.FilmStripModel} model |
| 95 * @param {number} timestamp | 95 * @param {number} timestamp |
| 96 * @param {number} index | 96 * @param {number} index |
| 97 */ | 97 */ |
| 98 WebInspector.FilmStripModel.Frame = function(model, timestamp, index) | 98 WebInspector.FilmStripModel.Frame = function(model, timestamp, index) |
| 99 { | 99 { |
| 100 this._model = model; | 100 this._model = model; |
| 101 this.timestamp = timestamp; | 101 this.timestamp = timestamp; |
| 102 this.index = index; | 102 this.index = index; |
| 103 /** @type {?string} */ | 103 /** @type {?string} */ |
| 104 this._imageData = null; | 104 this._imageData = null; |
| 105 /** @type {?WebInspector.TracingModel.ObjectSnapshot} */ | 105 /** @type {?WebInspector.TracingModel.ObjectSnapshot} */ |
| 106 this._snapshot = null; | 106 this._snapshot = null; |
| 107 } | 107 }; |
| 108 | 108 |
| 109 /** | 109 /** |
| 110 * @param {!WebInspector.FilmStripModel} model | 110 * @param {!WebInspector.FilmStripModel} model |
| 111 * @param {!WebInspector.TracingModel.Event} event | 111 * @param {!WebInspector.TracingModel.Event} event |
| 112 * @param {number} index | 112 * @param {number} index |
| 113 * @return {!WebInspector.FilmStripModel.Frame} | 113 * @return {!WebInspector.FilmStripModel.Frame} |
| 114 */ | 114 */ |
| 115 WebInspector.FilmStripModel.Frame._fromEvent = function(model, event, index) | 115 WebInspector.FilmStripModel.Frame._fromEvent = function(model, event, index) |
| 116 { | 116 { |
| 117 var frame = new WebInspector.FilmStripModel.Frame(model, event.startTime, in
dex); | 117 var frame = new WebInspector.FilmStripModel.Frame(model, event.startTime, in
dex); |
| 118 frame._imageData = event.args["data"]; | 118 frame._imageData = event.args["data"]; |
| 119 return frame; | 119 return frame; |
| 120 } | 120 }; |
| 121 | 121 |
| 122 /** | 122 /** |
| 123 * @param {!WebInspector.FilmStripModel} model | 123 * @param {!WebInspector.FilmStripModel} model |
| 124 * @param {!WebInspector.TracingModel.ObjectSnapshot} snapshot | 124 * @param {!WebInspector.TracingModel.ObjectSnapshot} snapshot |
| 125 * @param {number} index | 125 * @param {number} index |
| 126 * @return {!WebInspector.FilmStripModel.Frame} | 126 * @return {!WebInspector.FilmStripModel.Frame} |
| 127 */ | 127 */ |
| 128 WebInspector.FilmStripModel.Frame._fromSnapshot = function(model, snapshot, inde
x) | 128 WebInspector.FilmStripModel.Frame._fromSnapshot = function(model, snapshot, inde
x) |
| 129 { | 129 { |
| 130 var frame = new WebInspector.FilmStripModel.Frame(model, snapshot.startTime,
index); | 130 var frame = new WebInspector.FilmStripModel.Frame(model, snapshot.startTime,
index); |
| 131 frame._snapshot = snapshot; | 131 frame._snapshot = snapshot; |
| 132 return frame; | 132 return frame; |
| 133 } | 133 }; |
| 134 | 134 |
| 135 WebInspector.FilmStripModel.Frame.prototype = { | 135 WebInspector.FilmStripModel.Frame.prototype = { |
| 136 /** | 136 /** |
| 137 * @return {!WebInspector.FilmStripModel} | 137 * @return {!WebInspector.FilmStripModel} |
| 138 */ | 138 */ |
| 139 model: function() | 139 model: function() |
| 140 { | 140 { |
| 141 return this._model; | 141 return this._model; |
| 142 }, | 142 }, |
| 143 | 143 |
| 144 /** | 144 /** |
| 145 * @return {!Promise<?string>} | 145 * @return {!Promise<?string>} |
| 146 */ | 146 */ |
| 147 imageDataPromise: function() | 147 imageDataPromise: function() |
| 148 { | 148 { |
| 149 if (this._imageData || !this._snapshot) | 149 if (this._imageData || !this._snapshot) |
| 150 return Promise.resolve(this._imageData); | 150 return Promise.resolve(this._imageData); |
| 151 | 151 |
| 152 return /** @type {!Promise<?string>} */ (this._snapshot.objectPromise())
; | 152 return /** @type {!Promise<?string>} */ (this._snapshot.objectPromise())
; |
| 153 } | 153 } |
| 154 } | 154 }; |
| OLD | NEW |