Index: Source/devtools/front_end/TempFile.js |
diff --git a/Source/devtools/front_end/TempFile.js b/Source/devtools/front_end/TempFile.js |
index d0dcbd0742dc34776136b6e5504acebcff0c47e2..1190a412f083cd5ccc1188de69551738092d586d 100644 |
--- a/Source/devtools/front_end/TempFile.js |
+++ b/Source/devtools/front_end/TempFile.js |
@@ -174,17 +174,27 @@ WebInspector.TempFile.prototype = { |
}, |
/** |
- * @param {!function(?File)} callback |
+ * @param {!WebInspector.OutputStream} outputStream |
+ * @param {!WebInspector.OutputStreamDelegate} delegate |
*/ |
- getFile: function(callback) |
+ writeToOutputSteam: function(outputStream, delegate) |
{ |
+ /** |
+ * @param {!File} file |
+ * @this {WebInspector.TempFile} |
+ */ |
+ function didGetFile(file) |
+ { |
+ var reader = new WebInspector.ChunkedFileReader(file, 10*1000*1000, delegate) |
alph
2014/01/15 15:29:31
missing ;
yurys
2014/01/15 15:39:11
Done.
|
+ reader.start(outputStream); |
+ } |
function didFailToGetFile(error) |
{ |
WebInspector.log("Failed to load temp file: " + error.message, |
- WebInspector.ConsoleMessage.MessageLevel.Error); |
- callback(null); |
+ WebInspector.ConsoleMessage.MessageLevel.Error); |
+ outputStream.close(); |
} |
- this._fileEntry.file(callback, didFailToGetFile.bind(this)); |
+ this._fileEntry.file(didGetFile.bind(this), didFailToGetFile.bind(this)); |
} |
} |
@@ -226,6 +236,8 @@ WebInspector.BufferedTempFileWriter.prototype = { |
this._finishCallback = callback; |
if (this._isFinished) |
callback(this._tempFile); |
+ else if (!this._isWriting && !this._chunks.length) |
+ this._notifyFinished(); |
}, |
_didCreateTempFile: function(tempFile) |
@@ -251,8 +263,8 @@ WebInspector.BufferedTempFileWriter.prototype = { |
} |
var chunk = this._chunks.slice(0, endIndex + 1).join(""); |
this._chunks.splice(0, endIndex + 1); |
- this._tempFile.write(chunk, this._didWriteChunk.bind(this)); |
this._isWriting = true; |
+ this._tempFile.write(chunk, this._didWriteChunk.bind(this)); |
}, |
_didWriteChunk: function(success) |