| 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().weakRefe
rence()); |
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return; | 156 return; |
| 157 this.disable(); | 157 this.disable(); |
| 158 this.enable(); | 158 this.enable(); |
| 159 }, | 159 }, |
| 160 | 160 |
| 161 __proto__: WebInspector.SDKObject.prototype | 161 __proto__: WebInspector.SDKObject.prototype |
| 162 } | 162 } |
| 163 | 163 |
| 164 /** | 164 /** |
| 165 * @constructor | 165 * @constructor |
| 166 * @extends {WebInspector.SDKObject} | 166 * @param {!WeakReference.<!WebInspector.Target>} weakTarget |
| 167 * @param {!WebInspector.Target} target | |
| 168 */ | 167 */ |
| 169 WebInspector.LayerTreeBase = function(target) | 168 WebInspector.LayerTreeBase = function(weakTarget) |
| 170 { | 169 { |
| 171 WebInspector.SDKObject.call(this, target); | 170 this._weakTarget = weakTarget; |
| 172 this._layersById = {}; | 171 this._layersById = {}; |
| 173 this._backendNodeIdToNodeId = {}; | 172 this._backendNodeIdToNodeId = {}; |
| 174 this._reset(); | 173 this._reset(); |
| 175 } | 174 } |
| 176 | 175 |
| 177 WebInspector.LayerTreeBase.prototype = { | 176 WebInspector.LayerTreeBase.prototype = { |
| 178 _reset: function() | 177 _reset: function() |
| 179 { | 178 { |
| 180 this._root = null; | 179 this._root = null; |
| 181 this._contentRoot = null; | 180 this._contentRoot = null; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 { | 219 { |
| 221 return this._layersById[id] || null; | 220 return this._layersById[id] || null; |
| 222 }, | 221 }, |
| 223 | 222 |
| 224 /** | 223 /** |
| 225 * @param {!Array.<number>} requestedNodeIds | 224 * @param {!Array.<number>} requestedNodeIds |
| 226 * @param {function()} callback | 225 * @param {function()} callback |
| 227 */ | 226 */ |
| 228 _resolveBackendNodeIds: function(requestedNodeIds, callback) | 227 _resolveBackendNodeIds: function(requestedNodeIds, callback) |
| 229 { | 228 { |
| 230 if (!requestedNodeIds.length) { | 229 var target = this._weakTarget.get(); |
| 230 if (!requestedNodeIds.length || !target) { |
| 231 callback(); | 231 callback(); |
| 232 return; | 232 return; |
| 233 } | 233 } |
| 234 | 234 |
| 235 this.target().domModel.pushNodesByBackendIdsToFrontend(requestedNodeIds,
populateBackendNodeIdMap.bind(this)); | 235 target.domModel.pushNodesByBackendIdsToFrontend(requestedNodeIds, popula
teBackendNodeIdMap.bind(this)); |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * @this {WebInspector.LayerTreeBase} | 238 * @this {WebInspector.LayerTreeBase} |
| 239 * @param {?Array.<number>} nodeIds | 239 * @param {?Array.<number>} nodeIds |
| 240 */ | 240 */ |
| 241 function populateBackendNodeIdMap(nodeIds) | 241 function populateBackendNodeIdMap(nodeIds) |
| 242 { | 242 { |
| 243 if (nodeIds) { | 243 if (nodeIds) { |
| 244 for (var i = 0; i < requestedNodeIds.length; ++i) { | 244 for (var i = 0; i < requestedNodeIds.length; ++i) { |
| 245 var nodeId = nodeIds[i]; | 245 var nodeId = nodeIds[i]; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 260 }, | 260 }, |
| 261 | 261 |
| 262 /** | 262 /** |
| 263 * @return {!Object | undefined} | 263 * @return {!Object | undefined} |
| 264 */ | 264 */ |
| 265 viewportSize: function() | 265 viewportSize: function() |
| 266 { | 266 { |
| 267 return this._viewportSize; | 267 return this._viewportSize; |
| 268 }, | 268 }, |
| 269 | 269 |
| 270 __proto__: WebInspector.SDKObject.prototype | 270 /** |
| 271 * @param {number} id |
| 272 * @return {?WebInspector.DOMNode} |
| 273 */ |
| 274 _nodeForId: function(id) |
| 275 { |
| 276 var target = this._weakTarget.get(); |
| 277 return target ? target.domModel.nodeForId(id) : null; |
| 278 } |
| 271 }; | 279 }; |
| 272 | 280 |
| 273 /** | 281 /** |
| 274 * @constructor | 282 * @constructor |
| 275 * @extends {WebInspector.LayerTreeBase} | 283 * @extends {WebInspector.LayerTreeBase} |
| 276 * @param {!WebInspector.Target} target | 284 * @param {!WeakReference.<!WebInspector.Target>} weakTarget |
| 277 */ | 285 */ |
| 278 WebInspector.TracingLayerTree = function(target) | 286 WebInspector.TracingLayerTree = function(weakTarget) |
| 279 { | 287 { |
| 280 WebInspector.LayerTreeBase.call(this, target); | 288 WebInspector.LayerTreeBase.call(this, weakTarget); |
| 281 } | 289 } |
| 282 | 290 |
| 283 WebInspector.TracingLayerTree.prototype = { | 291 WebInspector.TracingLayerTree.prototype = { |
| 284 /** | 292 /** |
| 285 * @param {!WebInspector.TracingLayerPayload} root | 293 * @param {!WebInspector.TracingLayerPayload} root |
| 286 * @param {!function()} callback | 294 * @param {!function()} callback |
| 287 */ | 295 */ |
| 288 setLayers: function(root, callback) | 296 setLayers: function(root, callback) |
| 289 { | 297 { |
| 290 var idsToResolve = []; | 298 var idsToResolve = []; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 314 var layer = /** @type {?WebInspector.TracingLayer} */ (oldLayersById[pay
load.layer_id]); | 322 var layer = /** @type {?WebInspector.TracingLayer} */ (oldLayersById[pay
load.layer_id]); |
| 315 if (layer) | 323 if (layer) |
| 316 layer._reset(payload); | 324 layer._reset(payload); |
| 317 else | 325 else |
| 318 layer = new WebInspector.TracingLayer(payload); | 326 layer = new WebInspector.TracingLayer(payload); |
| 319 this._layersById[payload.layer_id] = layer; | 327 this._layersById[payload.layer_id] = layer; |
| 320 if (!this._contentRoot && payload.draws_content) | 328 if (!this._contentRoot && payload.draws_content) |
| 321 this._contentRoot = layer; | 329 this._contentRoot = layer; |
| 322 | 330 |
| 323 if (payload.owner_node && this._backendNodeIdToNodeId[payload.owner_node
]) | 331 if (payload.owner_node && this._backendNodeIdToNodeId[payload.owner_node
]) |
| 324 layer._setNode(this.target().domModel.nodeForId(this._backendNodeIdT
oNodeId[payload.owner_node])); | 332 layer._setNode(this._nodeForId(this._backendNodeIdToNodeId[payload.o
wner_node])); |
| 325 | 333 |
| 326 for (var i = 0; payload.children && i < payload.children.length; ++i) | 334 for (var i = 0; payload.children && i < payload.children.length; ++i) |
| 327 layer.addChild(this._innerSetLayers(oldLayersById, payload.children[
i])); | 335 layer.addChild(this._innerSetLayers(oldLayersById, payload.children[
i])); |
| 328 return layer; | 336 return layer; |
| 329 }, | 337 }, |
| 330 | 338 |
| 331 /** | 339 /** |
| 332 * @param {!Array.<number>} nodeIdsToResolve | 340 * @param {!Array.<number>} nodeIdsToResolve |
| 333 * @param {!Object} seenNodeIds | 341 * @param {!Object} seenNodeIds |
| 334 * @param {!WebInspector.TracingLayerPayload} payload | 342 * @param {!WebInspector.TracingLayerPayload} payload |
| 335 */ | 343 */ |
| 336 _extractNodeIdsToResolve: function(nodeIdsToResolve, seenNodeIds, payload) | 344 _extractNodeIdsToResolve: function(nodeIdsToResolve, seenNodeIds, payload) |
| 337 { | 345 { |
| 338 var backendNodeId = payload.owner_node; | 346 var backendNodeId = payload.owner_node; |
| 339 if (backendNodeId && !seenNodeIds[backendNodeId] && !(this._backendNodeI
dToNodeId[backendNodeId] && this.target().domModel.nodeForId(backendNodeId))) { | 347 if (backendNodeId && !seenNodeIds[backendNodeId] && !(this._backendNodeI
dToNodeId[backendNodeId] && this._nodeForId(backendNodeId))) { |
| 340 seenNodeIds[backendNodeId] = true; | 348 seenNodeIds[backendNodeId] = true; |
| 341 nodeIdsToResolve.push(backendNodeId); | 349 nodeIdsToResolve.push(backendNodeId); |
| 342 } | 350 } |
| 343 for (var i = 0; payload.children && i < payload.children.length; ++i) | 351 for (var i = 0; payload.children && i < payload.children.length; ++i) |
| 344 this._extractNodeIdsToResolve(nodeIdsToResolve, seenNodeIds, payload
.children[i]); | 352 this._extractNodeIdsToResolve(nodeIdsToResolve, seenNodeIds, payload
.children[i]); |
| 345 }, | 353 }, |
| 346 | 354 |
| 347 __proto__: WebInspector.LayerTreeBase.prototype | 355 __proto__: WebInspector.LayerTreeBase.prototype |
| 348 } | 356 } |
| 349 | 357 |
| 350 /** | 358 /** |
| 351 * @constructor | 359 * @constructor |
| 360 * @param {!WeakReference.<!WebInspector.Target>} weakTarget |
| 352 * @extends {WebInspector.LayerTreeBase} | 361 * @extends {WebInspector.LayerTreeBase} |
| 353 */ | 362 */ |
| 354 WebInspector.AgentLayerTree = function(target) | 363 WebInspector.AgentLayerTree = function(weakTarget) |
| 355 { | 364 { |
| 356 WebInspector.LayerTreeBase.call(this, target); | 365 WebInspector.LayerTreeBase.call(this, weakTarget); |
| 357 } | 366 } |
| 358 | 367 |
| 359 WebInspector.AgentLayerTree.prototype = { | 368 WebInspector.AgentLayerTree.prototype = { |
| 360 /** | 369 /** |
| 361 * @param {?Array.<!LayerTreeAgent.Layer>} payload | 370 * @param {?Array.<!LayerTreeAgent.Layer>} payload |
| 362 * @param {function()} callback | 371 * @param {function()} callback |
| 363 */ | 372 */ |
| 364 setLayers: function(payload, callback) | 373 setLayers: function(payload, callback) |
| 365 { | 374 { |
| 366 if (!payload) { | 375 if (!payload) { |
| 367 onBackendNodeIdsResolved.call(this); | 376 onBackendNodeIdsResolved.call(this); |
| 368 return; | 377 return; |
| 369 } | 378 } |
| 370 | 379 |
| 371 var idsToResolve = {}; | 380 var idsToResolve = {}; |
| 372 var requestedIds = []; | 381 var requestedIds = []; |
| 373 for (var i = 0; i < payload.length; ++i) { | 382 for (var i = 0; i < payload.length; ++i) { |
| 374 var backendNodeId = payload[i].backendNodeId; | 383 var backendNodeId = payload[i].backendNodeId; |
| 375 if (!backendNodeId || idsToResolve[backendNodeId] || | 384 if (!backendNodeId || idsToResolve[backendNodeId] || |
| 376 (this._backendNodeIdToNodeId[backendNodeId] && this.target().dom
Model.nodeForId(this._backendNodeIdToNodeId[backendNodeId]))) { | 385 (this._backendNodeIdToNodeId[backendNodeId] && this._nodeForId(t
his._backendNodeIdToNodeId[backendNodeId]))) { |
| 377 continue; | 386 continue; |
| 378 } | 387 } |
| 379 idsToResolve[backendNodeId] = true; | 388 idsToResolve[backendNodeId] = true; |
| 380 requestedIds.push(backendNodeId); | 389 requestedIds.push(backendNodeId); |
| 381 } | 390 } |
| 382 this._resolveBackendNodeIds(requestedIds, onBackendNodeIdsResolved.bind(
this)); | 391 this._resolveBackendNodeIds(requestedIds, onBackendNodeIdsResolved.bind(
this)); |
| 383 | 392 |
| 384 /** | 393 /** |
| 385 * @this {WebInspector.AgentLayerTree} | 394 * @this {WebInspector.AgentLayerTree} |
| 386 */ | 395 */ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 401 if (!layers) | 410 if (!layers) |
| 402 return; | 411 return; |
| 403 var oldLayersById = this._layersById; | 412 var oldLayersById = this._layersById; |
| 404 this._layersById = {}; | 413 this._layersById = {}; |
| 405 for (var i = 0; i < layers.length; ++i) { | 414 for (var i = 0; i < layers.length; ++i) { |
| 406 var layerId = layers[i].layerId; | 415 var layerId = layers[i].layerId; |
| 407 var layer = oldLayersById[layerId]; | 416 var layer = oldLayersById[layerId]; |
| 408 if (layer) | 417 if (layer) |
| 409 layer._reset(layers[i]); | 418 layer._reset(layers[i]); |
| 410 else | 419 else |
| 411 layer = new WebInspector.AgentLayer(layers[i]); | 420 layer = new WebInspector.AgentLayer(this._weakTarget, layers[i])
; |
| 412 this._layersById[layerId] = layer; | 421 this._layersById[layerId] = layer; |
| 413 if (layers[i].backendNodeId) { | 422 if (layers[i].backendNodeId) { |
| 414 layer._setNode(this.target().domModel.nodeForId(this._backendNod
eIdToNodeId[layers[i].backendNodeId])); | 423 layer._setNode(this._nodeForId(this._backendNodeIdToNodeId[layer
s[i].backendNodeId])); |
| 415 if (!this._contentRoot) | 424 if (!this._contentRoot) |
| 416 this._contentRoot = layer; | 425 this._contentRoot = layer; |
| 417 } | 426 } |
| 418 var parentId = layer.parentId(); | 427 var parentId = layer.parentId(); |
| 419 if (parentId) { | 428 if (parentId) { |
| 420 var parent = this._layersById[parentId]; | 429 var parent = this._layersById[parentId]; |
| 421 if (!parent) | 430 if (!parent) |
| 422 console.assert(parent, "missing parent " + parentId + " for
layer " + layerId); | 431 console.assert(parent, "missing parent " + parentId + " for
layer " + layerId); |
| 423 parent.addChild(layer); | 432 parent.addChild(layer); |
| 424 } else { | 433 } else { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 553 |
| 545 /** | 554 /** |
| 546 * @param {function(!WebInspector.PaintProfilerSnapshot=)} callback | 555 * @param {function(!WebInspector.PaintProfilerSnapshot=)} callback |
| 547 */ | 556 */ |
| 548 requestSnapshot: function(callback) { }, | 557 requestSnapshot: function(callback) { }, |
| 549 } | 558 } |
| 550 | 559 |
| 551 /** | 560 /** |
| 552 * @constructor | 561 * @constructor |
| 553 * @implements {WebInspector.Layer} | 562 * @implements {WebInspector.Layer} |
| 563 * @param {!WeakReference.<!WebInspector.Target>} weakTarget |
| 554 * @param {!LayerTreeAgent.Layer} layerPayload | 564 * @param {!LayerTreeAgent.Layer} layerPayload |
| 555 */ | 565 */ |
| 556 WebInspector.AgentLayer = function(layerPayload) | 566 WebInspector.AgentLayer = function(weakTarget, layerPayload) |
| 557 { | 567 { |
| 568 this._weakTarget = weakTarget; |
| 558 this._reset(layerPayload); | 569 this._reset(layerPayload); |
| 559 } | 570 } |
| 560 | 571 |
| 561 WebInspector.AgentLayer.prototype = { | 572 WebInspector.AgentLayer.prototype = { |
| 562 /** | 573 /** |
| 563 * @return {string} | 574 * @return {string} |
| 564 */ | 575 */ |
| 565 id: function() | 576 id: function() |
| 566 { | 577 { |
| 567 return this._layerPayload.layerId; | 578 return this._layerPayload.layerId; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 { | 748 { |
| 738 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "Lay
erTreeAgent.reasonsForCompositingLayer(): ", undefined, []); | 749 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "Lay
erTreeAgent.reasonsForCompositingLayer(): ", undefined, []); |
| 739 LayerTreeAgent.compositingReasons(this.id(), wrappedCallback); | 750 LayerTreeAgent.compositingReasons(this.id(), wrappedCallback); |
| 740 }, | 751 }, |
| 741 | 752 |
| 742 /** | 753 /** |
| 743 * @param {function(!WebInspector.PaintProfilerSnapshot=)} callback | 754 * @param {function(!WebInspector.PaintProfilerSnapshot=)} callback |
| 744 */ | 755 */ |
| 745 requestSnapshot: function(callback) | 756 requestSnapshot: function(callback) |
| 746 { | 757 { |
| 747 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "Lay
erTreeAgent.makeSnapshot(): ", WebInspector.PaintProfilerSnapshot); | 758 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "Lay
erTreeAgent.makeSnapshot(): ", WebInspector.PaintProfilerSnapshot.bind(null, thi
s._weakTarget)); |
| 748 LayerTreeAgent.makeSnapshot(this.id(), wrappedCallback); | 759 LayerTreeAgent.makeSnapshot(this.id(), wrappedCallback); |
| 749 }, | 760 }, |
| 750 | 761 |
| 751 /** | 762 /** |
| 752 * @param {!DOMAgent.Rect} rect | 763 * @param {!DOMAgent.Rect} rect |
| 753 */ | 764 */ |
| 754 _didPaint: function(rect) | 765 _didPaint: function(rect) |
| 755 { | 766 { |
| 756 this._lastPaintRect = rect; | 767 this._lastPaintRect = rect; |
| 757 this._paintCount = this.paintCount() + 1; | 768 this._paintCount = this.paintCount() + 1; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 */ | 1086 */ |
| 1076 requestSnapshot: function(callback) | 1087 requestSnapshot: function(callback) |
| 1077 { | 1088 { |
| 1078 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "Lay
erTreeAgent.makeSnapshot(): ", WebInspector.PaintProfilerSnapshot); | 1089 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "Lay
erTreeAgent.makeSnapshot(): ", WebInspector.PaintProfilerSnapshot); |
| 1079 LayerTreeAgent.makeSnapshot(this.id(), wrappedCallback); | 1090 LayerTreeAgent.makeSnapshot(this.id(), wrappedCallback); |
| 1080 } | 1091 } |
| 1081 } | 1092 } |
| 1082 | 1093 |
| 1083 /** | 1094 /** |
| 1084 * @constructor | 1095 * @constructor |
| 1085 * @param {!WebInspector.Target} target | 1096 * @param {!WeakReference.<!WebInspector.Target>} weakTarget |
| 1086 */ | 1097 */ |
| 1087 WebInspector.DeferredLayerTree = function(target) | 1098 WebInspector.DeferredLayerTree = function(weakTarget) |
| 1088 { | 1099 { |
| 1089 this._target = target; | 1100 this._weakTarget = weakTarget; |
| 1090 } | 1101 } |
| 1091 | 1102 |
| 1092 WebInspector.DeferredLayerTree.prototype = { | 1103 WebInspector.DeferredLayerTree.prototype = { |
| 1093 /** | 1104 /** |
| 1094 * @param {function(!WebInspector.LayerTreeBase)} callback | 1105 * @param {function(!WebInspector.LayerTreeBase)} callback |
| 1095 */ | 1106 */ |
| 1096 resolve: function(callback) { }, | 1107 resolve: function(callback) { }, |
| 1097 | 1108 |
| 1098 /** | 1109 /** |
| 1099 * @return {!WebInspector.Target} | 1110 * @return {!WeakReference.<!WebInspector.Target>} |
| 1100 */ | 1111 */ |
| 1101 target: function() | 1112 weakTarget: function() |
| 1102 { | 1113 { |
| 1103 return this._target; | 1114 return this._weakTarget; |
| 1104 } | 1115 } |
| 1105 }; | 1116 }; |
| 1106 | 1117 |
| 1107 /** | 1118 /** |
| 1108 * @constructor | 1119 * @constructor |
| 1109 * @extends {WebInspector.DeferredLayerTree} | 1120 * @extends {WebInspector.DeferredLayerTree} |
| 1110 * @param {!WebInspector.Target} target | 1121 * @param {!WeakReference.<!WebInspector.Target>} weakTarget |
| 1111 * @param {!Array.<!LayerTreeAgent.Layer>} layers | 1122 * @param {!Array.<!LayerTreeAgent.Layer>} layers |
| 1112 */ | 1123 */ |
| 1113 WebInspector.DeferredAgentLayerTree = function(target, layers) | 1124 WebInspector.DeferredAgentLayerTree = function(weakTarget, layers) |
| 1114 { | 1125 { |
| 1115 WebInspector.DeferredLayerTree.call(this, target); | 1126 WebInspector.DeferredLayerTree.call(this, weakTarget); |
| 1116 this._layers = layers; | 1127 this._layers = layers; |
| 1117 } | 1128 } |
| 1118 | 1129 |
| 1119 WebInspector.DeferredAgentLayerTree.prototype = { | 1130 WebInspector.DeferredAgentLayerTree.prototype = { |
| 1120 /** | 1131 /** |
| 1121 * @param {function(!WebInspector.LayerTreeBase)} callback | 1132 * @param {function(!WebInspector.LayerTreeBase)} callback |
| 1122 */ | 1133 */ |
| 1123 resolve: function(callback) | 1134 resolve: function(callback) |
| 1124 { | 1135 { |
| 1125 var result = new WebInspector.AgentLayerTree(this._target); | 1136 var result = new WebInspector.AgentLayerTree(this._weakTarget); |
| 1126 result.setLayers(this._layers, callback.bind(null, result)); | 1137 result.setLayers(this._layers, callback.bind(null, result)); |
| 1127 }, | 1138 }, |
| 1128 | 1139 |
| 1129 __proto__: WebInspector.DeferredLayerTree.prototype | 1140 __proto__: WebInspector.DeferredLayerTree.prototype |
| 1130 }; | 1141 }; |
| 1131 | 1142 |
| 1132 /** | 1143 /** |
| 1133 * @constructor | 1144 * @constructor |
| 1134 * @extends {WebInspector.DeferredLayerTree} | 1145 * @extends {WebInspector.DeferredLayerTree} |
| 1135 * @param {!WebInspector.Target} target | 1146 * @param {!WeakReference.<!WebInspector.Target>} weakTarget |
| 1136 * @param {!WebInspector.TracingLayerPayload} root | 1147 * @param {!WebInspector.TracingLayerPayload} root |
| 1137 * @param {!Object} viewportSize | 1148 * @param {!Object} viewportSize |
| 1138 */ | 1149 */ |
| 1139 WebInspector.DeferredTracingLayerTree = function(target, root, viewportSize) | 1150 WebInspector.DeferredTracingLayerTree = function(weakTarget, root, viewportSize) |
| 1140 { | 1151 { |
| 1141 WebInspector.DeferredLayerTree.call(this, target); | 1152 WebInspector.DeferredLayerTree.call(this, weakTarget); |
| 1142 this._root = root; | 1153 this._root = root; |
| 1143 this._viewportSize = viewportSize; | 1154 this._viewportSize = viewportSize; |
| 1144 } | 1155 } |
| 1145 | 1156 |
| 1146 WebInspector.DeferredTracingLayerTree.prototype = { | 1157 WebInspector.DeferredTracingLayerTree.prototype = { |
| 1147 /** | 1158 /** |
| 1148 * @param {function(!WebInspector.LayerTreeBase)} callback | 1159 * @param {function(!WebInspector.LayerTreeBase)} callback |
| 1149 */ | 1160 */ |
| 1150 resolve: function(callback) | 1161 resolve: function(callback) |
| 1151 { | 1162 { |
| 1152 var result = new WebInspector.TracingLayerTree(this._target); | 1163 var result = new WebInspector.TracingLayerTree(this._weakTarget); |
| 1153 result.setViewportSize(this._viewportSize); | 1164 result.setViewportSize(this._viewportSize); |
| 1154 result.setLayers(this._root, callback.bind(null, result)); | 1165 result.setLayers(this._root, callback.bind(null, result)); |
| 1155 }, | 1166 }, |
| 1156 | 1167 |
| 1157 __proto__: WebInspector.DeferredLayerTree.prototype | 1168 __proto__: WebInspector.DeferredLayerTree.prototype |
| 1158 }; | 1169 }; |
| 1159 | 1170 |
| 1160 /** | 1171 /** |
| 1161 * @constructor | 1172 * @constructor |
| 1162 * @implements {LayerTreeAgent.Dispatcher} | 1173 * @implements {LayerTreeAgent.Dispatcher} |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1178 | 1189 |
| 1179 /** | 1190 /** |
| 1180 * @param {!LayerTreeAgent.LayerId} layerId | 1191 * @param {!LayerTreeAgent.LayerId} layerId |
| 1181 * @param {!DOMAgent.Rect} clipRect | 1192 * @param {!DOMAgent.Rect} clipRect |
| 1182 */ | 1193 */ |
| 1183 layerPainted: function(layerId, clipRect) | 1194 layerPainted: function(layerId, clipRect) |
| 1184 { | 1195 { |
| 1185 this._layerTreeModel._layerPainted(layerId, clipRect); | 1196 this._layerTreeModel._layerPainted(layerId, clipRect); |
| 1186 } | 1197 } |
| 1187 } | 1198 } |
| OLD | NEW |