Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/timeline_model/LayerTreeModel.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/timeline_model/LayerTreeModel.js b/third_party/WebKit/Source/devtools/front_end/timeline_model/LayerTreeModel.js |
| index 76e297df6f023a25519420fb52eeb21e3ca7d90c..da15be2397503abb367dc6be4ebafc0f2060a0ad 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/timeline_model/LayerTreeModel.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/timeline_model/LayerTreeModel.js |
| @@ -194,6 +194,7 @@ WebInspector.LayerTreeBase.prototype = { |
| { |
| this._root = null; |
| this._contentRoot = null; |
| + this._layers = null; |
| }, |
| /** |
| @@ -221,6 +222,14 @@ WebInspector.LayerTreeBase.prototype = { |
| }, |
| /** |
| + * @return {!Array.<!WebInspector.Layer>} |
| + */ |
| + layers: function() |
| + { |
| + return this._layers; |
| + }, |
| + |
| + /** |
| * @param {function(!WebInspector.Layer)} callback |
| * @param {?WebInspector.Layer=} root |
| * @return {boolean} |
| @@ -312,12 +321,18 @@ WebInspector.TracingLayerTree = function(target) |
| WebInspector.TracingLayerTree.prototype = { |
| /** |
| * @param {!WebInspector.TracingLayerPayload} root |
| + * @param {?Array.<!WebInspector.TracingLayerPayload>} layers |
| * @param {function()} callback |
| */ |
| - setLayers: function(root, callback) |
| + setLayers: function(root, layers, callback) |
| { |
| var idsToResolve = new Set(); |
| - this._extractNodeIdsToResolve(idsToResolve, {}, root); |
| + if (root) { |
| + this._extractNodeIdsToResolve(idsToResolve, {}, root); |
| + } else { |
| + for (var i = 0; i < layers.length; ++i) |
| + this._extractNodeIdsToResolve(idsToResolve, {}, layers[i]); |
| + } |
| this._resolveBackendNodeIds(idsToResolve, onBackendNodeIdsResolved.bind(this)); |
| /** |
| @@ -328,7 +343,21 @@ WebInspector.TracingLayerTree.prototype = { |
| var oldLayersById = this._layersById; |
| this._layersById = {}; |
| this._contentRoot = null; |
| - this._root = this._innerSetLayers(oldLayersById, root); |
| + if (root) { |
| + this._root = this._innerSetLayers(oldLayersById, root); |
| + } else { |
| + this._layers = []; |
| + for (var i = 0; i < layers.length; ++i) |
| + this._layers.push(this._innerSetLayers(oldLayersById, layers[i])); |
| + if (layers.length > 0) { |
| + this._root = this._contentRoot; |
|
sunxd
2016/05/31 14:52:17
Before this line, the layer tree has no root, but
|
| + for (var i = 0; i < this._layers.length; ++i) { |
| + if (this._layers[i].id() !== this._contentRoot.id()) { |
| + this._contentRoot.addChild(this._layers[i]); |
| + } |
| + } |
| + } |
| + } |
| callback(); |
| } |
| }, |