Index: Source/devtools/front_end/HeapSnapshotView.js |
diff --git a/Source/devtools/front_end/HeapSnapshotView.js b/Source/devtools/front_end/HeapSnapshotView.js |
index e05a9caabf2b7c94bfda81a8d704d2ec3a73223e..559a82506a8e44a6597d698376b47dd923aa308d 100644 |
--- a/Source/devtools/front_end/HeapSnapshotView.js |
+++ b/Source/devtools/front_end/HeapSnapshotView.js |
@@ -980,7 +980,10 @@ WebInspector.TrackingHeapSnapshotProfileType.prototype = { |
return this._toggleRecording(); |
}, |
- _startRecordingProfile: function() |
+ /** |
+ * @param {boolean=} continueAfterNavigation |
+ */ |
+ _startRecordingProfile: function(continueAfterNavigation) |
loislo
2014/02/19 13:06:19
could you please extract the common part into a se
yurys
2014/02/19 13:34:37
Done.
|
{ |
if (this.profileBeingRecorded()) |
return; |
@@ -997,7 +1000,8 @@ WebInspector.TrackingHeapSnapshotProfileType.prototype = { |
this._recording = true; |
this.addProfile(this._profileBeingRecorded); |
this._profileBeingRecorded.updateStatus(WebInspector.UIString("Recording\u2026")); |
- HeapProfilerAgent.startTrackingHeapObjects(WebInspector.experimentsSettings.allocationProfiler.isEnabled()); |
+ if (!continueAfterNavigation) |
+ HeapProfilerAgent.startTrackingHeapObjects(WebInspector.experimentsSettings.allocationProfiler.isEnabled()); |
this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileType.TrackingStarted); |
}, |
@@ -1045,11 +1049,14 @@ WebInspector.TrackingHeapSnapshotProfileType.prototype = { |
_reset: function() |
{ |
+ var wasRecording = this._recording; |
+ // Clear current profile to avoid stoppting backend. |
loislo
2014/02/19 13:06:19
stoppting?
yurys
2014/02/19 13:34:37
Done.
yurys
2014/02/19 13:34:37
Done.
|
+ this._profileBeingRecorded = null; |
WebInspector.HeapSnapshotProfileType.prototype._reset.call(this); |
- if (this._recording) |
- this._stopRecordingProfile(); |
this._profileSamples = null; |
this._lastSeenIndex = -1; |
+ if (wasRecording) |
+ this._startRecordingProfile(true); |
}, |
/** |
@@ -1137,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; |
@@ -1146,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; |