| OLD | NEW |
| 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 <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 std::unique_ptr<disk_cache::Backend::Iterator> MockDiskCache::CreateIterator() { | 508 std::unique_ptr<disk_cache::Backend::Iterator> MockDiskCache::CreateIterator() { |
| 509 return std::unique_ptr<Iterator>(new NotImplementedIterator()); | 509 return std::unique_ptr<Iterator>(new NotImplementedIterator()); |
| 510 } | 510 } |
| 511 | 511 |
| 512 void MockDiskCache::GetStats(base::StringPairs* stats) { | 512 void MockDiskCache::GetStats(base::StringPairs* stats) { |
| 513 } | 513 } |
| 514 | 514 |
| 515 void MockDiskCache::OnExternalCacheHit(const std::string& key) { | 515 void MockDiskCache::OnExternalCacheHit(const std::string& key) { |
| 516 } | 516 } |
| 517 | 517 |
| 518 size_t MockDiskCache::EstimateMemoryUsage() const { |
| 519 NOTREACHED(); |
| 520 return 0; |
| 521 } |
| 522 |
| 518 void MockDiskCache::ReleaseAll() { | 523 void MockDiskCache::ReleaseAll() { |
| 519 EntryMap::iterator it = entries_.begin(); | 524 EntryMap::iterator it = entries_.begin(); |
| 520 for (; it != entries_.end(); ++it) | 525 for (; it != entries_.end(); ++it) |
| 521 it->second->Release(); | 526 it->second->Release(); |
| 522 entries_.clear(); | 527 entries_.clear(); |
| 523 } | 528 } |
| 524 | 529 |
| 525 void MockDiskCache::CallbackLater(const CompletionCallback& callback, | 530 void MockDiskCache::CallbackLater(const CompletionCallback& callback, |
| 526 int result) { | 531 int result) { |
| 527 base::ThreadTaskRunnerHandle::Get()->PostTask( | 532 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 if (!callback_.is_null()) { | 688 if (!callback_.is_null()) { |
| 684 if (!fail_) | 689 if (!fail_) |
| 685 backend_->reset(new MockDiskCache()); | 690 backend_->reset(new MockDiskCache()); |
| 686 CompletionCallback cb = callback_; | 691 CompletionCallback cb = callback_; |
| 687 callback_.Reset(); | 692 callback_.Reset(); |
| 688 cb.Run(Result()); // This object can be deleted here. | 693 cb.Run(Result()); // This object can be deleted here. |
| 689 } | 694 } |
| 690 } | 695 } |
| 691 | 696 |
| 692 } // namespace net | 697 } // namespace net |
| OLD | NEW |