OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 /** |
| 6 * @constructor |
| 7 * @param {function(!WebInspector.Layer, string=)} showImageForLayerCallback |
| 8 * @extends {WebInspector.SplitView} |
| 9 */ |
| 10 WebInspector.LayerPaintProfilerView = function(showImageForLayerCallback) |
| 11 { |
| 12 WebInspector.SplitView.call(this, true, false); |
| 13 |
| 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()); |
| 19 |
| 20 this._paintProfilerView.addEventListener(WebInspector.PaintProfilerView.Even
ts.WindowChanged, this._onWindowChanged, this); |
| 21 } |
| 22 |
| 23 WebInspector.LayerPaintProfilerView.prototype = { |
| 24 /** |
| 25 * @param {!WebInspector.Layer} layer |
| 26 */ |
| 27 profileLayer: function(layer) |
| 28 { |
| 29 layer.requestSnapshot(onSnapshotDone.bind(this)); |
| 30 |
| 31 /** |
| 32 * @param {!WebInspector.PaintProfilerSnapshot=} snapshot |
| 33 * @this {WebInspector.LayerPaintProfilerView} |
| 34 */ |
| 35 function onSnapshotDone(snapshot) |
| 36 { |
| 37 this._layer = layer; |
| 38 this._paintProfilerView.setSnapshot(snapshot || null); |
| 39 this._logTreeView.setSnapshot(snapshot || null); |
| 40 } |
| 41 }, |
| 42 |
| 43 _onWindowChanged: function() |
| 44 { |
| 45 var window = this._paintProfilerView.windowBoundaries(); |
| 46 this._logTreeView.updateWindow(window.left, window.right); |
| 47 }, |
| 48 |
| 49 /** |
| 50 * @param {string=} imageURL |
| 51 */ |
| 52 _showImage: function(imageURL) |
| 53 { |
| 54 this._showImageForLayerCallback(this._layer, imageURL); |
| 55 }, |
| 56 |
| 57 __proto__: WebInspector.SplitView.prototype |
| 58 }; |
| 59 |
OLD | NEW |