| 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 WebInspector.TimelinePaintProfilerView = class extends WebInspector.SplitWidget
{ | 7 WebInspector.TimelinePaintProfilerView = class extends WebInspector.SplitWidget
{ |
| 8 /** | 8 /** |
| 9 * @param {!WebInspector.TimelineFrameModel} frameModel | 9 * @param {!WebInspector.TimelineFrameModel} frameModel |
| 10 */ | 10 */ |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 * @return {boolean} | 56 * @return {boolean} |
| 57 */ | 57 */ |
| 58 setEvent(target, event) { | 58 setEvent(target, event) { |
| 59 this._releaseSnapshot(); | 59 this._releaseSnapshot(); |
| 60 this._target = target; | 60 this._target = target; |
| 61 this._pendingSnapshot = null; | 61 this._pendingSnapshot = null; |
| 62 this._event = event; | 62 this._event = event; |
| 63 | 63 |
| 64 this._updateWhenVisible(); | 64 this._updateWhenVisible(); |
| 65 if (this._event.name === WebInspector.TimelineModel.RecordType.Paint) | 65 if (this._event.name === WebInspector.TimelineModel.RecordType.Paint) |
| 66 return !!event.picture; | 66 return !!WebInspector.TimelineData.forEvent(event).picture; |
| 67 if (this._event.name === WebInspector.TimelineModel.RecordType.RasterTask) | 67 if (this._event.name === WebInspector.TimelineModel.RecordType.RasterTask) |
| 68 return this._frameModel.hasRasterTile(this._event); | 68 return this._frameModel.hasRasterTile(this._event); |
| 69 return false; | 69 return false; |
| 70 } | 70 } |
| 71 | 71 |
| 72 _updateWhenVisible() { | 72 _updateWhenVisible() { |
| 73 if (this.isShowing()) | 73 if (this.isShowing()) |
| 74 this._update(); | 74 this._update(); |
| 75 else | 75 else |
| 76 this._needsUpdateWhenVisible = true; | 76 this._needsUpdateWhenVisible = true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 _update() { | 79 _update() { |
| 80 this._logTreeView.setCommandLog(null, []); | 80 this._logTreeView.setCommandLog(null, []); |
| 81 this._paintProfilerView.setSnapshotAndLog(null, [], null); | 81 this._paintProfilerView.setSnapshotAndLog(null, [], null); |
| 82 | 82 |
| 83 var snapshotPromise; | 83 var snapshotPromise; |
| 84 if (this._pendingSnapshot) | 84 if (this._pendingSnapshot) |
| 85 snapshotPromise = Promise.resolve({rect: null, snapshot: this._pendingSnap
shot}); | 85 snapshotPromise = Promise.resolve({rect: null, snapshot: this._pendingSnap
shot}); |
| 86 else if (this._event.name === WebInspector.TimelineModel.RecordType.Paint) { | 86 else if (this._event.name === WebInspector.TimelineModel.RecordType.Paint) { |
| 87 snapshotPromise = this._event.picture.objectPromise() | 87 var picture = WebInspector.TimelineData.forEvent(this._event).picture; |
| 88 snapshotPromise = picture.objectPromise() |
| 88 .then(data => WebInspector.PaintProfilerSnapshot.loa
d(this._target, data['skp64'])) | 89 .then(data => WebInspector.PaintProfilerSnapshot.loa
d(this._target, data['skp64'])) |
| 89 .then(snapshot => snapshot && {rect: null, snapshot:
snapshot}); | 90 .then(snapshot => snapshot && {rect: null, snapshot:
snapshot}); |
| 90 } else if (this._event.name === WebInspector.TimelineModel.RecordType.Raster
Task) { | 91 } else if (this._event.name === WebInspector.TimelineModel.RecordType.Raster
Task) { |
| 91 snapshotPromise = this._frameModel.rasterTilePromise(this._event); | 92 snapshotPromise = this._frameModel.rasterTilePromise(this._event); |
| 92 } else { | 93 } else { |
| 93 console.assert(false, 'Unexpected event type or no snapshot'); | 94 console.assert(false, 'Unexpected event type or no snapshot'); |
| 94 return; | 95 return; |
| 95 } | 96 } |
| 96 snapshotPromise.then(snapshotWithRect => { | 97 snapshotPromise.then(snapshotWithRect => { |
| 97 this._releaseSnapshot(); | 98 this._releaseSnapshot(); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 204 } |
| 204 | 205 |
| 205 /** | 206 /** |
| 206 * @param {?Protocol.DOM.Rect} maskRectangle | 207 * @param {?Protocol.DOM.Rect} maskRectangle |
| 207 */ | 208 */ |
| 208 setMask(maskRectangle) { | 209 setMask(maskRectangle) { |
| 209 this._maskRectangle = maskRectangle; | 210 this._maskRectangle = maskRectangle; |
| 210 this._maskElement.classList.toggle('hidden', !maskRectangle); | 211 this._maskElement.classList.toggle('hidden', !maskRectangle); |
| 211 } | 212 } |
| 212 }; | 213 }; |
| OLD | NEW |