1<!DOCTYPE html> 2<!-- 3Copyright 2015 The Chromium Authors. All rights reserved. 4Use of this source code is governed by a BSD-style license that can be 5found in the LICENSE file. 6--> 7 8<link rel="import" href="/tracing/base/base.html"> 9 10<script> 11'use strict'; 12 13tr.exportTo('tr.model', function() { 14 15 /** 16 * HeapEntry represents a single value describing the state of the heap of an 17 * allocator in a single process. 18 * 19 * An entry specifies how much space (e.g. 19 MiB) was allocated in a 20 * particular context, which consists of a codepath (e.g. drawQuad <- draw <- 21 * MessageLoop::RunTask) and an object type (e.g. HTMLImportLoader). 22 * 23 * @{constructor} 24 */ 25 function HeapEntry(heapDump, leafStackFrame, objectTypeName, size) { 26 this.heapDump = heapDump; 27 28 // The leaf stack frame of the associated backtrace (e.g. drawQuad for the 29 // drawQuad <- draw <- MessageLoop::RunTask backtrace). If undefined, the 30 // backtrace is empty. 31 this.leafStackFrame = leafStackFrame; 32 33 // The name of the allocated object type (e.g. 'HTMLImportLoader'). If 34 // undefined, the entry represents the sum over all object types. 35 this.objectTypeName = objectTypeName; 36 37 this.size = size; 38 } 39 40 /** 41 * HeapDump represents a dump of the heap of an allocator in a single process 42 * at a particular timestamp. 43 * 44 * @{constructor} 45 */ 46 function HeapDump(processMemoryDump, allocatorName) { 47 this.processMemoryDump = processMemoryDump; 48 this.allocatorName = allocatorName; 49 this.entries = []; 50 } 51 52 HeapDump.prototype = { 53 addEntry: function(leafStackFrame, objectTypeName, size) { 54 var entry = new HeapEntry(this, leafStackFrame, objectTypeName, size); 55 this.entries.push(entry); 56 return entry; 57 } 58 }; 59 60 return { 61 HeapEntry: HeapEntry, 62 HeapDump: HeapDump 63 }; 64}); 65</script> 66