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

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

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sdk/HeapProfilerModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/HeapProfilerModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/HeapProfilerModel.js
index 2f1b03fd9cd80968f907bf380ff12220d04e9b59..491b4b76aadb61c0d7345014797b6af3d56f79aa 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/HeapProfilerModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/HeapProfilerModel.js
@@ -1,148 +1,134 @@
/**
- * @constructor
- * @extends {WebInspector.SDKModel}
- * @param {!WebInspector.Target} target
+ * @unrestricted
*/
-WebInspector.HeapProfilerModel = function(target)
-{
- WebInspector.SDKModel.call(this, WebInspector.HeapProfilerModel, target);
+WebInspector.HeapProfilerModel = class extends WebInspector.SDKModel {
+ /**
+ * @param {!WebInspector.Target} target
+ */
+ constructor(target) {
+ super(WebInspector.HeapProfilerModel, target);
target.registerHeapProfilerDispatcher(new WebInspector.HeapProfilerDispatcher(this));
this._enabled = false;
this._heapProfilerAgent = target.heapProfilerAgent();
+ }
+ enable() {
+ if (this._enabled)
+ return;
+
+ this._enabled = true;
+ this._heapProfilerAgent.enable();
+ }
+
+ startSampling() {
+ var defaultSamplingIntervalInBytes = 16384;
+ this._heapProfilerAgent.startSampling(defaultSamplingIntervalInBytes);
+ }
+
+ /**
+ * @return {!Promise.<?ProfilerAgent.Profile>}
+ */
+ stopSampling() {
+ this._isRecording = false;
+ return this._heapProfilerAgent.stopSampling((error, profile) => error ? null : profile);
+ }
+
+ /**
+ * @param {!Array.<number>} samples
+ */
+ heapStatsUpdate(samples) {
+ this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.HeapStatsUpdate, samples);
+ }
+
+ /**
+ * @param {number} lastSeenObjectId
+ * @param {number} timestamp
+ */
+ lastSeenObjectId(lastSeenObjectId, timestamp) {
+ this.dispatchEventToListeners(
+ WebInspector.HeapProfilerModel.Events.LastSeenObjectId,
+ {lastSeenObjectId: lastSeenObjectId, timestamp: timestamp});
+ }
+
+ /**
+ * @param {string} chunk
+ */
+ addHeapSnapshotChunk(chunk) {
+ this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.AddHeapSnapshotChunk, chunk);
+ }
+
+ /**
+ * @param {number} done
+ * @param {number} total
+ * @param {boolean=} finished
+ */
+ reportHeapSnapshotProgress(done, total, finished) {
+ this.dispatchEventToListeners(
+ WebInspector.HeapProfilerModel.Events.ReportHeapSnapshotProgress,
+ {done: done, total: total, finished: finished});
+ }
+
+ resetProfiles() {
+ this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.ResetProfiles);
+ }
};
/** @enum {symbol} */
WebInspector.HeapProfilerModel.Events = {
- HeapStatsUpdate: Symbol("HeapStatsUpdate"),
- LastSeenObjectId: Symbol("LastSeenObjectId"),
- AddHeapSnapshotChunk: Symbol("AddHeapSnapshotChunk"),
- ReportHeapSnapshotProgress: Symbol("ReportHeapSnapshotProgress"),
- ResetProfiles: Symbol("ResetProfiles")
+ HeapStatsUpdate: Symbol('HeapStatsUpdate'),
+ LastSeenObjectId: Symbol('LastSeenObjectId'),
+ AddHeapSnapshotChunk: Symbol('AddHeapSnapshotChunk'),
+ ReportHeapSnapshotProgress: Symbol('ReportHeapSnapshotProgress'),
+ ResetProfiles: Symbol('ResetProfiles')
};
-WebInspector.HeapProfilerModel.prototype = {
- enable: function()
- {
- if (this._enabled)
- return;
-
- this._enabled = true;
- this._heapProfilerAgent.enable();
- },
-
- startSampling: function()
- {
- var defaultSamplingIntervalInBytes = 16384;
- this._heapProfilerAgent.startSampling(defaultSamplingIntervalInBytes);
- },
-
- /**
- * @return {!Promise.<?ProfilerAgent.Profile>}
- */
- stopSampling: function()
- {
- this._isRecording = false;
- return this._heapProfilerAgent.stopSampling((error, profile) => error ? null : profile);
- },
-
- /**
- * @param {!Array.<number>} samples
- */
- heapStatsUpdate: function(samples)
- {
- this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.HeapStatsUpdate, samples);
- },
-
- /**
- * @param {number} lastSeenObjectId
- * @param {number} timestamp
- */
- lastSeenObjectId: function(lastSeenObjectId, timestamp)
- {
- this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.LastSeenObjectId ,{lastSeenObjectId: lastSeenObjectId, timestamp: timestamp});
- },
-
- /**
- * @param {string} chunk
- */
- addHeapSnapshotChunk: function(chunk)
- {
- this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.AddHeapSnapshotChunk, chunk);
- },
-
- /**
- * @param {number} done
- * @param {number} total
- * @param {boolean=} finished
- */
- reportHeapSnapshotProgress: function(done, total, finished)
- {
- this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.ReportHeapSnapshotProgress, {done: done, total: total, finished: finished});
- },
-
- resetProfiles: function()
- {
- this.dispatchEventToListeners(WebInspector.HeapProfilerModel.Events.ResetProfiles);
- },
-
- __proto__: WebInspector.SDKModel.prototype
-};
-
-
/**
- * @constructor
* @implements {HeapProfilerAgent.Dispatcher}
+ * @unrestricted
*/
-WebInspector.HeapProfilerDispatcher = function(model)
-{
+WebInspector.HeapProfilerDispatcher = class {
+ constructor(model) {
this._heapProfilerModel = model;
-};
-
-WebInspector.HeapProfilerDispatcher.prototype = {
- /**
- * @override
- * @param {!Array.<number>} samples
- */
- heapStatsUpdate: function(samples)
- {
- this._heapProfilerModel.heapStatsUpdate(samples);
- },
-
- /**
- * @override
- * @param {number} lastSeenObjectId
- * @param {number} timestamp
- */
- lastSeenObjectId: function(lastSeenObjectId, timestamp)
- {
- this._heapProfilerModel.lastSeenObjectId(lastSeenObjectId, timestamp);
- },
-
- /**
- * @override
- * @param {string} chunk
- */
- addHeapSnapshotChunk: function(chunk)
- {
- this._heapProfilerModel.addHeapSnapshotChunk(chunk);
- },
-
- /**
- * @override
- * @param {number} done
- * @param {number} total
- * @param {boolean=} finished
- */
- reportHeapSnapshotProgress: function(done, total, finished)
- {
- this._heapProfilerModel.reportHeapSnapshotProgress(done, total, finished);
- },
-
- /**
- * @override
- */
- resetProfiles: function()
- {
- this._heapProfilerModel.resetProfiles();
- }
+ }
+
+ /**
+ * @override
+ * @param {!Array.<number>} samples
+ */
+ heapStatsUpdate(samples) {
+ this._heapProfilerModel.heapStatsUpdate(samples);
+ }
+
+ /**
+ * @override
+ * @param {number} lastSeenObjectId
+ * @param {number} timestamp
+ */
+ lastSeenObjectId(lastSeenObjectId, timestamp) {
+ this._heapProfilerModel.lastSeenObjectId(lastSeenObjectId, timestamp);
+ }
+
+ /**
+ * @override
+ * @param {string} chunk
+ */
+ addHeapSnapshotChunk(chunk) {
+ this._heapProfilerModel.addHeapSnapshotChunk(chunk);
+ }
+
+ /**
+ * @override
+ * @param {number} done
+ * @param {number} total
+ * @param {boolean=} finished
+ */
+ reportHeapSnapshotProgress(done, total, finished) {
+ this._heapProfilerModel.reportHeapSnapshotProgress(done, total, finished);
+ }
+
+ /**
+ * @override
+ */
+ resetProfiles() {
+ this._heapProfilerModel.resetProfiles();
+ }
};

Powered by Google App Engine
This is Rietveld 408576698