Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / profiler / HeapSnapshotCommon.js
1 /*
2  * Copyright (C) 2014 Google 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 are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 WebInspector.HeapSnapshotProgressEvent = {
32     Update: "ProgressUpdate",
33     BrokenSnapshot: "BrokenSnapshot"
34 };
35
36 WebInspector.HeapSnapshotCommon = {
37 }
38
39 WebInspector.HeapSnapshotCommon.baseSystemDistance = 100000000;
40
41 /**
42  * @param {!Array.<!WebInspector.HeapSnapshotCommon.SerializedAllocationNode>} nodesWithSingleCaller
43  * @param {!Array.<!WebInspector.HeapSnapshotCommon.SerializedAllocationNode>} branchingCallers
44  * @constructor
45  */
46 WebInspector.HeapSnapshotCommon.AllocationNodeCallers = function(nodesWithSingleCaller, branchingCallers)
47 {
48     /** @type {!Array.<!WebInspector.HeapSnapshotCommon.SerializedAllocationNode>} */
49     this.nodesWithSingleCaller = nodesWithSingleCaller;
50     /** @type {!Array.<!WebInspector.HeapSnapshotCommon.SerializedAllocationNode>} */
51     this.branchingCallers = branchingCallers;
52 }
53
54 /**
55  * @param {number} nodeId
56  * @param {string} functionName
57  * @param {string} scriptName
58  * @param {number} scriptId
59  * @param {number} line
60  * @param {number} column
61  * @param {number} count
62  * @param {number} size
63  * @param {number} liveCount
64  * @param {number} liveSize
65  * @param {boolean} hasChildren
66  * @constructor
67  */
68 WebInspector.HeapSnapshotCommon.SerializedAllocationNode = function(nodeId, functionName, scriptName, scriptId, line, column, count, size, liveCount, liveSize, hasChildren)
69 {
70     /** @type {number} */
71     this.id = nodeId;
72     /** @type {string} */
73     this.name = functionName;
74     /** @type {string} */
75     this.scriptName = scriptName;
76     /** @type {number} */
77     this.scriptId = scriptId;
78     /** @type {number} */
79     this.line = line;
80     /** @type {number} */
81     this.column = column;
82     /** @type {number} */
83     this.count = count;
84     /** @type {number} */
85     this.size = size;
86     /** @type {number} */
87     this.liveCount = liveCount;
88     /** @type {number} */
89     this.liveSize = liveSize;
90     /** @type {boolean} */
91     this.hasChildren = hasChildren;
92 }
93
94 /**
95  * @param {string} functionName
96  * @param {string} scriptName
97  * @param {number} scriptId
98  * @param {number} line
99  * @param {number} column
100  * @constructor
101  */
102 WebInspector.HeapSnapshotCommon.AllocationStackFrame = function(functionName, scriptName, scriptId, line, column)
103 {
104     /** @type {string} */
105     this.functionName = functionName;
106     /** @type {string} */
107     this.scriptName = scriptName;
108     /** @type {number} */
109     this.scriptId = scriptId;
110     /** @type {number} */
111     this.line = line;
112     /** @type {number} */
113     this.column = column;
114 }
115
116 /**
117  * @constructor
118  * @param {number} id
119  * @param {string} name
120  * @param {number} distance
121  * @param {number} nodeIndex
122  * @param {number} retainedSize
123  * @param {number} selfSize
124  * @param {string} type
125  */
126 WebInspector.HeapSnapshotCommon.Node = function(id, name, distance, nodeIndex, retainedSize, selfSize, type)
127 {
128     this.id = id;
129     this.name = name;
130     this.distance = distance;
131     this.nodeIndex = nodeIndex;
132     this.retainedSize = retainedSize;
133     this.selfSize = selfSize;
134     this.type = type;
135
136     this.canBeQueried = false;
137     this.detachedDOMTreeNode = false;
138 }
139
140 /**
141  * @constructor
142  * @param {string} name
143  * @param {!WebInspector.HeapSnapshotCommon.Node} node
144  * @param {string} type
145  * @param {number} edgeIndex
146  */
147 WebInspector.HeapSnapshotCommon.Edge = function(name, node, type, edgeIndex)
148 {
149     this.name = name;
150     this.node = node;
151     this.type = type;
152     this.edgeIndex = edgeIndex;
153 };
154
155 /**
156  * @constructor
157  */
158 WebInspector.HeapSnapshotCommon.Aggregate = function()
159 {
160     /** @type {number} */
161     this.count;
162     /** @type {number} */
163     this.distance;
164     /** @type {number} */
165     this.self;
166     /** @type {number} */
167     this.maxRet;
168     /** @type {number} */
169     this.type;
170     /** @type {string} */
171     this.name;
172     /** @type {!Array.<number>} */
173     this.idxs;
174 }
175
176 /**
177  * @constructor
178  */
179 WebInspector.HeapSnapshotCommon.AggregateForDiff = function() {
180     /** @type {!Array.<number>} */
181     this.indexes = [];
182     /** @type {!Array.<string>} */
183     this.ids = [];
184     /** @type {!Array.<number>} */
185     this.selfSizes = [];
186 }
187
188 /**
189  * @constructor
190  */
191 WebInspector.HeapSnapshotCommon.Diff = function()
192 {
193     /** @type {number} */
194     this.addedCount = 0;
195     /** @type {number} */
196     this.removedCount = 0;
197     /** @type {number} */
198     this.addedSize = 0;
199     /** @type {number} */
200     this.removedSize = 0;
201     /** @type {!Array.<number>} */
202     this.deletedIndexes = [];
203     /** @type {!Array.<number>} */
204     this.addedIndexes = [];
205 }
206
207 /**
208  * @constructor
209  */
210 WebInspector.HeapSnapshotCommon.DiffForClass = function()
211 {
212     /** @type {number} */
213     this.addedCount;
214     /** @type {number} */
215     this.removedCount;
216     /** @type {number} */
217     this.addedSize;
218     /** @type {number} */
219     this.removedSize;
220     /** @type {!Array.<number>} */
221     this.deletedIndexes;
222     /** @type {!Array.<number>} */
223     this.addedIndexes;
224
225     /** @type {number} */
226     this.countDelta;
227     /** @type {number} */
228     this.sizeDelta;
229 }
230
231 /**
232  * @constructor
233  */
234 WebInspector.HeapSnapshotCommon.ComparatorConfig = function()
235 {
236     /** @type {string} */
237     this.fieldName1;
238     /** @type {boolean} */
239     this.ascending1;
240     /** @type {string} */
241     this.fieldName2;
242     /** @type {boolean} */
243     this.ascending2;
244 }
245
246 /**
247  * @constructor
248  */
249 WebInspector.HeapSnapshotCommon.WorkerCommand = function()
250 {
251     /** @type {number} */
252     this.callId;
253     /** @type {string} */
254     this.disposition;
255     /** @type {number} */
256     this.objectId;
257     /** @type {number} */
258     this.newObjectId;
259     /** @type {string} */
260     this.methodName;
261     /** @type {!Array.<*>} */
262     this.methodArguments;
263     /** @type {string} */
264     this.source;
265 }
266
267 /**
268  * @constructor
269  * @param {number} startPosition
270  * @param {number} endPosition
271  * @param {number} totalLength
272  * @param {!Array.<*>} items
273  */
274 WebInspector.HeapSnapshotCommon.ItemsRange = function(startPosition, endPosition, totalLength, items)
275 {
276     /** @type {number} */
277     this.startPosition = startPosition;
278     /** @type {number} */
279     this.endPosition = endPosition;
280     /** @type {number} */
281     this.totalLength = totalLength;
282     /** @type {!Array.<*>} */
283     this.items = items;
284 }
285
286 /**
287  * @param {number} nodeCount
288  * @param {number} rootNodeIndex
289  * @param {number} totalSize
290  * @param {number} maxJSObjectId
291  * @constructor
292  */
293 WebInspector.HeapSnapshotCommon.StaticData = function(nodeCount, rootNodeIndex, totalSize, maxJSObjectId)
294 {
295     /** @type {number} */
296     this.nodeCount = nodeCount;
297     /** @type {number} */
298     this.rootNodeIndex = rootNodeIndex;
299     /** @type {number} */
300     this.totalSize = totalSize;
301     /** @type {number} */
302     this.maxJSObjectId = maxJSObjectId;
303 }
304
305 /**
306  * @constructor
307  */
308 WebInspector.HeapSnapshotCommon.Statistics = function()
309 {
310     /** @type {number} */
311     this.total;
312     /** @type {number} */
313     this.v8heap;
314     /** @type {number} */
315     this.native;
316     /** @type {number} */
317     this.code;
318     /** @type {number} */
319     this.jsArrays;
320     /** @type {number} */
321     this.strings;
322 }
323
324
325 /**
326  * @param {number=} minNodeId
327  * @param {number=} maxNodeId
328  * @constructor
329  */
330 WebInspector.HeapSnapshotCommon.NodeFilter = function(minNodeId, maxNodeId)
331 {
332     /** @type {number|undefined} */
333     this.minNodeId = minNodeId;
334     /** @type {number|undefined} */
335     this.maxNodeId = maxNodeId;
336     /** @type {number|undefined} */
337     this.allocationNodeId;
338 }
339
340 WebInspector.HeapSnapshotCommon.NodeFilter.prototype =
341 {
342     /**
343      * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} o
344      * @return {boolean}
345      */
346     equals: function(o)
347     {
348         return this.minNodeId === o.minNodeId && this.maxNodeId === o.maxNodeId && this.allocationNodeId === o.allocationNodeId;
349     }
350 }