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

Unified Diff: net/http/http_cache_transaction.cc

Issue 478763004: Bypass http cache for concurrent range requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Narrow scope. Created 6 years, 4 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 | « no previous file | 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
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index 286a526a3edb2fa39e7101e10429cf3c15b7920a..5436ff4cef507e824a34e283833e853b9776d3cb 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -1382,7 +1382,20 @@ int HttpCache::Transaction::DoAddToEntry() {
if (bypass_lock_for_test_) {
OnAddToEntryTimeout(entry_lock_waiting_since_);
} else {
- const int kTimeoutSeconds = 20;
+ // Immediately timeout and bypass the cache if we're a range request and
+ // we're blocked by the reader/writer lock. Doing so eliminates a long
+ // running issue, http://crbug.com/31014, where two of the same media
+ // resources could not be played back simultaneously due to one locking
+ // the cache entry until the entire video was downloaded.
+ //
+ // Bypassing the cache is not ideal, as we are now ignoring the cache
+ // entirely for all range requests to a resource beyond the first. This is
+ // however a much more succinct solution than the alternatives, which
+ // would require somewhat significant changes to the http caching logic.
+ const int kTimeoutSeconds = (partial_ && new_entry_->writer &&
rvargas (doing something else) 2014/08/22 22:19:24 nit: int timeout_seconds = 20; if (par
DaleCurtis 2014/08/22 22:33:03 Done.
+ new_entry_->writer->range_requested_)
+ ? 0
+ : 20;
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&HttpCache::Transaction::OnAddToEntryTimeout,
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698