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

Unified Diff: third_party/WebKit/Source/devtools/front_end/timeline_model/LayerTreeModel.js

Issue 1945813002: cc: Make LayerTreeImpl dump layer list to FrameViewer and Devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
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..001735f2215d474ec4a38a63c6ad48fd6eb3e54e 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,20 @@ 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 is a legacy code path for compatibility, as cc is removing
+ // layer tree hierarchy, this code will eventually be removed.
+ 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 +345,17 @@ 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 = layers.map(this._innerSetLayers.bind(this, oldLayersById));
+ this._root = this._contentRoot;
+ for (var i = 0; i < this._layers.length; ++i) {
+ if (this._layers[i].id() !== this._contentRoot.id()) {
+ this._contentRoot.addChild(this._layers[i]);
+ }
+ }
+ }
callback();
}
},

Powered by Google App Engine
This is Rietveld 408576698