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

Side by Side Diff: Source/devtools/front_end/HeapSnapshotView.js

Issue 172163005: Continue recording object allocation after navigation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/InspectorHeapProfilerAgent.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 */ 976 */
977 buttonClicked: function() 977 buttonClicked: function()
978 { 978 {
979 return this._toggleRecording(); 979 return this._toggleRecording();
980 }, 980 },
981 981
982 _startRecordingProfile: function() 982 _startRecordingProfile: function()
983 { 983 {
984 if (this.profileBeingRecorded()) 984 if (this.profileBeingRecorded())
985 return; 985 return;
986 this._addNewProfile();
987 HeapProfilerAgent.startTrackingHeapObjects(WebInspector.experimentsSetti ngs.allocationProfiler.isEnabled());
988 },
989
990 _addNewProfile: function()
991 {
986 this._profileBeingRecorded = new WebInspector.HeapProfileHeader(this); 992 this._profileBeingRecorded = new WebInspector.HeapProfileHeader(this);
987 this._lastSeenIndex = -1; 993 this._lastSeenIndex = -1;
988 this._profileSamples = { 994 this._profileSamples = {
989 'sizes': [], 995 'sizes': [],
990 'ids': [], 996 'ids': [],
991 'timestamps': [], 997 'timestamps': [],
992 'max': [], 998 'max': [],
993 'totalTime': 30000 999 'totalTime': 30000
994 }; 1000 };
995 this._profileBeingRecorded._profileSamples = this._profileSamples; 1001 this._profileBeingRecorded._profileSamples = this._profileSamples;
996 this._recording = true; 1002 this._recording = true;
997 this.addProfile(this._profileBeingRecorded); 1003 this.addProfile(this._profileBeingRecorded);
998 this._profileBeingRecorded.updateStatus(WebInspector.UIString("Recording \u2026")); 1004 this._profileBeingRecorded.updateStatus(WebInspector.UIString("Recording \u2026"));
999 HeapProfilerAgent.startTrackingHeapObjects(WebInspector.experimentsSetti ngs.allocationProfiler.isEnabled());
1000 this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileTy pe.TrackingStarted); 1005 this.dispatchEventToListeners(WebInspector.TrackingHeapSnapshotProfileTy pe.TrackingStarted);
1001 }, 1006 },
1002 1007
1003 _stopRecordingProfile: function() 1008 _stopRecordingProfile: function()
1004 { 1009 {
1005 this._profileBeingRecorded.updateStatus(WebInspector.UIString("Snapshott ing\u2026")); 1010 this._profileBeingRecorded.updateStatus(WebInspector.UIString("Snapshott ing\u2026"));
1006 /** 1011 /**
1007 * @param {?string} error 1012 * @param {?string} error
1008 * @this {WebInspector.HeapSnapshotProfileType} 1013 * @this {WebInspector.HeapSnapshotProfileType}
1009 */ 1014 */
(...skipping 27 matching lines...) Expand all
1037 return WebInspector.UIString("HEAP TIMELINES"); 1042 return WebInspector.UIString("HEAP TIMELINES");
1038 }, 1043 },
1039 1044
1040 get description() 1045 get description()
1041 { 1046 {
1042 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.");
1043 }, 1048 },
1044 1049
1045 _reset: function() 1050 _reset: function()
1046 { 1051 {
1052 var wasRecording = this._recording;
1053 // Clear current profile to avoid stopping backend.
1054 this._profileBeingRecorded = null;
1047 WebInspector.HeapSnapshotProfileType.prototype._reset.call(this); 1055 WebInspector.HeapSnapshotProfileType.prototype._reset.call(this);
1048 if (this._recording)
1049 this._stopRecordingProfile();
1050 this._profileSamples = null; 1056 this._profileSamples = null;
1051 this._lastSeenIndex = -1; 1057 this._lastSeenIndex = -1;
1058 if (wasRecording)
1059 this._addNewProfile();
1052 }, 1060 },
1053 1061
1054 /** 1062 /**
1055 * @override 1063 * @override
1056 */ 1064 */
1057 profileBeingRecordedRemoved: function() 1065 profileBeingRecordedRemoved: function()
1058 { 1066 {
1059 this._stopRecordingProfile(); 1067 this._stopRecordingProfile();
1060 this._profileSamples = null; 1068 this._profileSamples = null;
1061 }, 1069 },
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 1137
1130 _prepareToLoad: function() 1138 _prepareToLoad: function()
1131 { 1139 {
1132 console.assert(!this._receiver, "Already loading"); 1140 console.assert(!this._receiver, "Already loading");
1133 this._setupWorker(); 1141 this._setupWorker();
1134 this.updateStatus(WebInspector.UIString("Loading\u2026"), true); 1142 this.updateStatus(WebInspector.UIString("Loading\u2026"), true);
1135 }, 1143 },
1136 1144
1137 _finishLoad: function() 1145 _finishLoad: function()
1138 { 1146 {
1139 this._receiver.close(function() {}); 1147 if (!this._wasDisposed)
1148 this._receiver.close(function() {});
1140 if (this._bufferedWriter) { 1149 if (this._bufferedWriter) {
1141 this._bufferedWriter.close(this._didWriteToTempFile.bind(this)); 1150 this._bufferedWriter.close(this._didWriteToTempFile.bind(this));
1142 this._bufferedWriter = null; 1151 this._bufferedWriter = null;
1143 } 1152 }
1144 }, 1153 },
1145 1154
1146 _didWriteToTempFile: function(tempFile) 1155 _didWriteToTempFile: function(tempFile)
1147 { 1156 {
1157 if (this._wasDisposed) {
1158 if (tempFile)
1159 tempFile.remove();
1160 return;
1161 }
1148 this._tempFile = tempFile; 1162 this._tempFile = tempFile;
1149 if (!tempFile) 1163 if (!tempFile)
1150 this._failedToCreateTempFile = true; 1164 this._failedToCreateTempFile = true;
1151 if (this._onTempFileReady) { 1165 if (this._onTempFileReady) {
1152 this._onTempFileReady(); 1166 this._onTempFileReady();
1153 this._onTempFileReady = null; 1167 this._onTempFileReady = null;
1154 } 1168 }
1155 }, 1169 },
1156 1170
1157 _setupWorker: function() 1171 _setupWorker: function()
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 }, 1755 },
1742 1756
1743 /** 1757 /**
1744 * @return {number} 1758 * @return {number}
1745 */ 1759 */
1746 boundarySpan: function() 1760 boundarySpan: function()
1747 { 1761 {
1748 return this._maximumBoundaries - this._minimumBoundaries; 1762 return this._maximumBoundaries - this._minimumBoundaries;
1749 } 1763 }
1750 } 1764 }
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorHeapProfilerAgent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698