OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
973 | 973 |
974 /** | 974 /** |
975 * @override | 975 * @override |
976 * @return {boolean} | 976 * @return {boolean} |
977 */ | 977 */ |
978 buttonClicked: function() | 978 buttonClicked: function() |
979 { | 979 { |
980 return this._toggleRecording(); | 980 return this._toggleRecording(); |
981 }, | 981 }, |
982 | 982 |
983 _startRecordingProfile: function() | 983 /** |
984 * @param {boolean=} continueAfterNavigation | |
985 */ | |
986 _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.
| |
984 { | 987 { |
985 if (this.profileBeingRecorded()) | 988 if (this.profileBeingRecorded()) |
986 return; | 989 return; |
987 this._profileBeingRecorded = new WebInspector.HeapProfileHeader(this); | 990 this._profileBeingRecorded = new WebInspector.HeapProfileHeader(this); |
988 this._lastSeenIndex = -1; | 991 this._lastSeenIndex = -1; |
989 this._profileSamples = { | 992 this._profileSamples = { |
990 'sizes': [], | 993 'sizes': [], |
991 'ids': [], | 994 'ids': [], |
992 'timestamps': [], | 995 'timestamps': [], |
993 'max': [], | 996 'max': [], |
994 'totalTime': 30000 | 997 'totalTime': 30000 |
995 }; | 998 }; |
996 this._profileBeingRecorded._profileSamples = this._profileSamples; | 999 this._profileBeingRecorded._profileSamples = this._profileSamples; |
997 this._recording = true; | 1000 this._recording = true; |
998 this.addProfile(this._profileBeingRecorded); | 1001 this.addProfile(this._profileBeingRecorded); |
999 this._profileBeingRecorded.updateStatus(WebInspector.UIString("Recording \u2026")); | 1002 this._profileBeingRecorded.updateStatus(WebInspector.UIString("Recording \u2026")); |
1000 HeapProfilerAgent.startTrackingHeapObjects(WebInspector.experimentsSetti ngs.allocationProfiler.isEnabled()); | 1003 if (!continueAfterNavigation) |
1004 HeapProfilerAgent.startTrackingHeapObjects(WebInspector.experimentsS ettings.allocationProfiler.isEnabled()); | |
1001 this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileTy pe.TrackingStarted); | 1005 this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileTy pe.TrackingStarted); |
1002 }, | 1006 }, |
1003 | 1007 |
1004 _stopRecordingProfile: function() | 1008 _stopRecordingProfile: function() |
1005 { | 1009 { |
1006 this._profileBeingRecorded.updateStatus(WebInspector.UIString("Snapshott ing\u2026")); | 1010 this._profileBeingRecorded.updateStatus(WebInspector.UIString("Snapshott ing\u2026")); |
1007 /** | 1011 /** |
1008 * @param {?string} error | 1012 * @param {?string} error |
1009 * @this {WebInspector.HeapSnapshotProfileType} | 1013 * @this {WebInspector.HeapSnapshotProfileType} |
1010 */ | 1014 */ |
(...skipping 27 matching lines...) Expand all Loading... | |
1038 return WebInspector.UIString("HEAP TIMELINES"); | 1042 return WebInspector.UIString("HEAP TIMELINES"); |
1039 }, | 1043 }, |
1040 | 1044 |
1041 get description() | 1045 get description() |
1042 { | 1046 { |
1043 return WebInspector.UIString("Record JavaScript object allocations over time. Use this profile type to isolate memory leaks."); | 1047 return WebInspector.UIString("Record JavaScript object allocations over time. Use this profile type to isolate memory leaks."); |
1044 }, | 1048 }, |
1045 | 1049 |
1046 _reset: function() | 1050 _reset: function() |
1047 { | 1051 { |
1052 var wasRecording = this._recording; | |
1053 // 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.
| |
1054 this._profileBeingRecorded = null; | |
1048 WebInspector.HeapSnapshotProfileType.prototype._reset.call(this); | 1055 WebInspector.HeapSnapshotProfileType.prototype._reset.call(this); |
1049 if (this._recording) | |
1050 this._stopRecordingProfile(); | |
1051 this._profileSamples = null; | 1056 this._profileSamples = null; |
1052 this._lastSeenIndex = -1; | 1057 this._lastSeenIndex = -1; |
1058 if (wasRecording) | |
1059 this._startRecordingProfile(true); | |
1053 }, | 1060 }, |
1054 | 1061 |
1055 /** | 1062 /** |
1056 * @override | 1063 * @override |
1057 */ | 1064 */ |
1058 profileBeingRecordedRemoved: function() | 1065 profileBeingRecordedRemoved: function() |
1059 { | 1066 { |
1060 this._stopRecordingProfile(); | 1067 this._stopRecordingProfile(); |
1061 this._profileSamples = null; | 1068 this._profileSamples = null; |
1062 }, | 1069 }, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1130 | 1137 |
1131 _prepareToLoad: function() | 1138 _prepareToLoad: function() |
1132 { | 1139 { |
1133 console.assert(!this._receiver, "Already loading"); | 1140 console.assert(!this._receiver, "Already loading"); |
1134 this._setupWorker(); | 1141 this._setupWorker(); |
1135 this.updateStatus(WebInspector.UIString("Loading\u2026"), true); | 1142 this.updateStatus(WebInspector.UIString("Loading\u2026"), true); |
1136 }, | 1143 }, |
1137 | 1144 |
1138 _finishLoad: function() | 1145 _finishLoad: function() |
1139 { | 1146 { |
1140 this._receiver.close(function() {}); | 1147 if (!this._wasDisposed) |
1148 this._receiver.close(function() {}); | |
1141 if (this._bufferedWriter) { | 1149 if (this._bufferedWriter) { |
1142 this._bufferedWriter.close(this._didWriteToTempFile.bind(this)); | 1150 this._bufferedWriter.close(this._didWriteToTempFile.bind(this)); |
1143 this._bufferedWriter = null; | 1151 this._bufferedWriter = null; |
1144 } | 1152 } |
1145 }, | 1153 }, |
1146 | 1154 |
1147 _didWriteToTempFile: function(tempFile) | 1155 _didWriteToTempFile: function(tempFile) |
1148 { | 1156 { |
1157 if (this._wasDisposed) { | |
1158 if (tempFile) | |
1159 tempFile.remove(); | |
1160 return; | |
1161 } | |
1149 this._tempFile = tempFile; | 1162 this._tempFile = tempFile; |
1150 if (!tempFile) | 1163 if (!tempFile) |
1151 this._failedToCreateTempFile = true; | 1164 this._failedToCreateTempFile = true; |
1152 if (this._onTempFileReady) { | 1165 if (this._onTempFileReady) { |
1153 this._onTempFileReady(); | 1166 this._onTempFileReady(); |
1154 this._onTempFileReady = null; | 1167 this._onTempFileReady = null; |
1155 } | 1168 } |
1156 }, | 1169 }, |
1157 | 1170 |
1158 _setupWorker: function() | 1171 _setupWorker: function() |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1742 }, | 1755 }, |
1743 | 1756 |
1744 /** | 1757 /** |
1745 * @return {number} | 1758 * @return {number} |
1746 */ | 1759 */ |
1747 boundarySpan: function() | 1760 boundarySpan: function() |
1748 { | 1761 { |
1749 return this._maximumBoundaries - this._minimumBoundaries; | 1762 return this._maximumBoundaries - this._minimumBoundaries; |
1750 } | 1763 } |
1751 } | 1764 } |
OLD | NEW |