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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/HeapProfilerModel.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month 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 * @unrestricted 2 * @unrestricted
3 */ 3 */
4 WebInspector.HeapProfilerModel = class extends WebInspector.SDKModel { 4 SDK.HeapProfilerModel = class extends SDK.SDKModel {
5 /** 5 /**
6 * @param {!WebInspector.Target} target 6 * @param {!SDK.Target} target
7 */ 7 */
8 constructor(target) { 8 constructor(target) {
9 super(WebInspector.HeapProfilerModel, target); 9 super(SDK.HeapProfilerModel, target);
10 target.registerHeapProfilerDispatcher(new WebInspector.HeapProfilerDispatche r(this)); 10 target.registerHeapProfilerDispatcher(new SDK.HeapProfilerDispatcher(this));
11 this._enabled = false; 11 this._enabled = false;
12 this._heapProfilerAgent = target.heapProfilerAgent(); 12 this._heapProfilerAgent = target.heapProfilerAgent();
13 } 13 }
14 enable() { 14 enable() {
15 if (this._enabled) 15 if (this._enabled)
16 return; 16 return;
17 17
18 this._enabled = true; 18 this._enabled = true;
19 this._heapProfilerAgent.enable(); 19 this._heapProfilerAgent.enable();
20 } 20 }
21 21
22 startSampling() { 22 startSampling() {
23 var defaultSamplingIntervalInBytes = 16384; 23 var defaultSamplingIntervalInBytes = 16384;
24 this._heapProfilerAgent.startSampling(defaultSamplingIntervalInBytes); 24 this._heapProfilerAgent.startSampling(defaultSamplingIntervalInBytes);
25 } 25 }
26 26
27 /** 27 /**
28 * @return {!Promise.<?Protocol.Profiler.Profile>} 28 * @return {!Promise.<?Protocol.Profiler.Profile>}
29 */ 29 */
30 stopSampling() { 30 stopSampling() {
31 this._isRecording = false; 31 this._isRecording = false;
32 return this._heapProfilerAgent.stopSampling((error, profile) => error ? null : profile); 32 return this._heapProfilerAgent.stopSampling((error, profile) => error ? null : profile);
33 } 33 }
34 34
35 /** 35 /**
36 * @param {!Array.<number>} samples 36 * @param {!Array.<number>} samples
37 */ 37 */
38 heapStatsUpdate(samples) { 38 heapStatsUpdate(samples) {
39 this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.HeapStat sUpdate, samples); 39 this.dispatchEventToListeners(SDK.HeapProfilerModel.Events.HeapStatsUpdate, samples);
40 } 40 }
41 41
42 /** 42 /**
43 * @param {number} lastSeenObjectId 43 * @param {number} lastSeenObjectId
44 * @param {number} timestamp 44 * @param {number} timestamp
45 */ 45 */
46 lastSeenObjectId(lastSeenObjectId, timestamp) { 46 lastSeenObjectId(lastSeenObjectId, timestamp) {
47 this.dispatchEventToListeners( 47 this.dispatchEventToListeners(
48 WebInspector.HeapProfilerModel.Events.LastSeenObjectId, 48 SDK.HeapProfilerModel.Events.LastSeenObjectId,
49 {lastSeenObjectId: lastSeenObjectId, timestamp: timestamp}); 49 {lastSeenObjectId: lastSeenObjectId, timestamp: timestamp});
50 } 50 }
51 51
52 /** 52 /**
53 * @param {string} chunk 53 * @param {string} chunk
54 */ 54 */
55 addHeapSnapshotChunk(chunk) { 55 addHeapSnapshotChunk(chunk) {
56 this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.AddHeapS napshotChunk, chunk); 56 this.dispatchEventToListeners(SDK.HeapProfilerModel.Events.AddHeapSnapshotCh unk, chunk);
57 } 57 }
58 58
59 /** 59 /**
60 * @param {number} done 60 * @param {number} done
61 * @param {number} total 61 * @param {number} total
62 * @param {boolean=} finished 62 * @param {boolean=} finished
63 */ 63 */
64 reportHeapSnapshotProgress(done, total, finished) { 64 reportHeapSnapshotProgress(done, total, finished) {
65 this.dispatchEventToListeners( 65 this.dispatchEventToListeners(
66 WebInspector.HeapProfilerModel.Events.ReportHeapSnapshotProgress, 66 SDK.HeapProfilerModel.Events.ReportHeapSnapshotProgress,
67 {done: done, total: total, finished: finished}); 67 {done: done, total: total, finished: finished});
68 } 68 }
69 69
70 resetProfiles() { 70 resetProfiles() {
71 this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.ResetPro files); 71 this.dispatchEventToListeners(SDK.HeapProfilerModel.Events.ResetProfiles);
72 } 72 }
73 }; 73 };
74 74
75 /** @enum {symbol} */ 75 /** @enum {symbol} */
76 WebInspector.HeapProfilerModel.Events = { 76 SDK.HeapProfilerModel.Events = {
77 HeapStatsUpdate: Symbol('HeapStatsUpdate'), 77 HeapStatsUpdate: Symbol('HeapStatsUpdate'),
78 LastSeenObjectId: Symbol('LastSeenObjectId'), 78 LastSeenObjectId: Symbol('LastSeenObjectId'),
79 AddHeapSnapshotChunk: Symbol('AddHeapSnapshotChunk'), 79 AddHeapSnapshotChunk: Symbol('AddHeapSnapshotChunk'),
80 ReportHeapSnapshotProgress: Symbol('ReportHeapSnapshotProgress'), 80 ReportHeapSnapshotProgress: Symbol('ReportHeapSnapshotProgress'),
81 ResetProfiles: Symbol('ResetProfiles') 81 ResetProfiles: Symbol('ResetProfiles')
82 }; 82 };
83 83
84 /** 84 /**
85 * @implements {Protocol.HeapProfilerDispatcher} 85 * @implements {Protocol.HeapProfilerDispatcher}
86 * @unrestricted 86 * @unrestricted
87 */ 87 */
88 WebInspector.HeapProfilerDispatcher = class { 88 SDK.HeapProfilerDispatcher = class {
89 constructor(model) { 89 constructor(model) {
90 this._heapProfilerModel = model; 90 this._heapProfilerModel = model;
91 } 91 }
92 92
93 /** 93 /**
94 * @override 94 * @override
95 * @param {!Array.<number>} samples 95 * @param {!Array.<number>} samples
96 */ 96 */
97 heapStatsUpdate(samples) { 97 heapStatsUpdate(samples) {
98 this._heapProfilerModel.heapStatsUpdate(samples); 98 this._heapProfilerModel.heapStatsUpdate(samples);
(...skipping 26 matching lines...) Expand all
125 this._heapProfilerModel.reportHeapSnapshotProgress(done, total, finished); 125 this._heapProfilerModel.reportHeapSnapshotProgress(done, total, finished);
126 } 126 }
127 127
128 /** 128 /**
129 * @override 129 * @override
130 */ 130 */
131 resetProfiles() { 131 resetProfiles() {
132 this._heapProfilerModel.resetProfiles(); 132 this._heapProfilerModel.resetProfiles();
133 } 133 }
134 }; 134 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698