| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @unrestricted | 8 * @unrestricted |
| 9 */ | 9 */ |
| 10 WebInspector.TimelineLayersView = class extends WebInspector.SplitWidget { | 10 Timeline.TimelineLayersView = class extends UI.SplitWidget { |
| 11 /** | 11 /** |
| 12 * @param {!WebInspector.TimelineModel} model | 12 * @param {!TimelineModel.TimelineModel} model |
| 13 * @param {function(!WebInspector.PaintProfilerSnapshot)} showPaintProfilerCal
lback | 13 * @param {function(!SDK.PaintProfilerSnapshot)} showPaintProfilerCallback |
| 14 */ | 14 */ |
| 15 constructor(model, showPaintProfilerCallback) { | 15 constructor(model, showPaintProfilerCallback) { |
| 16 super(true, false, 'timelineLayersView'); | 16 super(true, false, 'timelineLayersView'); |
| 17 this._model = model; | 17 this._model = model; |
| 18 this._showPaintProfilerCallback = showPaintProfilerCallback; | 18 this._showPaintProfilerCallback = showPaintProfilerCallback; |
| 19 | 19 |
| 20 this.element.classList.add('timeline-layers-view'); | 20 this.element.classList.add('timeline-layers-view'); |
| 21 this._rightSplitWidget = new WebInspector.SplitWidget(true, true, 'timelineL
ayersViewDetails'); | 21 this._rightSplitWidget = new UI.SplitWidget(true, true, 'timelineLayersViewD
etails'); |
| 22 this._rightSplitWidget.element.classList.add('timeline-layers-view-propertie
s'); | 22 this._rightSplitWidget.element.classList.add('timeline-layers-view-propertie
s'); |
| 23 this.setMainWidget(this._rightSplitWidget); | 23 this.setMainWidget(this._rightSplitWidget); |
| 24 | 24 |
| 25 var vbox = new WebInspector.VBox(); | 25 var vbox = new UI.VBox(); |
| 26 this.setSidebarWidget(vbox); | 26 this.setSidebarWidget(vbox); |
| 27 | 27 |
| 28 this._layerViewHost = new WebInspector.LayerViewHost(); | 28 this._layerViewHost = new LayerViewer.LayerViewHost(); |
| 29 | 29 |
| 30 var layerTreeOutline = new WebInspector.LayerTreeOutline(this._layerViewHost
); | 30 var layerTreeOutline = new LayerViewer.LayerTreeOutline(this._layerViewHost)
; |
| 31 vbox.element.appendChild(layerTreeOutline.element); | 31 vbox.element.appendChild(layerTreeOutline.element); |
| 32 | 32 |
| 33 this._layers3DView = new WebInspector.Layers3DView(this._layerViewHost); | 33 this._layers3DView = new LayerViewer.Layers3DView(this._layerViewHost); |
| 34 this._layers3DView.addEventListener( | 34 this._layers3DView.addEventListener( |
| 35 WebInspector.Layers3DView.Events.PaintProfilerRequested, this._onPaintPr
ofilerRequested, this); | 35 LayerViewer.Layers3DView.Events.PaintProfilerRequested, this._onPaintPro
filerRequested, this); |
| 36 this._rightSplitWidget.setMainWidget(this._layers3DView); | 36 this._rightSplitWidget.setMainWidget(this._layers3DView); |
| 37 | 37 |
| 38 var layerDetailsView = new WebInspector.LayerDetailsView(this._layerViewHost
); | 38 var layerDetailsView = new LayerViewer.LayerDetailsView(this._layerViewHost)
; |
| 39 this._rightSplitWidget.setSidebarWidget(layerDetailsView); | 39 this._rightSplitWidget.setSidebarWidget(layerDetailsView); |
| 40 layerDetailsView.addEventListener( | 40 layerDetailsView.addEventListener( |
| 41 WebInspector.LayerDetailsView.Events.PaintProfilerRequested, this._onPai
ntProfilerRequested, this); | 41 LayerViewer.LayerDetailsView.Events.PaintProfilerRequested, this._onPain
tProfilerRequested, this); |
| 42 } | 42 } |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * @param {!WebInspector.TracingFrameLayerTree} frameLayerTree | 45 * @param {!TimelineModel.TracingFrameLayerTree} frameLayerTree |
| 46 */ | 46 */ |
| 47 showLayerTree(frameLayerTree) { | 47 showLayerTree(frameLayerTree) { |
| 48 this._frameLayerTree = frameLayerTree; | 48 this._frameLayerTree = frameLayerTree; |
| 49 if (this.isShowing()) | 49 if (this.isShowing()) |
| 50 this._update(); | 50 this._update(); |
| 51 else | 51 else |
| 52 this._updateWhenVisible = true; | 52 this._updateWhenVisible = true; |
| 53 } | 53 } |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * @override | 56 * @override |
| 57 */ | 57 */ |
| 58 wasShown() { | 58 wasShown() { |
| 59 if (this._updateWhenVisible) { | 59 if (this._updateWhenVisible) { |
| 60 this._updateWhenVisible = false; | 60 this._updateWhenVisible = false; |
| 61 this._update(); | 61 this._update(); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 /** | 65 /** |
| 66 * @param {!WebInspector.Event} event | 66 * @param {!Common.Event} event |
| 67 */ | 67 */ |
| 68 _onPaintProfilerRequested(event) { | 68 _onPaintProfilerRequested(event) { |
| 69 var selection = /** @type {!WebInspector.LayerView.Selection} */ (event.data
); | 69 var selection = /** @type {!LayerViewer.LayerView.Selection} */ (event.data)
; |
| 70 this._layers3DView.snapshotForSelection(selection).then(snapshotWithRect =>
{ | 70 this._layers3DView.snapshotForSelection(selection).then(snapshotWithRect =>
{ |
| 71 if (snapshotWithRect) | 71 if (snapshotWithRect) |
| 72 this._showPaintProfilerCallback(snapshotWithRect.snapshot); | 72 this._showPaintProfilerCallback(snapshotWithRect.snapshot); |
| 73 }); | 73 }); |
| 74 } | 74 } |
| 75 | 75 |
| 76 _update() { | 76 _update() { |
| 77 this._frameLayerTree.layerTreePromise().then(layerTree => this._layerViewHos
t.setLayerTree(layerTree)); | 77 this._frameLayerTree.layerTreePromise().then(layerTree => this._layerViewHos
t.setLayerTree(layerTree)); |
| 78 } | 78 } |
| 79 }; | 79 }; |
| OLD | NEW |