| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @param {!WebInspector.TimelineFrameModel} frameModel | 7 * @param {!WebInspector.TimelineFrameModel} frameModel |
| 8 * @extends {WebInspector.SplitWidget} | 8 * @extends {WebInspector.SplitWidget} |
| 9 */ | 9 */ |
| 10 WebInspector.TimelinePaintProfilerView = function(frameModel) | 10 WebInspector.TimelinePaintProfilerView = function(frameModel) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (this._event.name === WebInspector.TimelineModel.RecordType.RasterTas
k) | 59 if (this._event.name === WebInspector.TimelineModel.RecordType.RasterTas
k) |
| 60 return this._frameModel.hasRasterTile(this._event); | 60 return this._frameModel.hasRasterTile(this._event); |
| 61 return false; | 61 return false; |
| 62 }, | 62 }, |
| 63 | 63 |
| 64 _update: function() | 64 _update: function() |
| 65 { | 65 { |
| 66 this._logTreeView.setCommandLog(null, []); | 66 this._logTreeView.setCommandLog(null, []); |
| 67 this._paintProfilerView.setSnapshotAndLog(null, [], null); | 67 this._paintProfilerView.setSnapshotAndLog(null, [], null); |
| 68 | 68 |
| 69 if (this._event.name === WebInspector.TimelineModel.RecordType.Paint) | 69 var snapshotPromise; |
| 70 this._event.picture.requestObject(onDataAvailable.bind(this)); | 70 if (this._event.name === WebInspector.TimelineModel.RecordType.Paint) { |
| 71 else if (this._event.name === WebInspector.TimelineModel.RecordType.Rast
erTask) | 71 snapshotPromise = this._event.picture.objectPromise() |
| 72 this._frameModel.requestRasterTile(this._event, onSnapshotLoaded.bin
d(this)) | 72 .then(data => WebInspector.PaintProfilerSnapshot.load(this._targ
et, data["skp64"])) |
| 73 else | 73 .then(snapshot => snapshot && {rect: null, snapshot: snapshot}); |
| 74 } else if (this._event.name === WebInspector.TimelineModel.RecordType.Ra
sterTask) { |
| 75 snapshotPromise = this._frameModel.rasterTilePromise(this._event); |
| 76 } else { |
| 74 console.assert(false, "Unexpected event type: " + this._event.name); | 77 console.assert(false, "Unexpected event type: " + this._event.name); |
| 75 | 78 return; |
| 76 /** | |
| 77 * @param {!Object} data | |
| 78 * @this WebInspector.TimelinePaintProfilerView | |
| 79 */ | |
| 80 function onDataAvailable(data) | |
| 81 { | |
| 82 if (data) | |
| 83 WebInspector.PaintProfilerSnapshot.load(this._target, data["skp6
4"], onSnapshotLoaded.bind(this, null)); | |
| 84 } | 79 } |
| 85 /** | 80 snapshotPromise.then(snapshotWithRect => { |
| 86 * @param {?DOMAgent.Rect} tileRect | |
| 87 * @param {?WebInspector.PaintProfilerSnapshot} snapshot | |
| 88 * @this WebInspector.TimelinePaintProfilerView | |
| 89 */ | |
| 90 function onSnapshotLoaded(tileRect, snapshot) | |
| 91 { | |
| 92 this._disposeSnapshot(); | 81 this._disposeSnapshot(); |
| 93 this._lastLoadedSnapshot = snapshot; | 82 if (!snapshotWithRect) { |
| 94 this._imageView.setMask(tileRect); | |
| 95 if (!snapshot) { | |
| 96 this._imageView.showImage(); | 83 this._imageView.showImage(); |
| 97 return; | 84 return; |
| 98 } | 85 } |
| 99 snapshot.commandLog(onCommandLogDone.bind(this, snapshot, tileRect))
; | 86 var snapshot = snapshotWithRect.snapshot; |
| 100 } | 87 this._lastLoadedSnapshot = snapshot; |
| 88 this._imageView.setMask(snapshotWithRect.rect); |
| 89 snapshot.commandLog(onCommandLogDone.bind(this, snapshot, snapshotWi
thRect.rect)); |
| 90 }); |
| 101 | 91 |
| 102 /** | 92 /** |
| 103 * @param {!WebInspector.PaintProfilerSnapshot} snapshot | 93 * @param {!WebInspector.PaintProfilerSnapshot} snapshot |
| 104 * @param {?DOMAgent.Rect} clipRect | 94 * @param {?DOMAgent.Rect} clipRect |
| 105 * @param {!Array.<!WebInspector.PaintProfilerLogItem>=} log | 95 * @param {!Array.<!WebInspector.PaintProfilerLogItem>=} log |
| 106 * @this {WebInspector.TimelinePaintProfilerView} | 96 * @this {WebInspector.TimelinePaintProfilerView} |
| 107 */ | 97 */ |
| 108 function onCommandLogDone(snapshot, clipRect, log) | 98 function onCommandLogDone(snapshot, clipRect, log) |
| 109 { | 99 { |
| 110 this._logTreeView.setCommandLog(snapshot.target(), log || []); | 100 this._logTreeView.setCommandLog(snapshot.target(), log || []); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 * @param {?DOMAgent.Rect} maskRectangle | 193 * @param {?DOMAgent.Rect} maskRectangle |
| 204 */ | 194 */ |
| 205 setMask: function(maskRectangle) | 195 setMask: function(maskRectangle) |
| 206 { | 196 { |
| 207 this._maskRectangle = maskRectangle; | 197 this._maskRectangle = maskRectangle; |
| 208 this._maskElement.classList.toggle("hidden", !maskRectangle); | 198 this._maskElement.classList.toggle("hidden", !maskRectangle); |
| 209 }, | 199 }, |
| 210 | 200 |
| 211 __proto__: WebInspector.Widget.prototype | 201 __proto__: WebInspector.Widget.prototype |
| 212 }; | 202 }; |
| OLD | NEW |