OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (C) 2009 280 North Inc. All Rights Reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions |
| 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. |
| 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ |
| 25 |
| 26 WebInspector.TopDownProfileDataGridNode = function(/*ProfileView*/ profileView,
/*ProfileNode*/ profileNode, /*TopDownProfileDataGridTree*/ owningTree) |
| 27 { |
| 28 var hasChildren = (profileNode.children && profileNode.children.length); |
| 29 |
| 30 WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owning
Tree, hasChildren); |
| 31 |
| 32 this._remainingChildren = profileNode.children; |
| 33 } |
| 34 |
| 35 WebInspector.TopDownProfileDataGridNode.prototype = { |
| 36 _sharedPopulate: function() |
| 37 { |
| 38 var children = this._remainingChildren; |
| 39 var childrenLength = children.length; |
| 40 |
| 41 for (var i = 0; i < childrenLength; ++i) |
| 42 this.appendChild(new WebInspector.TopDownProfileDataGridNode(this.pr
ofileView, children[i], this.tree)); |
| 43 |
| 44 this._remainingChildren = null; |
| 45 }, |
| 46 |
| 47 _exclude: function(aCallUID) |
| 48 { |
| 49 if (this._remainingChildren) |
| 50 this._populate(); |
| 51 |
| 52 this._save(); |
| 53 |
| 54 var children = this.children; |
| 55 var index = this.children.length; |
| 56 |
| 57 while (index--) |
| 58 children[index]._exclude(aCallUID); |
| 59 |
| 60 var child = this.childrenByCallUID[aCallUID]; |
| 61 |
| 62 if (child) |
| 63 this._merge(child, true); |
| 64 } |
| 65 } |
| 66 |
| 67 WebInspector.TopDownProfileDataGridNode.prototype.__proto__ = WebInspector.Profi
leDataGridNode.prototype; |
| 68 |
| 69 WebInspector.TopDownProfileDataGridTree = function(/*ProfileView*/ profileView,
/*ProfileNode*/ profileNode) |
| 70 { |
| 71 WebInspector.ProfileDataGridTree.call(this, profileView, profileNode); |
| 72 |
| 73 this._remainingChildren = profileNode.children; |
| 74 |
| 75 WebInspector.TopDownProfileDataGridNode.prototype._populate.call(this); |
| 76 } |
| 77 |
| 78 WebInspector.TopDownProfileDataGridTree.prototype = { |
| 79 focus: function(/*ProfileDataGridNode*/ profileDataGrideNode) |
| 80 { |
| 81 if (!profileDataGrideNode) |
| 82 return; |
| 83 |
| 84 this._save(); |
| 85 |
| 86 this.children = [profileDataGrideNode]; |
| 87 this.totalTime = profileDataGrideNode.totalTime; |
| 88 }, |
| 89 |
| 90 exclude: function(/*ProfileDataGridNode*/ profileDataGrideNode) |
| 91 { |
| 92 if (!profileDataGrideNode) |
| 93 return; |
| 94 |
| 95 this._save(); |
| 96 |
| 97 var excludedCallUID = profileDataGrideNode.callUID; |
| 98 |
| 99 WebInspector.TopDownProfileDataGridNode.prototype._exclude.call(this, ex
cludedCallUID); |
| 100 |
| 101 if (this.lastComparator) |
| 102 this.sort(this.lastComparator, true); |
| 103 }, |
| 104 |
| 105 _merge: WebInspector.TopDownProfileDataGridNode.prototype._merge, |
| 106 |
| 107 _sharedPopulate: WebInspector.TopDownProfileDataGridNode.prototype._sharedPo
pulate |
| 108 } |
| 109 |
| 110 WebInspector.TopDownProfileDataGridTree.prototype.__proto__ = WebInspector.Profi
leDataGridTree.prototype; |
OLD | NEW |