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

Unified Diff: net/url_request/sdch_dictionary_fetcher.cc

Issue 723133003: Shift URLRequest::Read API contract used by fetcher to ResourceLoader's. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated histograms.xml Created 6 years, 1 month 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/sdch_dictionary_fetcher.cc
diff --git a/net/url_request/sdch_dictionary_fetcher.cc b/net/url_request/sdch_dictionary_fetcher.cc
index 580619312c8ef646ef9d469b4fccdb1691c60dd6..1c86b8ffb852ddb9987a3b627052a1a4343ae7b2 100644
--- a/net/url_request/sdch_dictionary_fetcher.cc
+++ b/net/url_request/sdch_dictionary_fetcher.cc
@@ -198,25 +198,14 @@ int SdchDictionaryFetcher::DoRead(int rv) {
next_state_ = STATE_REQUEST_READING;
int bytes_read = 0;
- if (!current_request_->Read(buffer_.get(), kBufferSize, &bytes_read)) {
- if (current_request_->status().is_io_pending())
- return ERR_IO_PENDING;
-
- if (current_request_->status().error() == OK) {
- // This "should never happen", but if it does the result will be
- // an infinite loop. It's not clear how to handle a read failure
- // without a promise to invoke the callback at some point in the future,
- // so the request is failed.
- SdchManager::SdchErrorRecovery(SdchManager::DICTIONARY_FETCH_READ_FAILED);
- DLOG(FATAL)
- << "URLRequest::Read() returned false without IO pending or error!";
- return ERR_FAILED;
- }
+ current_request_->Read(buffer_.get(), kBufferSize, &bytes_read);
+ if (current_request_->status().is_io_pending())
+ return ERR_IO_PENDING;
+ if (bytes_read < 0 || !current_request_->status().is_success())
return current_request_->status().error();
mmenke 2014/11/13 21:55:05 Hrm... if it's possible for is_success() is true,
mmenke 2014/11/13 21:55:05 Should have a comment by the old enum that it's ob
Randy Smith (Not in Mondays) 2014/11/13 22:05:21 Whoops, sorry, updated histograms.xml, but not the
Randy Smith (Not in Mondays) 2014/11/13 22:05:22 It's a fair concern, but ResourceLoader has the sa
mmenke 2014/11/13 22:23:43 I suggest we channel AsyncResourceHandler here (ht
Randy Smith (Not in Mondays) 2014/11/15 21:25:30 Sounds good. I've tried to duplicate that logic's
- }
- if (bytes_read != 0)
+ if (bytes_read > 0)
dictionary_.append(buffer_->data(), bytes_read);
else
next_state_ = STATE_REQUEST_COMPLETE;
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698