Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(843)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineLayersView.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
7 /** 6 /**
8 * @constructor 7 * @unrestricted
9 * @extends {WebInspector.SplitWidget}
10 * @param {!WebInspector.TimelineModel} model
11 * @param {function(!WebInspector.PaintProfilerSnapshot)} showPaintProfilerCallb ack
12 */ 8 */
13 WebInspector.TimelineLayersView = function(model, showPaintProfilerCallback) 9 WebInspector.TimelineLayersView = class extends WebInspector.SplitWidget {
14 { 10 /**
15 WebInspector.SplitWidget.call(this, true, false, "timelineLayersView"); 11 * @param {!WebInspector.TimelineModel} model
12 * @param {function(!WebInspector.PaintProfilerSnapshot)} showPaintProfilerCal lback
13 */
14 constructor(model, showPaintProfilerCallback) {
15 super(true, false, 'timelineLayersView');
16 this._model = model; 16 this._model = model;
17 this._showPaintProfilerCallback = showPaintProfilerCallback; 17 this._showPaintProfilerCallback = showPaintProfilerCallback;
18 18
19 this.element.classList.add("timeline-layers-view"); 19 this.element.classList.add('timeline-layers-view');
20 this._rightSplitWidget = new WebInspector.SplitWidget(true, true, "timelineL ayersViewDetails"); 20 this._rightSplitWidget = new WebInspector.SplitWidget(true, true, 'timelineL ayersViewDetails');
21 this._rightSplitWidget.element.classList.add("timeline-layers-view-propertie s"); 21 this._rightSplitWidget.element.classList.add('timeline-layers-view-propertie s');
22 this.setMainWidget(this._rightSplitWidget); 22 this.setMainWidget(this._rightSplitWidget);
23 23
24 var vbox = new WebInspector.VBox(); 24 var vbox = new WebInspector.VBox();
25 this.setSidebarWidget(vbox); 25 this.setSidebarWidget(vbox);
26 26
27 this._layerViewHost = new WebInspector.LayerViewHost(); 27 this._layerViewHost = new WebInspector.LayerViewHost();
28 28
29 var layerTreeOutline = new WebInspector.LayerTreeOutline(this._layerViewHost ); 29 var layerTreeOutline = new WebInspector.LayerTreeOutline(this._layerViewHost );
30 vbox.element.appendChild(layerTreeOutline.element); 30 vbox.element.appendChild(layerTreeOutline.element);
31 31
32 this._layers3DView = new WebInspector.Layers3DView(this._layerViewHost); 32 this._layers3DView = new WebInspector.Layers3DView(this._layerViewHost);
33 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.PaintPr ofilerRequested, this._onPaintProfilerRequested, this); 33 this._layers3DView.addEventListener(
34 WebInspector.Layers3DView.Events.PaintProfilerRequested, this._onPaintPr ofilerRequested, this);
34 this._rightSplitWidget.setMainWidget(this._layers3DView); 35 this._rightSplitWidget.setMainWidget(this._layers3DView);
35 36
36 var layerDetailsView = new WebInspector.LayerDetailsView(this._layerViewHost ); 37 var layerDetailsView = new WebInspector.LayerDetailsView(this._layerViewHost );
37 this._rightSplitWidget.setSidebarWidget(layerDetailsView); 38 this._rightSplitWidget.setSidebarWidget(layerDetailsView);
38 layerDetailsView.addEventListener(WebInspector.LayerDetailsView.Events.Paint ProfilerRequested, this._onPaintProfilerRequested, this); 39 layerDetailsView.addEventListener(
40 WebInspector.LayerDetailsView.Events.PaintProfilerRequested, this._onPai ntProfilerRequested, this);
41 }
42
43 /**
44 * @param {!WebInspector.TracingFrameLayerTree} frameLayerTree
45 */
46 showLayerTree(frameLayerTree) {
47 this._frameLayerTree = frameLayerTree;
48 if (this.isShowing())
49 this._update();
50 else
51 this._updateWhenVisible = true;
52 }
53
54 /**
55 * @override
56 */
57 wasShown() {
58 if (this._updateWhenVisible) {
59 this._updateWhenVisible = false;
60 this._update();
61 }
62 }
63
64 /**
65 * @param {!WebInspector.Event} event
66 */
67 _onPaintProfilerRequested(event) {
68 var selection = /** @type {!WebInspector.LayerView.Selection} */ (event.data );
69 this._layers3DView.snapshotForSelection(selection).then(snapshotWithRect => {
70 if (snapshotWithRect)
71 this._showPaintProfilerCallback(snapshotWithRect.snapshot);
72 });
73 }
74
75 _update() {
76 this._frameLayerTree.layerTreePromise().then(layerTree => this._layerViewHos t.setLayerTree(layerTree));
77 }
39 }; 78 };
40
41 WebInspector.TimelineLayersView.prototype = {
42 /**
43 * @param {!WebInspector.TracingFrameLayerTree} frameLayerTree
44 */
45 showLayerTree: function(frameLayerTree)
46 {
47 this._frameLayerTree = frameLayerTree;
48 if (this.isShowing())
49 this._update();
50 else
51 this._updateWhenVisible = true;
52 },
53
54 wasShown: function()
55 {
56 if (this._updateWhenVisible) {
57 this._updateWhenVisible = false;
58 this._update();
59 }
60 },
61
62 /**
63 * @param {!WebInspector.Event} event
64 */
65 _onPaintProfilerRequested: function(event)
66 {
67 var selection = /** @type {!WebInspector.LayerView.Selection} */ (event. data);
68 this._layers3DView.snapshotForSelection(selection).then(snapshotWithRect => {
69 if (snapshotWithRect)
70 this._showPaintProfilerCallback(snapshotWithRect.snapshot);
71 });
72 },
73
74 _update: function()
75 {
76 this._frameLayerTree.layerTreePromise().then(layerTree => this._layerVie wHost.setLayerTree(layerTree));
77 },
78
79 __proto__: WebInspector.SplitWidget.prototype
80 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698