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

Unified Diff: content/browser/byte_stream.cc

Issue 18098004: Add Flush() method to ByteStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 5 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 | « content/browser/byte_stream.h ('k') | content/browser/byte_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/byte_stream.cc
diff --git a/content/browser/byte_stream.cc b/content/browser/byte_stream.cc
index f83e8c31641f7ee4a1763ec662e1d1d36439bb75..8031815c6075eeabd308fef5130e328752c4af50 100644
--- a/content/browser/byte_stream.cc
+++ b/content/browser/byte_stream.cc
@@ -55,6 +55,7 @@ class ByteStreamWriterImpl : public ByteStreamWriter {
// Overridden from ByteStreamWriter.
virtual bool Write(scoped_refptr<net::IOBuffer> buffer,
size_t byte_count) OVERRIDE;
+ virtual void Flush() OVERRIDE;
virtual void Close(DownloadInterruptReason status) OVERRIDE;
virtual void RegisterCallback(const base::Closure& source_callback) OVERRIDE;
@@ -215,6 +216,12 @@ bool ByteStreamWriterImpl::Write(
return (input_contents_size_ + output_size_used_ <= total_buffer_size_);
}
+void ByteStreamWriterImpl::Flush() {
+ DCHECK(my_task_runner_->RunsTasksOnCurrentThread());
+ if (input_contents_size_ > 0)
+ PostToPeer(false, DOWNLOAD_INTERRUPT_REASON_NONE);
+}
+
void ByteStreamWriterImpl::Close(
DownloadInterruptReason status) {
DCHECK(my_task_runner_->RunsTasksOnCurrentThread());
« no previous file with comments | « content/browser/byte_stream.h ('k') | content/browser/byte_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698