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

Unified Diff: net/url_request/url_fetcher_response_writer.cc

Issue 23500006: URLFetcher won't call delegate until file is closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
« net/base/file_stream.h ('K') | « net/url_request/url_fetcher_response_writer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_fetcher_response_writer.cc
diff --git a/net/url_request/url_fetcher_response_writer.cc b/net/url_request/url_fetcher_response_writer.cc
index cb30dad8089efd6acd2d699126782cce3d147c45..b3e4a12b92b528c7533a7e5e2e9ddc24f7e1057e 100644
--- a/net/url_request/url_fetcher_response_writer.cc
+++ b/net/url_request/url_fetcher_response_writer.cc
@@ -102,8 +102,19 @@ int URLFetcherFileWriter::Write(IOBuffer* buffer,
}
int URLFetcherFileWriter::Finish(const CompletionCallback& callback) {
+ int result = file_stream_->Close(base::Bind(
+ &URLFetcherFileWriter::CloseComplete, base::Unretained(this), callback));
+ if (result != ERR_IO_PENDING) {
Sorin Jianu 2013/09/05 19:59:12 Remove the full bracing for the if statement, per
waffles 2013/09/05 20:31:52 Done.
+ file_stream_.reset();
+ }
+ return result;
+}
+
+void URLFetcherFileWriter::CloseComplete(const CompletionCallback& callback,
+ int result) {
+ // Either we closed the file or we can't; either way destroy the file_stream.
file_stream_.reset();
- return OK;
+ callback.Run(result);
}
void URLFetcherFileWriter::DidWrite(const CompletionCallback& callback,
« net/base/file_stream.h ('K') | « net/url_request/url_fetcher_response_writer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698