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 | |
6 */ | |
7 Timeline.TimelinePaintProfilerView = class extends UI.SplitWidget { | 5 Timeline.TimelinePaintProfilerView = class extends UI.SplitWidget { |
8 /** | 6 /** |
9 * @param {!TimelineModel.TimelineFrameModel} frameModel | 7 * @param {!TimelineModel.TimelineFrameModel} frameModel |
10 */ | 8 */ |
11 constructor(frameModel) { | 9 constructor(frameModel) { |
12 super(false, false); | 10 super(false, false); |
13 this.element.classList.add('timeline-paint-profiler-view'); | 11 this.element.classList.add('timeline-paint-profiler-view'); |
14 this.setSidebarSize(60); | 12 this.setSidebarSize(60); |
15 this.setResizable(false); | 13 this.setResizable(false); |
16 | 14 |
17 this._frameModel = frameModel; | 15 this._frameModel = frameModel; |
18 this._logAndImageSplitWidget = new UI.SplitWidget(true, false); | 16 this._logAndImageSplitWidget = new UI.SplitWidget(true, false); |
19 this._logAndImageSplitWidget.element.classList.add('timeline-paint-profiler-
log-split'); | 17 this._logAndImageSplitWidget.element.classList.add('timeline-paint-profiler-
log-split'); |
20 this.setMainWidget(this._logAndImageSplitWidget); | 18 this.setMainWidget(this._logAndImageSplitWidget); |
21 this._imageView = new Timeline.TimelinePaintImageView(); | 19 this._imageView = new Timeline.TimelinePaintImageView(); |
22 this._logAndImageSplitWidget.setMainWidget(this._imageView); | 20 this._logAndImageSplitWidget.setMainWidget(this._imageView); |
23 | 21 |
24 this._paintProfilerView = new LayerViewer.PaintProfilerView(this._imageView.
showImage.bind(this._imageView)); | 22 this._paintProfilerView = new LayerViewer.PaintProfilerView(this._imageView.
showImage.bind(this._imageView)); |
25 this._paintProfilerView.addEventListener( | 23 this._paintProfilerView.addEventListener( |
26 LayerViewer.PaintProfilerView.Events.WindowChanged, this._onWindowChange
d, this); | 24 LayerViewer.PaintProfilerView.Events.WindowChanged, this._onWindowChange
d, this); |
27 this.setSidebarWidget(this._paintProfilerView); | 25 this.setSidebarWidget(this._paintProfilerView); |
28 | 26 |
29 this._logTreeView = new LayerViewer.PaintProfilerCommandLogView(); | 27 this._logTreeView = new LayerViewer.PaintProfilerCommandLogView(); |
30 this._logAndImageSplitWidget.setSidebarWidget(this._logTreeView); | 28 this._logAndImageSplitWidget.setSidebarWidget(this._logTreeView); |
| 29 |
| 30 this._needsUpdateWhenVisible = false; |
| 31 /** @type {?SDK.PaintProfilerSnapshot} */ |
| 32 this._pendingSnapshot = null; |
| 33 /** @type {?SDK.TracingModel.Event} */ |
| 34 this._event = null; |
| 35 /** @type {?SDK.Target} */ |
| 36 this._target = null; |
| 37 /** @type {?SDK.PaintProfilerSnapshot} */ |
| 38 this._lastLoadedSnapshot = null; |
31 } | 39 } |
32 | 40 |
33 /** | 41 /** |
34 * @override | 42 * @override |
35 */ | 43 */ |
36 wasShown() { | 44 wasShown() { |
37 if (this._needsUpdateWhenVisible) { | 45 if (this._needsUpdateWhenVisible) { |
38 this._needsUpdateWhenVisible = false; | 46 this._needsUpdateWhenVisible = false; |
39 this._update(); | 47 this._update(); |
40 } | 48 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 86 |
79 _update() { | 87 _update() { |
80 this._logTreeView.setCommandLog(null, []); | 88 this._logTreeView.setCommandLog(null, []); |
81 this._paintProfilerView.setSnapshotAndLog(null, [], null); | 89 this._paintProfilerView.setSnapshotAndLog(null, [], null); |
82 | 90 |
83 var snapshotPromise; | 91 var snapshotPromise; |
84 if (this._pendingSnapshot) { | 92 if (this._pendingSnapshot) { |
85 snapshotPromise = Promise.resolve({rect: null, snapshot: this._pendingSnap
shot}); | 93 snapshotPromise = Promise.resolve({rect: null, snapshot: this._pendingSnap
shot}); |
86 } else if (this._event.name === TimelineModel.TimelineModel.RecordType.Paint
) { | 94 } else if (this._event.name === TimelineModel.TimelineModel.RecordType.Paint
) { |
87 var picture = TimelineModel.TimelineData.forEvent(this._event).picture; | 95 var picture = TimelineModel.TimelineData.forEvent(this._event).picture; |
88 snapshotPromise = picture.objectPromise() | 96 snapshotPromise = |
89 .then(data => SDK.PaintProfilerSnapshot.load(this._t
arget, data['skp64'])) | 97 picture.objectPromise() |
90 .then(snapshot => snapshot && {rect: null, snapshot:
snapshot}); | 98 .then(data => SDK.PaintProfilerSnapshot.load(/** @type {!SDK.Targe
t} */ (this._target), data['skp64'])) |
| 99 .then(snapshot => snapshot && {rect: null, snapshot: snapshot}); |
91 } else if (this._event.name === TimelineModel.TimelineModel.RecordType.Raste
rTask) { | 100 } else if (this._event.name === TimelineModel.TimelineModel.RecordType.Raste
rTask) { |
92 snapshotPromise = this._frameModel.rasterTilePromise(this._event); | 101 snapshotPromise = this._frameModel.rasterTilePromise(this._event); |
93 } else { | 102 } else { |
94 console.assert(false, 'Unexpected event type or no snapshot'); | 103 console.assert(false, 'Unexpected event type or no snapshot'); |
95 return; | 104 return; |
96 } | 105 } |
97 snapshotPromise.then(snapshotWithRect => { | 106 snapshotPromise.then(snapshotWithRect => { |
98 this._releaseSnapshot(); | 107 this._releaseSnapshot(); |
99 if (!snapshotWithRect) { | 108 if (!snapshotWithRect) { |
100 this._imageView.showImage(); | 109 this._imageView.showImage(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 213 } |
205 | 214 |
206 /** | 215 /** |
207 * @param {?Protocol.DOM.Rect} maskRectangle | 216 * @param {?Protocol.DOM.Rect} maskRectangle |
208 */ | 217 */ |
209 setMask(maskRectangle) { | 218 setMask(maskRectangle) { |
210 this._maskRectangle = maskRectangle; | 219 this._maskRectangle = maskRectangle; |
211 this._maskElement.classList.toggle('hidden', !maskRectangle); | 220 this._maskElement.classList.toggle('hidden', !maskRectangle); |
212 } | 221 } |
213 }; | 222 }; |
OLD | NEW |