3 * @extends {WebInspector.SDKModel}
4 * @param {!WebInspector.Target} target
6 WebInspector.HeapProfilerModel = function(target)
8 WebInspector.SDKModel.call(this, WebInspector.HeapProfilerModel, target);
9 target.registerHeapProfilerDispatcher(new WebInspector.HeapProfilerDispatcher(this));
10 this._enabled = false;
11 this._heapProfilerAgent = target.heapProfilerAgent();
14 WebInspector.HeapProfilerModel.Events = {
15 HeapStatsUpdate: "HeapStatsUpdate",
16 LastSeenObjectId: "LastSeenObjectId",
17 AddHeapSnapshotChunk: "AddHeapSnapshotChunk",
18 ReportHeapSnapshotProgress: "ReportHeapSnapshotProgress",
19 ResetProfiles: "ResetProfiles"
22 WebInspector.HeapProfilerModel.prototype = {
30 this._heapProfilerAgent.enable();
34 * @param {!Array.<number>} samples
36 heapStatsUpdate: function(samples)
38 this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.HeapStatsUpdate, samples);
42 * @param {number} lastSeenObjectId
43 * @param {number} timestamp
45 lastSeenObjectId: function(lastSeenObjectId, timestamp)
47 this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.LastSeenObjectId ,{lastSeenObjectId: lastSeenObjectId, timestamp: timestamp});
51 * @param {string} chunk
53 addHeapSnapshotChunk: function(chunk)
55 this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.AddHeapSnapshotChunk, chunk);
59 * @param {number} done
60 * @param {number} total
61 * @param {boolean=} finished
63 reportHeapSnapshotProgress: function(done, total, finished)
65 this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.ReportHeapSnapshotProgress, {done: done, total: total, finished: finished});
68 resetProfiles: function()
70 this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.ResetProfiles);
73 __proto__: WebInspector.SDKModel.prototype
79 * @implements {HeapProfilerAgent.Dispatcher}
81 WebInspector.HeapProfilerDispatcher = function(model)
83 this._heapProfilerModel = model;
86 WebInspector.HeapProfilerDispatcher.prototype = {
89 * @param {!Array.<number>} samples
91 heapStatsUpdate: function(samples)
93 this._heapProfilerModel.heapStatsUpdate(samples);
97 * @param {number} lastSeenObjectId
98 * @param {number} timestamp
100 lastSeenObjectId: function(lastSeenObjectId, timestamp)
102 this._heapProfilerModel.lastSeenObjectId(lastSeenObjectId, timestamp);
106 * @param {string} chunk
108 addHeapSnapshotChunk: function(chunk)
110 this._heapProfilerModel.addHeapSnapshotChunk(chunk);
114 * @param {number} done
115 * @param {number} total
116 * @param {boolean=} finished
118 reportHeapSnapshotProgress: function(done, total, finished)
120 this._heapProfilerModel.reportHeapSnapshotProgress(done, total, finished);
123 resetProfiles: function()
125 this._heapProfilerModel.resetProfiles();