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

Unified Diff: Source/devtools/front_end/TempFile.js

Issue 132993009: Use mock temp file in profiler tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/HeapSnapshotView.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/devtools/front_end/HeapSnapshotView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698