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