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

Side by Side Diff: net/http/http_cache.cc

Issue 1476123002: Bounce all requests off the cache lock after 25ms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke comments Created 5 years 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
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_cache_transaction.h » ('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.h" 5 #include "net/http/http_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 : HttpCache(make_scoped_ptr(new HttpNetworkLayer(session)), 302 : HttpCache(make_scoped_ptr(new HttpNetworkLayer(session)),
303 backend_factory.Pass(), 303 backend_factory.Pass(),
304 set_up_quic_server_info) {} 304 set_up_quic_server_info) {}
305 305
306 HttpCache::HttpCache(scoped_ptr<HttpTransactionFactory> network_layer, 306 HttpCache::HttpCache(scoped_ptr<HttpTransactionFactory> network_layer,
307 scoped_ptr<BackendFactory> backend_factory, 307 scoped_ptr<BackendFactory> backend_factory,
308 bool set_up_quic_server_info) 308 bool set_up_quic_server_info)
309 : net_log_(nullptr), 309 : net_log_(nullptr),
310 backend_factory_(backend_factory.Pass()), 310 backend_factory_(backend_factory.Pass()),
311 building_backend_(false), 311 building_backend_(false),
312 bypass_lock_for_test_(false),
313 fail_conditionalization_for_test_(false), 312 fail_conditionalization_for_test_(false),
314 mode_(NORMAL), 313 mode_(NORMAL),
315 network_layer_(network_layer.Pass()), 314 network_layer_(network_layer.Pass()),
316 clock_(new base::DefaultClock()), 315 clock_(new base::DefaultClock()),
317 weak_factory_(this) { 316 weak_factory_(this) {
318 HttpNetworkSession* session = network_layer_->GetSession(); 317 HttpNetworkSession* session = network_layer_->GetSession();
319 // Session may be NULL in unittests. 318 // Session may be NULL in unittests.
320 // TODO(mmenke): Seems like tests could be changed to provide a session, 319 // TODO(mmenke): Seems like tests could be changed to provide a session,
321 // rather than having logic only used in unit tests here. 320 // rather than having logic only used in unit tests here.
322 if (session) { 321 if (session) {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 int HttpCache::CreateTransaction(RequestPriority priority, 451 int HttpCache::CreateTransaction(RequestPriority priority,
453 scoped_ptr<HttpTransaction>* trans) { 452 scoped_ptr<HttpTransaction>* trans) {
454 // Do lazy initialization of disk cache if needed. 453 // Do lazy initialization of disk cache if needed.
455 if (!disk_cache_.get()) { 454 if (!disk_cache_.get()) {
456 // We don't care about the result. 455 // We don't care about the result.
457 CreateBackend(NULL, CompletionCallback()); 456 CreateBackend(NULL, CompletionCallback());
458 } 457 }
459 458
460 HttpCache::Transaction* transaction = 459 HttpCache::Transaction* transaction =
461 new HttpCache::Transaction(priority, this); 460 new HttpCache::Transaction(priority, this);
462 if (bypass_lock_for_test_)
463 transaction->BypassLockForTest();
464 if (fail_conditionalization_for_test_) 461 if (fail_conditionalization_for_test_)
465 transaction->FailConditionalizationForTest(); 462 transaction->FailConditionalizationForTest();
466 463
467 trans->reset(transaction); 464 trans->reset(transaction);
468 return OK; 465 return OK;
469 } 466 }
470 467
471 HttpCache* HttpCache::GetCache() { 468 HttpCache* HttpCache::GetCache() {
472 return this; 469 return this;
473 } 470 }
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 building_backend_ = false; 1159 building_backend_ = false;
1163 DeletePendingOp(pending_op); 1160 DeletePendingOp(pending_op);
1164 } 1161 }
1165 1162
1166 // The cache may be gone when we return from the callback. 1163 // The cache may be gone when we return from the callback.
1167 if (!item->DoCallback(result, disk_cache_.get())) 1164 if (!item->DoCallback(result, disk_cache_.get()))
1168 item->NotifyTransaction(result, NULL); 1165 item->NotifyTransaction(result, NULL);
1169 } 1166 }
1170 1167
1171 } // namespace net 1168 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_cache_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698