| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 if (!layers) | 401 if (!layers) |
| 402 return; | 402 return; |
| 403 var oldLayersById = this._layersById; | 403 var oldLayersById = this._layersById; |
| 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(this.target(), 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._backendNod
eIdToNodeId[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) |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 544 |
| 545 /** | 545 /** |
| 546 * @param {function(!WebInspector.PaintProfilerSnapshot=)} callback | 546 * @param {function(!WebInspector.PaintProfilerSnapshot=)} callback |
| 547 */ | 547 */ |
| 548 requestSnapshot: function(callback) { }, | 548 requestSnapshot: function(callback) { }, |
| 549 } | 549 } |
| 550 | 550 |
| 551 /** | 551 /** |
| 552 * @constructor | 552 * @constructor |
| 553 * @implements {WebInspector.Layer} | 553 * @implements {WebInspector.Layer} |
| 554 * @extends {WebInspector.SDKObject} |
| 555 * @param {!WebInspector.Target} target |
| 554 * @param {!LayerTreeAgent.Layer} layerPayload | 556 * @param {!LayerTreeAgent.Layer} layerPayload |
| 555 */ | 557 */ |
| 556 WebInspector.AgentLayer = function(layerPayload) | 558 WebInspector.AgentLayer = function(target, layerPayload) |
| 557 { | 559 { |
| 560 WebInspector.SDKObject.call(this, target); |
| 558 this._reset(layerPayload); | 561 this._reset(layerPayload); |
| 559 } | 562 } |
| 560 | 563 |
| 561 WebInspector.AgentLayer.prototype = { | 564 WebInspector.AgentLayer.prototype = { |
| 562 /** | 565 /** |
| 563 * @return {string} | 566 * @return {string} |
| 564 */ | 567 */ |
| 565 id: function() | 568 id: function() |
| 566 { | 569 { |
| 567 return this._layerPayload.layerId; | 570 return this._layerPayload.layerId; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 { | 740 { |
| 738 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "Lay
erTreeAgent.reasonsForCompositingLayer(): ", undefined, []); | 741 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "Lay
erTreeAgent.reasonsForCompositingLayer(): ", undefined, []); |
| 739 LayerTreeAgent.compositingReasons(this.id(), wrappedCallback); | 742 LayerTreeAgent.compositingReasons(this.id(), wrappedCallback); |
| 740 }, | 743 }, |
| 741 | 744 |
| 742 /** | 745 /** |
| 743 * @param {function(!WebInspector.PaintProfilerSnapshot=)} callback | 746 * @param {function(!WebInspector.PaintProfilerSnapshot=)} callback |
| 744 */ | 747 */ |
| 745 requestSnapshot: function(callback) | 748 requestSnapshot: function(callback) |
| 746 { | 749 { |
| 747 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "Lay
erTreeAgent.makeSnapshot(): ", WebInspector.PaintProfilerSnapshot); | 750 var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "Lay
erTreeAgent.makeSnapshot(): ", WebInspector.PaintProfilerSnapshot.bind(null, thi
s.target())); |
| 748 LayerTreeAgent.makeSnapshot(this.id(), wrappedCallback); | 751 LayerTreeAgent.makeSnapshot(this.id(), wrappedCallback); |
| 749 }, | 752 }, |
| 750 | 753 |
| 751 /** | 754 /** |
| 752 * @param {!DOMAgent.Rect} rect | 755 * @param {!DOMAgent.Rect} rect |
| 753 */ | 756 */ |
| 754 _didPaint: function(rect) | 757 _didPaint: function(rect) |
| 755 { | 758 { |
| 756 this._lastPaintRect = rect; | 759 this._lastPaintRect = rect; |
| 757 this._paintCount = this.paintCount() + 1; | 760 this._paintCount = this.paintCount() + 1; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 var point = WebInspector.Geometry.multiplyVectorByMatrixAndNormalize
(new WebInspector.Geometry.Vector(vertices[i * 3], vertices[i * 3 + 1], vertices
[i * 3 + 2]), matrix); | 829 var point = WebInspector.Geometry.multiplyVectorByMatrixAndNormalize
(new WebInspector.Geometry.Vector(vertices[i * 3], vertices[i * 3 + 1], vertices
[i * 3 + 2]), matrix); |
| 827 this._quad.push(point.x, point.y); | 830 this._quad.push(point.x, point.y); |
| 828 } | 831 } |
| 829 | 832 |
| 830 function calculateQuadForLayer(layer) | 833 function calculateQuadForLayer(layer) |
| 831 { | 834 { |
| 832 layer._calculateQuad(matrix); | 835 layer._calculateQuad(matrix); |
| 833 } | 836 } |
| 834 | 837 |
| 835 this._children.forEach(calculateQuadForLayer); | 838 this._children.forEach(calculateQuadForLayer); |
| 836 } | 839 }, |
| 840 |
| 841 __proto__: WebInspector.SDKObject.prototype |
| 837 } | 842 } |
| 838 | 843 |
| 839 /** | 844 /** |
| 840 * @constructor | 845 * @constructor |
| 841 * @param {!WebInspector.TracingLayerPayload} payload | 846 * @param {!WebInspector.TracingLayerPayload} payload |
| 842 * @implements {WebInspector.Layer} | 847 * @implements {WebInspector.Layer} |
| 843 */ | 848 */ |
| 844 WebInspector.TracingLayer = function(payload) | 849 WebInspector.TracingLayer = function(payload) |
| 845 { | 850 { |
| 846 this._reset(payload); | 851 this._reset(payload); |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 | 1183 |
| 1179 /** | 1184 /** |
| 1180 * @param {!LayerTreeAgent.LayerId} layerId | 1185 * @param {!LayerTreeAgent.LayerId} layerId |
| 1181 * @param {!DOMAgent.Rect} clipRect | 1186 * @param {!DOMAgent.Rect} clipRect |
| 1182 */ | 1187 */ |
| 1183 layerPainted: function(layerId, clipRect) | 1188 layerPainted: function(layerId, clipRect) |
| 1184 { | 1189 { |
| 1185 this._layerTreeModel._layerPainted(layerId, clipRect); | 1190 this._layerTreeModel._layerPainted(layerId, clipRect); |
| 1186 } | 1191 } |
| 1187 } | 1192 } |
| OLD | NEW |