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

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: 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
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,
mmenke 2016/10/18 20:20:01 Hrm...I'd normally ask for an integration test tha
xunjieli 2016/10/18 21:18:07 I see. So in the future URLRequest::Delegate::OnRe
mmenke 2016/10/18 21:40:46 No, in the future, I want it not to call into the
xunjieli 2016/10/19 12:00:21 Acknowledged. Thanks for explaining!
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;
}

Powered by Google App Engine
This is Rietveld 408576698