OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 var callsPendingOpen = this._callsPendingOpen; | 291 var callsPendingOpen = this._callsPendingOpen; |
292 this._callsPendingOpen = null; | 292 this._callsPendingOpen = null; |
293 for (var i = 0; i < callsPendingOpen.length; ++i) | 293 for (var i = 0; i < callsPendingOpen.length; ++i) |
294 callsPendingOpen[i](); | 294 callsPendingOpen[i](); |
295 if (this._chunks.length) | 295 if (this._chunks.length) |
296 this._writeNextChunk(); | 296 this._writeNextChunk(); |
297 }, | 297 }, |
298 | 298 |
299 _writeNextChunk: function() | 299 _writeNextChunk: function() |
300 { | 300 { |
| 301 // File was deleted while create or write was in-flight. |
| 302 if (!this._tempFile) |
| 303 return; |
301 var chunk = this._chunks.shift(); | 304 var chunk = this._chunks.shift(); |
302 this._isWriting = true; | 305 this._isWriting = true; |
303 this._tempFile.write(/** @type {!Array.<string>} */(chunk.strings), this
._didWriteChunk.bind(this, chunk.callback)); | 306 this._tempFile.write(/** @type {!Array.<string>} */(chunk.strings), this
._didWriteChunk.bind(this, chunk.callback)); |
304 }, | 307 }, |
305 | 308 |
306 /** | 309 /** |
307 * @param {?function(number)} callback | 310 * @param {?function(number)} callback |
308 * @param {number} size | 311 * @param {number} size |
309 */ | 312 */ |
310 _didWriteChunk: function(callback, size) | 313 _didWriteChunk: function(callback, size) |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 586 |
584 /** | 587 /** |
585 * @param {!WebInspector.OutputStream} outputStream | 588 * @param {!WebInspector.OutputStream} outputStream |
586 * @param {!WebInspector.OutputStreamDelegate} delegate | 589 * @param {!WebInspector.OutputStreamDelegate} delegate |
587 */ | 590 */ |
588 writeToStream: function(outputStream, delegate) | 591 writeToStream: function(outputStream, delegate) |
589 { | 592 { |
590 this._file.writeToOutputStream(outputStream, delegate); | 593 this._file.writeToOutputStream(outputStream, delegate); |
591 } | 594 } |
592 } | 595 } |
OLD | NEW |