OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 this._enabled = false; | 75 this._enabled = false; |
76 this._layerTree = null; | 76 this._layerTree = null; |
77 LayerTreeAgent.disable(); | 77 LayerTreeAgent.disable(); |
78 }, | 78 }, |
79 | 79 |
80 enable: function() | 80 enable: function() |
81 { | 81 { |
82 if (this._enabled) | 82 if (this._enabled) |
83 return; | 83 return; |
84 this._enabled = true; | 84 this._enabled = true; |
85 this._layerTree = new WebInspector.AgentLayerTree(this._target); | 85 this._layerTree = new WebInspector.AgentLayerTree(this.target()); |
86 this._lastPaintRectByLayerId = {}; | 86 this._lastPaintRectByLayerId = {}; |
87 LayerTreeAgent.enable(); | 87 LayerTreeAgent.enable(); |
88 }, | 88 }, |
89 | 89 |
90 /** | 90 /** |
91 * @param {!WebInspector.LayerTreeBase} layerTree | 91 * @param {!WebInspector.LayerTreeBase} layerTree |
92 */ | 92 */ |
93 setLayerTree: function(layerTree) | 93 setLayerTree: function(layerTree) |
94 { | 94 { |
95 this.disable(); | 95 this.disable(); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 var layer = /** @type {?WebInspector.TracingLayer} */ (oldLayersById[pay
load.layer_id]); | 314 var layer = /** @type {?WebInspector.TracingLayer} */ (oldLayersById[pay
load.layer_id]); |
315 if (layer) | 315 if (layer) |
316 layer._reset(payload); | 316 layer._reset(payload); |
317 else | 317 else |
318 layer = new WebInspector.TracingLayer(payload); | 318 layer = new WebInspector.TracingLayer(payload); |
319 this._layersById[payload.layer_id] = layer; | 319 this._layersById[payload.layer_id] = layer; |
320 if (!this._contentRoot && payload.draws_content) | 320 if (!this._contentRoot && payload.draws_content) |
321 this._contentRoot = layer; | 321 this._contentRoot = layer; |
322 | 322 |
323 if (payload.owner_node && this._backendNodeIdToNodeId[payload.owner_node
]) | 323 if (payload.owner_node && this._backendNodeIdToNodeId[payload.owner_node
]) |
324 layer._setNode(this._target.domModel.nodeForId(this._backendNodeIdTo
NodeId[payload.owner_node])); | 324 layer._setNode(this.target().domModel.nodeForId(this._backendNodeIdT
oNodeId[payload.owner_node])); |
325 | 325 |
326 for (var i = 0; payload.children && i < payload.children.length; ++i) | 326 for (var i = 0; payload.children && i < payload.children.length; ++i) |
327 layer.addChild(this._innerSetLayers(oldLayersById, payload.children[
i])); | 327 layer.addChild(this._innerSetLayers(oldLayersById, payload.children[
i])); |
328 return layer; | 328 return layer; |
329 }, | 329 }, |
330 | 330 |
331 /** | 331 /** |
332 * @param {!Array.<number>} nodeIdsToResolve | 332 * @param {!Array.<number>} nodeIdsToResolve |
333 * @param {!Object} seenNodeIds | 333 * @param {!Object} seenNodeIds |
334 * @param {!WebInspector.TracingLayerPayload} payload | 334 * @param {!WebInspector.TracingLayerPayload} payload |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 this._layersById = {}; | 404 this._layersById = {}; |
405 for (var i = 0; i < layers.length; ++i) { | 405 for (var i = 0; i < layers.length; ++i) { |
406 var layerId = layers[i].layerId; | 406 var layerId = layers[i].layerId; |
407 var layer = oldLayersById[layerId]; | 407 var layer = oldLayersById[layerId]; |
408 if (layer) | 408 if (layer) |
409 layer._reset(layers[i]); | 409 layer._reset(layers[i]); |
410 else | 410 else |
411 layer = new WebInspector.AgentLayer(layers[i]); | 411 layer = new WebInspector.AgentLayer(layers[i]); |
412 this._layersById[layerId] = layer; | 412 this._layersById[layerId] = layer; |
413 if (layers[i].backendNodeId) { | 413 if (layers[i].backendNodeId) { |
414 layer._setNode(this._target.domModel.nodeForId(this._backendNode
IdToNodeId[layers[i].backendNodeId])); | 414 layer._setNode(this.target().domModel.nodeForId(this._backendNod
eIdToNodeId[layers[i].backendNodeId])); |
415 if (!this._contentRoot) | 415 if (!this._contentRoot) |
416 this._contentRoot = layer; | 416 this._contentRoot = layer; |
417 } | 417 } |
418 var parentId = layer.parentId(); | 418 var parentId = layer.parentId(); |
419 if (parentId) { | 419 if (parentId) { |
420 var parent = this._layersById[parentId]; | 420 var parent = this._layersById[parentId]; |
421 if (!parent) | 421 if (!parent) |
422 console.assert(parent, "missing parent " + parentId + " for
layer " + layerId); | 422 console.assert(parent, "missing parent " + parentId + " for
layer " + layerId); |
423 parent.addChild(layer); | 423 parent.addChild(layer); |
424 } else { | 424 } else { |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 | 1178 |
1179 /** | 1179 /** |
1180 * @param {!LayerTreeAgent.LayerId} layerId | 1180 * @param {!LayerTreeAgent.LayerId} layerId |
1181 * @param {!DOMAgent.Rect} clipRect | 1181 * @param {!DOMAgent.Rect} clipRect |
1182 */ | 1182 */ |
1183 layerPainted: function(layerId, clipRect) | 1183 layerPainted: function(layerId, clipRect) |
1184 { | 1184 { |
1185 this._layerTreeModel._layerPainted(layerId, clipRect); | 1185 this._layerTreeModel._layerPainted(layerId, clipRect); |
1186 } | 1186 } |
1187 } | 1187 } |
OLD | NEW |