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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 } | 1293 } |
1294 }, | 1294 }, |
1295 | 1295 |
1296 _updateSubtitle: function(value) | 1296 _updateSubtitle: function(value) |
1297 { | 1297 { |
1298 this.sidebarElement.subtitle = value; | 1298 this.sidebarElement.subtitle = value; |
1299 }, | 1299 }, |
1300 | 1300 |
1301 _didCompleteSnapshotTransfer: function() | 1301 _didCompleteSnapshotTransfer: function() |
1302 { | 1302 { |
| 1303 if (!this._snapshotProxy) |
| 1304 return; |
1303 this.sidebarElement.subtitle = Number.bytesToString(this._snapshotProxy.
totalSize); | 1305 this.sidebarElement.subtitle = Number.bytesToString(this._snapshotProxy.
totalSize); |
1304 this.sidebarElement.wait = false; | 1306 this.sidebarElement.wait = false; |
1305 }, | 1307 }, |
1306 | 1308 |
1307 /** | 1309 /** |
1308 * @param {string} chunk | 1310 * @param {string} chunk |
1309 */ | 1311 */ |
1310 transferChunk: function(chunk) | 1312 transferChunk: function(chunk) |
1311 { | 1313 { |
1312 if (!this._bufferedWriter) | 1314 if (!this._bufferedWriter) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 var fileOutputStream = new WebInspector.FileOutputStream(); | 1366 var fileOutputStream = new WebInspector.FileOutputStream(); |
1365 | 1367 |
1366 /** | 1368 /** |
1367 * @param {boolean} accepted | 1369 * @param {boolean} accepted |
1368 * @this {WebInspector.HeapProfileHeader} | 1370 * @this {WebInspector.HeapProfileHeader} |
1369 */ | 1371 */ |
1370 function onOpen(accepted) | 1372 function onOpen(accepted) |
1371 { | 1373 { |
1372 if (!accepted) | 1374 if (!accepted) |
1373 return; | 1375 return; |
1374 /** | 1376 if (this._failedToCreateTempFile) { |
1375 * @param {!File} file | |
1376 * @this {WebInspector.HeapProfileHeader} | |
1377 */ | |
1378 function didGetFile(file) | |
1379 { | |
1380 if (!file) { | |
1381 reportTempFileError(); | |
1382 return; | |
1383 } | |
1384 | |
1385 var delegate = new WebInspector.SaveSnapshotOutputStreamDelegate
(this); | |
1386 var reader = new WebInspector.ChunkedFileReader(file, 10*1000*10
00, delegate) | |
1387 reader.start(fileOutputStream); | |
1388 } | |
1389 | |
1390 function reportTempFileError() | |
1391 { | |
1392 WebInspector.log("Failed to open temp file with heap snapshot", | 1377 WebInspector.log("Failed to open temp file with heap snapshot", |
1393 WebInspector.ConsoleMessage.MessageLevel.Error)
; | 1378 WebInspector.ConsoleMessage.MessageLevel.Error)
; |
1394 fileOutputStream.close(); | 1379 fileOutputStream.close(); |
1395 } | |
1396 | |
1397 if (this._failedToCreateTempFile) { | |
1398 reportTempFileError(); | |
1399 } else if (this._tempFile) { | 1380 } else if (this._tempFile) { |
1400 this._tempFile.getFile(didGetFile.bind(this)); | 1381 var delegate = new WebInspector.SaveSnapshotOutputStreamDelegate
(this); |
| 1382 this._tempFile.writeToOutputSteam(fileOutputStream, delegate); |
1401 } else { | 1383 } else { |
1402 this._onTempFileReady = onOpen.bind(this, accepted); | 1384 this._onTempFileReady = onOpen.bind(this, accepted); |
1403 this._updateSaveProgress(0, 1); | 1385 this._updateSaveProgress(0, 1); |
1404 } | 1386 } |
1405 } | 1387 } |
1406 this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact
() + this._profileType.fileExtension(); | 1388 this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact
() + this._profileType.fileExtension(); |
1407 fileOutputStream.open(this._fileName, onOpen.bind(this)); | 1389 fileOutputStream.open(this._fileName, onOpen.bind(this)); |
1408 }, | 1390 }, |
1409 | 1391 |
1410 _updateSaveProgress: function(value, total) | 1392 _updateSaveProgress: function(value, total) |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 zeroTime: function() | 1905 zeroTime: function() |
1924 { | 1906 { |
1925 return this._minimumBoundaries; | 1907 return this._minimumBoundaries; |
1926 }, | 1908 }, |
1927 | 1909 |
1928 boundarySpan: function() | 1910 boundarySpan: function() |
1929 { | 1911 { |
1930 return this._maximumBoundaries - this._minimumBoundaries; | 1912 return this._maximumBoundaries - this._minimumBoundaries; |
1931 } | 1913 } |
1932 } | 1914 } |
OLD | NEW |