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

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

Issue 389563002: DevTools: make paint profiler target-aware (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months 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 | Annotate | Revision Log
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 6
7 /** 7 /**
8 * @constructor 8 * @constructor
9 * @extends {WebInspector.VBox} 9 * @extends {WebInspector.VBox}
10 */ 10 */
11 WebInspector.TimelineLayersView = function() 11 WebInspector.TimelineLayersView = function()
12 { 12 {
13 WebInspector.VBox.call(this); 13 WebInspector.VBox.call(this);
14 14
15 this._paintTiles = []; 15 this._paintTiles = [];
16 this._layers3DView = new WebInspector.Layers3DView(); 16 this._layers3DView = new WebInspector.Layers3DView();
17 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ObjectS elected, this._onObjectSelected, this); 17 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ObjectS elected, this._onObjectSelected, this);
18 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ObjectH overed, this._onObjectHovered, this); 18 this._layers3DView.addEventListener(WebInspector.Layers3DView.Events.ObjectH overed, this._onObjectHovered, this);
19 this._layers3DView.show(this.element); 19 this._layers3DView.show(this.element);
20 } 20 }
21 21
22 WebInspector.TimelineLayersView.prototype = { 22 WebInspector.TimelineLayersView.prototype = {
23 /** 23 /**
24 * @param {!WebInspector.DeferredLayerTree} deferredLayerTree 24 * @param {!WebInspector.DeferredLayerTree} deferredLayerTree
25 * @param {?Array.<!WebInspector.LayerPaintEvent>} paints 25 * @param {?Array.<!WebInspector.LayerPaintEvent>} paints
26 */ 26 */
27 showLayerTree: function(deferredLayerTree, paints) 27 showLayerTree: function(deferredLayerTree, paints)
28 { 28 {
29 this._disposeTiles(); 29 this._disposeTiles();
30 if (!this.isShowing()) { 30 this._deferredLayerTree = deferredLayerTree;
31 this._pendingLayerTree = deferredLayerTree, 31 this._paints = paints;
32 this._pendingPaints = paints; 32 if (this.isShowing())
33 return; 33 this._update();
34 } 34 else
35 this._actuallyShowLayerTree(deferredLayerTree, paints); 35 this._updateWhenVisible = true;
36 }, 36 },
37 37
38 wasShown: function() 38 wasShown: function()
39 { 39 {
40 if (!this._pendingLayerTree) 40 if (this._updateWhenVisible) {
41 return; 41 this._updateWhenVisible = false;
42 this._actuallyShowLayerTree(this._pendingLayerTree, this._pendingPaints) ; 42 this._update();
43 this._pendingLayerTree = null; 43 }
44 this._pendingPaints = null;
45 }, 44 },
46 45
47 /** 46 _update: function()
48 * @param {!WebInspector.DeferredLayerTree} deferredLayerTree
49 * @param {?Array.<!WebInspector.LayerPaintEvent>} paints
50 */
51 _actuallyShowLayerTree: function(deferredLayerTree, paints)
52 { 47 {
53 var layerTree; 48 var layerTree;
54 49
55 this._target = deferredLayerTree.target(); 50 this._target = this._deferredLayerTree.target();
56 var originalTiles = this._paintTiles; 51 var originalTiles = this._paintTiles;
57 var tilesReadyBarrier = new CallbackBarrier(); 52 var tilesReadyBarrier = new CallbackBarrier();
58 deferredLayerTree.resolve(tilesReadyBarrier.createCallback(onLayersReady )); 53 this._deferredLayerTree.resolve(tilesReadyBarrier.createCallback(onLayer sReady));
59 for (var i = 0; paints && i < paints.length; ++i) 54 for (var i = 0; this._paints && i < this._paints.length; ++i)
60 WebInspector.PaintProfilerSnapshot.load(paints[i].picture, tilesRead yBarrier.createCallback(onSnapshotLoaded.bind(this, paints[i]))); 55 WebInspector.PaintProfilerSnapshot.load(this._target, this._paints[i ].picture, tilesReadyBarrier.createCallback(onSnapshotLoaded.bind(this, this._pa ints[i])));
61 tilesReadyBarrier.callWhenDone(onLayersAndTilesReady.bind(this)); 56 tilesReadyBarrier.callWhenDone(onLayersAndTilesReady.bind(this));
62 57
63 /** 58 /**
64 * @param {!WebInspector.LayerTreeBase} resolvedLayerTree 59 * @param {!WebInspector.LayerTreeBase} resolvedLayerTree
65 */ 60 */
66 function onLayersReady(resolvedLayerTree) 61 function onLayersReady(resolvedLayerTree)
67 { 62 {
68 layerTree = resolvedLayerTree; 63 layerTree = resolvedLayerTree;
69 } 64 }
70 65
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 144
150 _disposeTiles: function() 145 _disposeTiles: function()
151 { 146 {
152 for (var i = 0; i < this._paintTiles.length; ++i) 147 for (var i = 0; i < this._paintTiles.length; ++i)
153 this._paintTiles[i].snapshot.dispose(); 148 this._paintTiles[i].snapshot.dispose();
154 this._paintTiles = []; 149 this._paintTiles = [];
155 }, 150 },
156 151
157 __proto__: WebInspector.VBox.prototype 152 __proto__: WebInspector.VBox.prototype
158 } 153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698