| 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.LayerPaintProfilerView = class extends WebInspector.SplitWidget { | 7 Layers.LayerPaintProfilerView = class extends UI.SplitWidget { |
| 8 /** | 8 /** |
| 9 * @param {function(string=)} showImageCallback | 9 * @param {function(string=)} showImageCallback |
| 10 */ | 10 */ |
| 11 constructor(showImageCallback) { | 11 constructor(showImageCallback) { |
| 12 super(true, false); | 12 super(true, false); |
| 13 | 13 |
| 14 this._logTreeView = new WebInspector.PaintProfilerCommandLogView(); | 14 this._logTreeView = new LayerViewer.PaintProfilerCommandLogView(); |
| 15 this.setSidebarWidget(this._logTreeView); | 15 this.setSidebarWidget(this._logTreeView); |
| 16 this._paintProfilerView = new WebInspector.PaintProfilerView(showImageCallba
ck); | 16 this._paintProfilerView = new LayerViewer.PaintProfilerView(showImageCallbac
k); |
| 17 this.setMainWidget(this._paintProfilerView); | 17 this.setMainWidget(this._paintProfilerView); |
| 18 | 18 |
| 19 this._paintProfilerView.addEventListener( | 19 this._paintProfilerView.addEventListener( |
| 20 WebInspector.PaintProfilerView.Events.WindowChanged, this._onWindowChang
ed, this); | 20 LayerViewer.PaintProfilerView.Events.WindowChanged, this._onWindowChange
d, this); |
| 21 } | 21 } |
| 22 | 22 |
| 23 reset() { | 23 reset() { |
| 24 this._paintProfilerView.setSnapshotAndLog(null, [], null); | 24 this._paintProfilerView.setSnapshotAndLog(null, [], null); |
| 25 } | 25 } |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * @param {!WebInspector.PaintProfilerSnapshot} snapshot | 28 * @param {!SDK.PaintProfilerSnapshot} snapshot |
| 29 */ | 29 */ |
| 30 profile(snapshot) { | 30 profile(snapshot) { |
| 31 this._showImageCallback = null; | 31 this._showImageCallback = null; |
| 32 snapshot.commandLog().then(log => setSnapshotAndLog.call(this, snapshot, log
)); | 32 snapshot.commandLog().then(log => setSnapshotAndLog.call(this, snapshot, log
)); |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * @param {?WebInspector.PaintProfilerSnapshot} snapshot | 35 * @param {?SDK.PaintProfilerSnapshot} snapshot |
| 36 * @param {?Array<!WebInspector.PaintProfilerLogItem>} log | 36 * @param {?Array<!SDK.PaintProfilerLogItem>} log |
| 37 * @this {WebInspector.LayerPaintProfilerView} | 37 * @this {Layers.LayerPaintProfilerView} |
| 38 */ | 38 */ |
| 39 function setSnapshotAndLog(snapshot, log) { | 39 function setSnapshotAndLog(snapshot, log) { |
| 40 this._logTreeView.setCommandLog(snapshot && snapshot.target(), log || []); | 40 this._logTreeView.setCommandLog(snapshot && snapshot.target(), log || []); |
| 41 this._paintProfilerView.setSnapshotAndLog(snapshot, log || [], null); | 41 this._paintProfilerView.setSnapshotAndLog(snapshot, log || [], null); |
| 42 if (snapshot) | 42 if (snapshot) |
| 43 snapshot.release(); | 43 snapshot.release(); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * @param {number} scale | 48 * @param {number} scale |
| 49 */ | 49 */ |
| 50 setScale(scale) { | 50 setScale(scale) { |
| 51 this._paintProfilerView.setScale(scale); | 51 this._paintProfilerView.setScale(scale); |
| 52 } | 52 } |
| 53 | 53 |
| 54 _onWindowChanged() { | 54 _onWindowChanged() { |
| 55 this._logTreeView.updateWindow(this._paintProfilerView.selectionWindow()); | 55 this._logTreeView.updateWindow(this._paintProfilerView.selectionWindow()); |
| 56 } | 56 } |
| 57 }; | 57 }; |
| OLD | NEW |