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.SplitView}
10 WebInspector.LayerPaintProfilerView = function(showImageForLayerCallback)
12 WebInspector.SplitView.call(this, true, false);
14 this._showImageForLayerCallback = showImageForLayerCallback;
15 this._logTreeView = new WebInspector.PaintProfilerCommandLogView();
16 this._logTreeView.show(this.sidebarElement());
17 this._paintProfilerView = new WebInspector.PaintProfilerView(this._showImage.bind(this));
18 this._paintProfilerView.show(this.mainElement());
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 layer.requestSnapshot(onSnapshotDone.bind(this));
32 * @param {!WebInspector.PaintProfilerSnapshot=} snapshot
33 * @this {WebInspector.LayerPaintProfilerView}
35 function onSnapshotDone(snapshot)
38 this._paintProfilerView.setSnapshot(snapshot || null);
39 this._logTreeView.setSnapshot(snapshot || null);
43 _onWindowChanged: function()
45 var window = this._paintProfilerView.windowBoundaries();
46 this._logTreeView.updateWindow(window.left, window.right);
50 * @param {string=} imageURL
52 _showImage: function(imageURL)
54 this._showImageForLayerCallback(this._layer, imageURL);
57 __proto__: WebInspector.SplitView.prototype