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

Unified Diff: net/http/http_cache_transaction.cc

Issue 2812062: Http Cache: Make sure that we don't fail transactions when the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 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 | « net/http/http_cache_transaction.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache_transaction.cc
===================================================================
--- net/http/http_cache_transaction.cc (revision 52557)
+++ net/http/http_cache_transaction.cc (working copy)
@@ -109,6 +109,7 @@
cache_pending_(false),
read_offset_(0),
effective_load_flags_(0),
+ write_len_(0),
final_upload_progress_(0),
ALLOW_THIS_IN_INITIALIZER_LIST(
io_callback_(this, &Transaction::OnIOComplete)),
@@ -1174,6 +1175,7 @@
int HttpCache::Transaction::DoCacheWriteData(int num_bytes) {
next_state_ = STATE_CACHE_WRITE_DATA_COMPLETE;
+ write_len_ = num_bytes;
cache_callback_->AddRef(); // Balanced in DoCacheWriteDataComplete.
return AppendResponseDataToEntry(read_buf_, num_bytes, cache_callback_);
@@ -1185,9 +1187,15 @@
if (!cache_)
return ERR_UNEXPECTED;
- if (result < 0)
- return result;
+ if (result != write_len_) {
+ DLOG(ERROR) << "failed to write response data to cache";
+ DoneWritingToEntry(false);
+ // We want to ignore errors writing to disk and just keep reading from
+ // the network.
+ result = write_len_;
+ }
+
if (partial_.get()) {
// This may be the last request.
if (!(result == 0 && !truncated_ &&
@@ -1725,15 +1733,6 @@
} else {
rv = partial_->CacheWrite(entry_->disk_entry, data, data_len, callback);
}
-
- if (rv != ERR_IO_PENDING && rv != data_len) {
- DLOG(ERROR) << "failed to write response data to cache";
- DoneWritingToEntry(false);
-
- // We want to ignore errors writing to disk and just keep reading from
- // the network.
- rv = data_len;
- }
return rv;
}
« no previous file with comments | « net/http/http_cache_transaction.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698