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