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

Side by Side 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: Reflow. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_cache_transaction.h" 5 #include "net/http/http_cache_transaction.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 cache_pending_ = true; 1375 cache_pending_ = true;
1376 next_state_ = STATE_ADD_TO_ENTRY_COMPLETE; 1376 next_state_ = STATE_ADD_TO_ENTRY_COMPLETE;
1377 net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY); 1377 net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY);
1378 DCHECK(entry_lock_waiting_since_.is_null()); 1378 DCHECK(entry_lock_waiting_since_.is_null());
1379 entry_lock_waiting_since_ = TimeTicks::Now(); 1379 entry_lock_waiting_since_ = TimeTicks::Now();
1380 int rv = cache_->AddTransactionToEntry(new_entry_, this); 1380 int rv = cache_->AddTransactionToEntry(new_entry_, this);
1381 if (rv == ERR_IO_PENDING) { 1381 if (rv == ERR_IO_PENDING) {
1382 if (bypass_lock_for_test_) { 1382 if (bypass_lock_for_test_) {
1383 OnAddToEntryTimeout(entry_lock_waiting_since_); 1383 OnAddToEntryTimeout(entry_lock_waiting_since_);
1384 } else { 1384 } else {
1385 const int kTimeoutSeconds = 20; 1385 // Immediately timeout and bypass the cache if we're a range request and
1386 // we're blocked by the reader/writer lock. Doing so eliminates a long
1387 // running issue, http://crbug.com/31014, where two of the same media
1388 // resources could not be played back simultaneously due to one locking
1389 // the cache entry until the entire video was downloaded.
1390 //
1391 // Bypassing the cache is not ideal, as we are now ignoring the cache
1392 // entirely for all range requests to a resource beyond the first. This is
1393 // however a much more succinct solution than the alternatives, which
1394 // would require somewhat significant changes to the http caching logic.
1395 const int kTimeoutSeconds = partial_ ? 0 : 20;
rvargas (doing something else) 2014/08/22 21:06:13 What happens if this is (partial_ && new_entry_->w
DaleCurtis 2014/08/22 21:25:52 Passes all the test the previous patch did. Do you
rvargas (doing something else) 2014/08/22 21:44:40 If all test pages etc behave the same, yes, I woul
DaleCurtis 2014/08/22 21:45:41 Done.
1386 base::MessageLoop::current()->PostDelayedTask( 1396 base::MessageLoop::current()->PostDelayedTask(
1387 FROM_HERE, 1397 FROM_HERE,
1388 base::Bind(&HttpCache::Transaction::OnAddToEntryTimeout, 1398 base::Bind(&HttpCache::Transaction::OnAddToEntryTimeout,
scherkus (not reviewing) 2014/08/22 21:01:51 what is the end-user visible effect caused by timi
rvargas (doing something else) 2014/08/22 21:10:25 The transaction is not timed out, just waiting on
DaleCurtis 2014/08/22 21:25:52 Nothing from a casual user perspective, even for d
1389 weak_factory_.GetWeakPtr(), entry_lock_waiting_since_), 1399 weak_factory_.GetWeakPtr(), entry_lock_waiting_since_),
1390 TimeDelta::FromSeconds(kTimeoutSeconds)); 1400 TimeDelta::FromSeconds(kTimeoutSeconds));
1391 } 1401 }
1392 } 1402 }
1393 return rv; 1403 return rv;
1394 } 1404 }
1395 1405
1396 int HttpCache::Transaction::DoAddToEntryComplete(int result) { 1406 int HttpCache::Transaction::DoAddToEntryComplete(int result) {
1397 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY, 1407 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY,
1398 result); 1408 result);
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2862 default: 2872 default:
2863 NOTREACHED(); 2873 NOTREACHED();
2864 } 2874 }
2865 } 2875 }
2866 2876
2867 void HttpCache::Transaction::OnIOComplete(int result) { 2877 void HttpCache::Transaction::OnIOComplete(int result) {
2868 DoLoop(result); 2878 DoLoop(result);
2869 } 2879 }
2870 2880
2871 } // namespace net 2881 } // namespace net
OLDNEW
« 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