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
3 // found in the LICENSE file.
7 * @param {function(!WebInspector.Layer, string=)} showImageForLayerCallback
8 * @extends {WebInspector.SplitWidget}
10 WebInspector
.LayerPaintProfilerView = function(showImageForLayerCallback
)
12 WebInspector
.SplitWidget
.call(this, true, false);
14 this._showImageForLayerCallback
= showImageForLayerCallback
;
15 this._logTreeView
= new WebInspector
.PaintProfilerCommandLogView();
16 this.setSidebarWidget(this._logTreeView
);
17 this._paintProfilerView
= new WebInspector
.PaintProfilerView(this._showImage
.bind(this));
18 this.setMainWidget(this._paintProfilerView
);
20 this._paintProfilerView
.addEventListener(WebInspector
.PaintProfilerView
.Events
.WindowChanged
, this._onWindowChanged
, this);
23 WebInspector
.LayerPaintProfilerView
.prototype = {
25 * @param {!WebInspector.Layer} layer
27 profileLayer: function(layer
)
29 this._logTreeView
.setCommandLog(null, []);
30 this._paintProfilerView
.setSnapshotAndLog(null, [], null);
31 /** @type {!WebInspector.AgentLayer} */ (layer
).requestSnapshot(onSnapshotDone
.bind(this));
34 * @param {!WebInspector.PaintProfilerSnapshot=} snapshot
35 * @this {WebInspector.LayerPaintProfilerView}
37 function onSnapshotDone(snapshot
)
40 snapshot
.commandLog(onCommandLogDone
.bind(this, snapshot
));
44 * @param {!WebInspector.PaintProfilerSnapshot=} snapshot
45 * @param {!Array.<!Object>=} log
46 * @this {WebInspector.LayerPaintProfilerView}
48 function onCommandLogDone(snapshot
, log
)
50 this._logTreeView
.setCommandLog(snapshot
.target(), log
|| []);
51 this._paintProfilerView
.setSnapshotAndLog(snapshot
|| null, log
|| [], null);
55 _onWindowChanged: function()
57 var window
= this._paintProfilerView
.windowBoundaries();
58 this._logTreeView
.updateWindow(window
.left
, window
.right
);
62 * @param {string=} imageURL
64 _showImage: function(imageURL
)
66 this._showImageForLayerCallback(this._layer
, imageURL
);
69 __proto__
: WebInspector
.SplitWidget
.prototype