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

Unified Diff: net/url_request/url_fetcher_core.cc

Issue 2425673006: Make URLFetcherFileWriter::Finish() skip closing file when there is an error (Closed)
Patch Set: Fix test Created 4 years, 2 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 | « net/url_request/test_url_fetcher_factory.cc ('k') | net/url_request/url_fetcher_response_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_fetcher_core.cc
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc
index d83f52f2ccbc15532d8c314e0142176ba4901b52..2337cb5b4256703b7d7a6abf489151561e6da8ed 100644
--- a/net/url_request/url_fetcher_core.cc
+++ b/net/url_request/url_fetcher_core.cc
@@ -477,6 +477,7 @@ void URLFetcherCore::OnReadCompleted(URLRequest* request,
// No more data to write.
const int result = response_writer_->Finish(
+ bytes_read > 0 ? OK : bytes_read,
base::Bind(&URLFetcherCore::DidFinishWriting, this));
if (result != ERR_IO_PENDING)
DidFinishWriting(result);
@@ -861,7 +862,7 @@ int URLFetcherCore::WriteBuffer(scoped_refptr<DrainableIOBuffer> data) {
void URLFetcherCore::DidWriteBuffer(scoped_refptr<DrainableIOBuffer> data,
int result) {
if (result < 0) { // Handle errors.
- response_writer_->Finish(base::Bind(&EmptyCompletionCallback));
+ response_writer_->Finish(result, base::Bind(&EmptyCompletionCallback));
CancelRequestAndInformDelegate(result);
return;
}
« no previous file with comments | « net/url_request/test_url_fetcher_factory.cc ('k') | net/url_request/url_fetcher_response_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698