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

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

Issue 345643003: Http cache: Implement a timeout for the cache lock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add constant Created 6 years, 6 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 | « net/http/mock_http_cache.h ('k') | no next file » | 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/mock_http_cache.h" 5 #include "net/http/mock_http_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 disk_cache::Backend* backend; 509 disk_cache::Backend* backend;
510 int rv = http_cache_.GetBackend(&backend, cb.callback()); 510 int rv = http_cache_.GetBackend(&backend, cb.callback());
511 rv = cb.GetResult(rv); 511 rv = cb.GetResult(rv);
512 return (rv == net::OK) ? static_cast<MockDiskCache*>(backend) : NULL; 512 return (rv == net::OK) ? static_cast<MockDiskCache*>(backend) : NULL;
513 } 513 }
514 514
515 int MockHttpCache::CreateTransaction(scoped_ptr<net::HttpTransaction>* trans) { 515 int MockHttpCache::CreateTransaction(scoped_ptr<net::HttpTransaction>* trans) {
516 return http_cache_.CreateTransaction(net::DEFAULT_PRIORITY, trans); 516 return http_cache_.CreateTransaction(net::DEFAULT_PRIORITY, trans);
517 } 517 }
518 518
519 void MockHttpCache::BypassCacheLock() {
520 http_cache_.BypassLockForTest();
521 }
522
519 bool MockHttpCache::ReadResponseInfo(disk_cache::Entry* disk_entry, 523 bool MockHttpCache::ReadResponseInfo(disk_cache::Entry* disk_entry,
520 net::HttpResponseInfo* response_info, 524 net::HttpResponseInfo* response_info,
521 bool* response_truncated) { 525 bool* response_truncated) {
522 int size = disk_entry->GetDataSize(0); 526 int size = disk_entry->GetDataSize(0);
523 527
524 net::TestCompletionCallback cb; 528 net::TestCompletionCallback cb;
525 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(size)); 529 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(size));
526 int rv = disk_entry->ReadData(0, 0, buffer.get(), size, cb.callback()); 530 int rv = disk_entry->ReadData(0, 0, buffer.get(), size, cb.callback());
527 rv = cb.GetResult(rv); 531 rv = cb.GetResult(rv);
528 EXPECT_EQ(size, rv); 532 EXPECT_EQ(size, rv);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 void MockBlockingBackendFactory::FinishCreation() { 626 void MockBlockingBackendFactory::FinishCreation() {
623 block_ = false; 627 block_ = false;
624 if (!callback_.is_null()) { 628 if (!callback_.is_null()) {
625 if (!fail_) 629 if (!fail_)
626 backend_->reset(new MockDiskCache()); 630 backend_->reset(new MockDiskCache());
627 net::CompletionCallback cb = callback_; 631 net::CompletionCallback cb = callback_;
628 callback_.Reset(); 632 callback_.Reset();
629 cb.Run(Result()); // This object can be deleted here. 633 cb.Run(Result()); // This object can be deleted here.
630 } 634 }
631 } 635 }
OLDNEW
« no previous file with comments | « net/http/mock_http_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698