Index: Source/devtools/front_end/HeapSnapshotView.js |
diff --git a/Source/devtools/front_end/HeapSnapshotView.js b/Source/devtools/front_end/HeapSnapshotView.js |
index 569c2fd1e5967bc13ae224e6ddb6f8b1b9682c63..17f98ccc134e1cb606ae2f6ff7bb05664b0acdf4 100644 |
--- a/Source/devtools/front_end/HeapSnapshotView.js |
+++ b/Source/devtools/front_end/HeapSnapshotView.js |
@@ -983,6 +983,12 @@ WebInspector.TrackingHeapSnapshotProfileType.prototype = { |
{ |
if (this.profileBeingRecorded()) |
return; |
+ this._addNewProfile(); |
+ HeapProfilerAgent.startTrackingHeapObjects(WebInspector.experimentsSettings.allocationProfiler.isEnabled()); |
+ }, |
+ |
+ _addNewProfile: function() |
+ { |
this._profileBeingRecorded = new WebInspector.HeapProfileHeader(this); |
this._lastSeenIndex = -1; |
this._profileSamples = { |
@@ -996,7 +1002,6 @@ WebInspector.TrackingHeapSnapshotProfileType.prototype = { |
this._recording = true; |
this.addProfile(this._profileBeingRecorded); |
this._profileBeingRecorded.updateStatus(WebInspector.UIString("Recording\u2026")); |
- HeapProfilerAgent.startTrackingHeapObjects(WebInspector.experimentsSettings.allocationProfiler.isEnabled()); |
this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.TrackingStarted); |
}, |
@@ -1044,11 +1049,14 @@ WebInspector.TrackingHeapSnapshotProfileType.prototype = { |
_reset: function() |
{ |
+ var wasRecording = this._recording; |
+ // Clear current profile to avoid stopping backend. |
+ this._profileBeingRecorded = null; |
WebInspector.HeapSnapshotProfileType.prototype._reset.call(this); |
- if (this._recording) |
- this._stopRecordingProfile(); |
this._profileSamples = null; |
this._lastSeenIndex = -1; |
+ if (wasRecording) |
+ this._addNewProfile(); |
}, |
/** |
@@ -1136,7 +1144,8 @@ WebInspector.HeapProfileHeader.prototype = { |
_finishLoad: function() |
{ |
- this._receiver.close(function() {}); |
+ if (!this._wasDisposed) |
+ this._receiver.close(function() {}); |
if (this._bufferedWriter) { |
this._bufferedWriter.close(this._didWriteToTempFile.bind(this)); |
this._bufferedWriter = null; |
@@ -1145,6 +1154,11 @@ WebInspector.HeapProfileHeader.prototype = { |
_didWriteToTempFile: function(tempFile) |
{ |
+ if (this._wasDisposed) { |
+ if (tempFile) |
+ tempFile.remove(); |
+ return; |
+ } |
this._tempFile = tempFile; |
if (!tempFile) |
this._failedToCreateTempFile = true; |