Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/heap_snapshot_model/HeapSnapshotModel.js

Issue 2626173002: DevTools: Extract HeapSnapshotCommon.js into HeapSnapshotModel module (Closed)
Patch Set: add module.json for modules Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 self['Profiler'] = self['Profiler'] || {}; 31 HeapSnapshotModel.HeapSnapshotProgressEvent = {
32
33 Profiler.HeapSnapshotProgressEvent = {
34 Update: 'ProgressUpdate', 32 Update: 'ProgressUpdate',
35 BrokenSnapshot: 'BrokenSnapshot' 33 BrokenSnapshot: 'BrokenSnapshot'
36 }; 34 };
37 35
38 Profiler.HeapSnapshotCommon = {}; 36 HeapSnapshotModel.baseSystemDistance = 100000000;
39
40 Profiler.HeapSnapshotCommon.baseSystemDistance = 100000000;
41 37
42 /** 38 /**
43 * @unrestricted 39 * @unrestricted
44 */ 40 */
45 Profiler.HeapSnapshotCommon.AllocationNodeCallers = class { 41 HeapSnapshotModel.AllocationNodeCallers = class {
46 /** 42 /**
47 * @param {!Array.<!Profiler.HeapSnapshotCommon.SerializedAllocationNode>} nod esWithSingleCaller 43 * @param {!Array.<!HeapSnapshotModel.SerializedAllocationNode>} nodesWithSing leCaller
48 * @param {!Array.<!Profiler.HeapSnapshotCommon.SerializedAllocationNode>} bra nchingCallers 44 * @param {!Array.<!HeapSnapshotModel.SerializedAllocationNode>} branchingCall ers
49 */ 45 */
50 constructor(nodesWithSingleCaller, branchingCallers) { 46 constructor(nodesWithSingleCaller, branchingCallers) {
51 /** @type {!Array.<!Profiler.HeapSnapshotCommon.SerializedAllocationNode>} * / 47 /** @type {!Array.<!HeapSnapshotModel.SerializedAllocationNode>} */
52 this.nodesWithSingleCaller = nodesWithSingleCaller; 48 this.nodesWithSingleCaller = nodesWithSingleCaller;
53 /** @type {!Array.<!Profiler.HeapSnapshotCommon.SerializedAllocationNode>} * / 49 /** @type {!Array.<!HeapSnapshotModel.SerializedAllocationNode>} */
54 this.branchingCallers = branchingCallers; 50 this.branchingCallers = branchingCallers;
55 } 51 }
56 }; 52 };
57 53
58 /** 54 /**
59 * @unrestricted 55 * @unrestricted
60 */ 56 */
61 Profiler.HeapSnapshotCommon.SerializedAllocationNode = class { 57 HeapSnapshotModel.SerializedAllocationNode = class {
62 /** 58 /**
63 * @param {number} nodeId 59 * @param {number} nodeId
64 * @param {string} functionName 60 * @param {string} functionName
65 * @param {string} scriptName 61 * @param {string} scriptName
66 * @param {number} scriptId 62 * @param {number} scriptId
67 * @param {number} line 63 * @param {number} line
68 * @param {number} column 64 * @param {number} column
69 * @param {number} count 65 * @param {number} count
70 * @param {number} size 66 * @param {number} size
71 * @param {number} liveCount 67 * @param {number} liveCount
(...skipping 22 matching lines...) Expand all
94 /** @type {number} */ 90 /** @type {number} */
95 this.liveSize = liveSize; 91 this.liveSize = liveSize;
96 /** @type {boolean} */ 92 /** @type {boolean} */
97 this.hasChildren = hasChildren; 93 this.hasChildren = hasChildren;
98 } 94 }
99 }; 95 };
100 96
101 /** 97 /**
102 * @unrestricted 98 * @unrestricted
103 */ 99 */
104 Profiler.HeapSnapshotCommon.AllocationStackFrame = class { 100 HeapSnapshotModel.AllocationStackFrame = class {
105 /** 101 /**
106 * @param {string} functionName 102 * @param {string} functionName
107 * @param {string} scriptName 103 * @param {string} scriptName
108 * @param {number} scriptId 104 * @param {number} scriptId
109 * @param {number} line 105 * @param {number} line
110 * @param {number} column 106 * @param {number} column
111 */ 107 */
112 constructor(functionName, scriptName, scriptId, line, column) { 108 constructor(functionName, scriptName, scriptId, line, column) {
113 /** @type {string} */ 109 /** @type {string} */
114 this.functionName = functionName; 110 this.functionName = functionName;
115 /** @type {string} */ 111 /** @type {string} */
116 this.scriptName = scriptName; 112 this.scriptName = scriptName;
117 /** @type {number} */ 113 /** @type {number} */
118 this.scriptId = scriptId; 114 this.scriptId = scriptId;
119 /** @type {number} */ 115 /** @type {number} */
120 this.line = line; 116 this.line = line;
121 /** @type {number} */ 117 /** @type {number} */
122 this.column = column; 118 this.column = column;
123 } 119 }
124 }; 120 };
125 121
126 /** 122 /**
127 * @unrestricted 123 * @unrestricted
128 */ 124 */
129 Profiler.HeapSnapshotCommon.Node = class { 125 HeapSnapshotModel.Node = class {
130 /** 126 /**
131 * @param {number} id 127 * @param {number} id
132 * @param {string} name 128 * @param {string} name
133 * @param {number} distance 129 * @param {number} distance
134 * @param {number} nodeIndex 130 * @param {number} nodeIndex
135 * @param {number} retainedSize 131 * @param {number} retainedSize
136 * @param {number} selfSize 132 * @param {number} selfSize
137 * @param {string} type 133 * @param {string} type
138 */ 134 */
139 constructor(id, name, distance, nodeIndex, retainedSize, selfSize, type) { 135 constructor(id, name, distance, nodeIndex, retainedSize, selfSize, type) {
140 this.id = id; 136 this.id = id;
141 this.name = name; 137 this.name = name;
142 this.distance = distance; 138 this.distance = distance;
143 this.nodeIndex = nodeIndex; 139 this.nodeIndex = nodeIndex;
144 this.retainedSize = retainedSize; 140 this.retainedSize = retainedSize;
145 this.selfSize = selfSize; 141 this.selfSize = selfSize;
146 this.type = type; 142 this.type = type;
147 143
148 this.canBeQueried = false; 144 this.canBeQueried = false;
149 this.detachedDOMTreeNode = false; 145 this.detachedDOMTreeNode = false;
150 } 146 }
151 }; 147 };
152 148
153 /** 149 /**
154 * @unrestricted 150 * @unrestricted
155 */ 151 */
156 Profiler.HeapSnapshotCommon.Edge = class { 152 HeapSnapshotModel.Edge = class {
157 /** 153 /**
158 * @param {string} name 154 * @param {string} name
159 * @param {!Profiler.HeapSnapshotCommon.Node} node 155 * @param {!HeapSnapshotModel.Node} node
160 * @param {string} type 156 * @param {string} type
161 * @param {number} edgeIndex 157 * @param {number} edgeIndex
162 */ 158 */
163 constructor(name, node, type, edgeIndex) { 159 constructor(name, node, type, edgeIndex) {
164 this.name = name; 160 this.name = name;
165 this.node = node; 161 this.node = node;
166 this.type = type; 162 this.type = type;
167 this.edgeIndex = edgeIndex; 163 this.edgeIndex = edgeIndex;
168 } 164 }
169 }; 165 };
170 166
171 /** 167 /**
172 * @unrestricted 168 * @unrestricted
173 */ 169 */
174 Profiler.HeapSnapshotCommon.Aggregate = class { 170 HeapSnapshotModel.Aggregate = class {
175 constructor() { 171 constructor() {
176 /** @type {number} */ 172 /** @type {number} */
177 this.count; 173 this.count;
178 /** @type {number} */ 174 /** @type {number} */
179 this.distance; 175 this.distance;
180 /** @type {number} */ 176 /** @type {number} */
181 this.self; 177 this.self;
182 /** @type {number} */ 178 /** @type {number} */
183 this.maxRet; 179 this.maxRet;
184 /** @type {number} */ 180 /** @type {number} */
185 this.type; 181 this.type;
186 /** @type {string} */ 182 /** @type {string} */
187 this.name; 183 this.name;
188 /** @type {!Array.<number>} */ 184 /** @type {!Array.<number>} */
189 this.idxs; 185 this.idxs;
190 } 186 }
191 }; 187 };
192 188
193 /** 189 /**
194 * @unrestricted 190 * @unrestricted
195 */ 191 */
196 Profiler.HeapSnapshotCommon.AggregateForDiff = class { 192 HeapSnapshotModel.AggregateForDiff = class {
197 constructor() { 193 constructor() {
198 /** @type {!Array.<number>} */ 194 /** @type {!Array.<number>} */
199 this.indexes = []; 195 this.indexes = [];
200 /** @type {!Array.<string>} */ 196 /** @type {!Array.<string>} */
201 this.ids = []; 197 this.ids = [];
202 /** @type {!Array.<number>} */ 198 /** @type {!Array.<number>} */
203 this.selfSizes = []; 199 this.selfSizes = [];
204 } 200 }
205 }; 201 };
206 202
207 /** 203 /**
208 * @unrestricted 204 * @unrestricted
209 */ 205 */
210 Profiler.HeapSnapshotCommon.Diff = class { 206 HeapSnapshotModel.Diff = class {
211 constructor() { 207 constructor() {
212 /** @type {number} */ 208 /** @type {number} */
213 this.addedCount = 0; 209 this.addedCount = 0;
214 /** @type {number} */ 210 /** @type {number} */
215 this.removedCount = 0; 211 this.removedCount = 0;
216 /** @type {number} */ 212 /** @type {number} */
217 this.addedSize = 0; 213 this.addedSize = 0;
218 /** @type {number} */ 214 /** @type {number} */
219 this.removedSize = 0; 215 this.removedSize = 0;
220 /** @type {!Array.<number>} */ 216 /** @type {!Array.<number>} */
221 this.deletedIndexes = []; 217 this.deletedIndexes = [];
222 /** @type {!Array.<number>} */ 218 /** @type {!Array.<number>} */
223 this.addedIndexes = []; 219 this.addedIndexes = [];
224 } 220 }
225 }; 221 };
226 222
227 /** 223 /**
228 * @unrestricted 224 * @unrestricted
229 */ 225 */
230 Profiler.HeapSnapshotCommon.DiffForClass = class { 226 HeapSnapshotModel.DiffForClass = class {
231 constructor() { 227 constructor() {
232 /** @type {number} */ 228 /** @type {number} */
233 this.addedCount; 229 this.addedCount;
234 /** @type {number} */ 230 /** @type {number} */
235 this.removedCount; 231 this.removedCount;
236 /** @type {number} */ 232 /** @type {number} */
237 this.addedSize; 233 this.addedSize;
238 /** @type {number} */ 234 /** @type {number} */
239 this.removedSize; 235 this.removedSize;
240 /** @type {!Array.<number>} */ 236 /** @type {!Array.<number>} */
241 this.deletedIndexes; 237 this.deletedIndexes;
242 /** @type {!Array.<number>} */ 238 /** @type {!Array.<number>} */
243 this.addedIndexes; 239 this.addedIndexes;
244 240
245 /** @type {number} */ 241 /** @type {number} */
246 this.countDelta; 242 this.countDelta;
247 /** @type {number} */ 243 /** @type {number} */
248 this.sizeDelta; 244 this.sizeDelta;
249 } 245 }
250 }; 246 };
251 247
252 /** 248 /**
253 * @unrestricted 249 * @unrestricted
254 */ 250 */
255 Profiler.HeapSnapshotCommon.ComparatorConfig = class { 251 HeapSnapshotModel.ComparatorConfig = class {
256 constructor() { 252 constructor() {
257 /** @type {string} */ 253 /** @type {string} */
258 this.fieldName1; 254 this.fieldName1;
259 /** @type {boolean} */ 255 /** @type {boolean} */
260 this.ascending1; 256 this.ascending1;
261 /** @type {string} */ 257 /** @type {string} */
262 this.fieldName2; 258 this.fieldName2;
263 /** @type {boolean} */ 259 /** @type {boolean} */
264 this.ascending2; 260 this.ascending2;
265 } 261 }
266 }; 262 };
267 263
268 /** 264 /**
269 * @unrestricted 265 * @unrestricted
270 */ 266 */
271 Profiler.HeapSnapshotCommon.WorkerCommand = class { 267 HeapSnapshotModel.WorkerCommand = class {
272 constructor() { 268 constructor() {
273 /** @type {number} */ 269 /** @type {number} */
274 this.callId; 270 this.callId;
275 /** @type {string} */ 271 /** @type {string} */
276 this.disposition; 272 this.disposition;
277 /** @type {number} */ 273 /** @type {number} */
278 this.objectId; 274 this.objectId;
279 /** @type {number} */ 275 /** @type {number} */
280 this.newObjectId; 276 this.newObjectId;
281 /** @type {string} */ 277 /** @type {string} */
282 this.methodName; 278 this.methodName;
283 /** @type {!Array.<*>} */ 279 /** @type {!Array.<*>} */
284 this.methodArguments; 280 this.methodArguments;
285 /** @type {string} */ 281 /** @type {string} */
286 this.source; 282 this.source;
287 } 283 }
288 }; 284 };
289 285
290 /** 286 /**
291 * @unrestricted 287 * @unrestricted
292 */ 288 */
293 Profiler.HeapSnapshotCommon.ItemsRange = class { 289 HeapSnapshotModel.ItemsRange = class {
294 /** 290 /**
295 * @param {number} startPosition 291 * @param {number} startPosition
296 * @param {number} endPosition 292 * @param {number} endPosition
297 * @param {number} totalLength 293 * @param {number} totalLength
298 * @param {!Array.<*>} items 294 * @param {!Array.<*>} items
299 */ 295 */
300 constructor(startPosition, endPosition, totalLength, items) { 296 constructor(startPosition, endPosition, totalLength, items) {
301 /** @type {number} */ 297 /** @type {number} */
302 this.startPosition = startPosition; 298 this.startPosition = startPosition;
303 /** @type {number} */ 299 /** @type {number} */
304 this.endPosition = endPosition; 300 this.endPosition = endPosition;
305 /** @type {number} */ 301 /** @type {number} */
306 this.totalLength = totalLength; 302 this.totalLength = totalLength;
307 /** @type {!Array.<*>} */ 303 /** @type {!Array.<*>} */
308 this.items = items; 304 this.items = items;
309 } 305 }
310 }; 306 };
311 307
312 /** 308 /**
313 * @unrestricted 309 * @unrestricted
314 */ 310 */
315 Profiler.HeapSnapshotCommon.StaticData = class { 311 HeapSnapshotModel.StaticData = class {
316 /** 312 /**
317 * @param {number} nodeCount 313 * @param {number} nodeCount
318 * @param {number} rootNodeIndex 314 * @param {number} rootNodeIndex
319 * @param {number} totalSize 315 * @param {number} totalSize
320 * @param {number} maxJSObjectId 316 * @param {number} maxJSObjectId
321 */ 317 */
322 constructor(nodeCount, rootNodeIndex, totalSize, maxJSObjectId) { 318 constructor(nodeCount, rootNodeIndex, totalSize, maxJSObjectId) {
323 /** @type {number} */ 319 /** @type {number} */
324 this.nodeCount = nodeCount; 320 this.nodeCount = nodeCount;
325 /** @type {number} */ 321 /** @type {number} */
326 this.rootNodeIndex = rootNodeIndex; 322 this.rootNodeIndex = rootNodeIndex;
327 /** @type {number} */ 323 /** @type {number} */
328 this.totalSize = totalSize; 324 this.totalSize = totalSize;
329 /** @type {number} */ 325 /** @type {number} */
330 this.maxJSObjectId = maxJSObjectId; 326 this.maxJSObjectId = maxJSObjectId;
331 } 327 }
332 }; 328 };
333 329
334 /** 330 /**
335 * @unrestricted 331 * @unrestricted
336 */ 332 */
337 Profiler.HeapSnapshotCommon.Statistics = class { 333 HeapSnapshotModel.Statistics = class {
338 constructor() { 334 constructor() {
339 /** @type {number} */ 335 /** @type {number} */
340 this.total; 336 this.total;
341 /** @type {number} */ 337 /** @type {number} */
342 this.v8heap; 338 this.v8heap;
343 /** @type {number} */ 339 /** @type {number} */
344 this.native; 340 this.native;
345 /** @type {number} */ 341 /** @type {number} */
346 this.code; 342 this.code;
347 /** @type {number} */ 343 /** @type {number} */
348 this.jsArrays; 344 this.jsArrays;
349 /** @type {number} */ 345 /** @type {number} */
350 this.strings; 346 this.strings;
351 /** @type {number} */ 347 /** @type {number} */
352 this.system; 348 this.system;
353 } 349 }
354 }; 350 };
355 351
356 /** 352 /**
357 * @unrestricted 353 * @unrestricted
358 */ 354 */
359 Profiler.HeapSnapshotCommon.NodeFilter = class { 355 HeapSnapshotModel.NodeFilter = class {
360 /** 356 /**
361 * @param {number=} minNodeId 357 * @param {number=} minNodeId
362 * @param {number=} maxNodeId 358 * @param {number=} maxNodeId
363 */ 359 */
364 constructor(minNodeId, maxNodeId) { 360 constructor(minNodeId, maxNodeId) {
365 /** @type {number|undefined} */ 361 /** @type {number|undefined} */
366 this.minNodeId = minNodeId; 362 this.minNodeId = minNodeId;
367 /** @type {number|undefined} */ 363 /** @type {number|undefined} */
368 this.maxNodeId = maxNodeId; 364 this.maxNodeId = maxNodeId;
369 /** @type {number|undefined} */ 365 /** @type {number|undefined} */
370 this.allocationNodeId; 366 this.allocationNodeId;
371 } 367 }
372 368
373 /** 369 /**
374 * @param {!Profiler.HeapSnapshotCommon.NodeFilter} o 370 * @param {!HeapSnapshotModel.NodeFilter} o
375 * @return {boolean} 371 * @return {boolean}
376 */ 372 */
377 equals(o) { 373 equals(o) {
378 return this.minNodeId === o.minNodeId && this.maxNodeId === o.maxNodeId && 374 return this.minNodeId === o.minNodeId && this.maxNodeId === o.maxNodeId &&
379 this.allocationNodeId === o.allocationNodeId; 375 this.allocationNodeId === o.allocationNodeId;
380 } 376 }
381 }; 377 };
382 378
383 /** 379 /**
384 * @unrestricted 380 * @unrestricted
385 */ 381 */
386 Profiler.HeapSnapshotCommon.SearchConfig = class { 382 HeapSnapshotModel.SearchConfig = class {
387 /** 383 /**
388 * @param {string} query 384 * @param {string} query
389 * @param {boolean} caseSensitive 385 * @param {boolean} caseSensitive
390 * @param {boolean} isRegex 386 * @param {boolean} isRegex
391 * @param {boolean} shouldJump 387 * @param {boolean} shouldJump
392 * @param {boolean} jumpBackward 388 * @param {boolean} jumpBackward
393 */ 389 */
394 constructor(query, caseSensitive, isRegex, shouldJump, jumpBackward) { 390 constructor(query, caseSensitive, isRegex, shouldJump, jumpBackward) {
395 this.query = query; 391 this.query = query;
396 this.caseSensitive = caseSensitive; 392 this.caseSensitive = caseSensitive;
397 this.isRegex = isRegex; 393 this.isRegex = isRegex;
398 this.shouldJump = shouldJump; 394 this.shouldJump = shouldJump;
399 this.jumpBackward = jumpBackward; 395 this.jumpBackward = jumpBackward;
400 } 396 }
401 }; 397 };
402 398
403 /** 399 /**
404 * @unrestricted 400 * @unrestricted
405 */ 401 */
406 Profiler.HeapSnapshotCommon.Samples = class { 402 HeapSnapshotModel.Samples = class {
407 /** 403 /**
408 * @param {!Array.<number>} timestamps 404 * @param {!Array.<number>} timestamps
409 * @param {!Array.<number>} lastAssignedIds 405 * @param {!Array.<number>} lastAssignedIds
410 * @param {!Array.<number>} sizes 406 * @param {!Array.<number>} sizes
411 */ 407 */
412 constructor(timestamps, lastAssignedIds, sizes) { 408 constructor(timestamps, lastAssignedIds, sizes) {
413 this.timestamps = timestamps; 409 this.timestamps = timestamps;
414 this.lastAssignedIds = lastAssignedIds; 410 this.lastAssignedIds = lastAssignedIds;
415 this.sizes = sizes; 411 this.sizes = sizes;
416 } 412 }
417 }; 413 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698