| 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 return 0; |
| 520 } |
| 521 |
| 518 void MockDiskCache::ReleaseAll() { | 522 void MockDiskCache::ReleaseAll() { |
| 519 EntryMap::iterator it = entries_.begin(); | 523 EntryMap::iterator it = entries_.begin(); |
| 520 for (; it != entries_.end(); ++it) | 524 for (; it != entries_.end(); ++it) |
| 521 it->second->Release(); | 525 it->second->Release(); |
| 522 entries_.clear(); | 526 entries_.clear(); |
| 523 } | 527 } |
| 524 | 528 |
| 525 void MockDiskCache::CallbackLater(const CompletionCallback& callback, | 529 void MockDiskCache::CallbackLater(const CompletionCallback& callback, |
| 526 int result) { | 530 int result) { |
| 527 base::ThreadTaskRunnerHandle::Get()->PostTask( | 531 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 if (!callback_.is_null()) { | 694 if (!callback_.is_null()) { |
| 691 if (!fail_) | 695 if (!fail_) |
| 692 backend_->reset(new MockDiskCache()); | 696 backend_->reset(new MockDiskCache()); |
| 693 CompletionCallback cb = callback_; | 697 CompletionCallback cb = callback_; |
| 694 callback_.Reset(); | 698 callback_.Reset(); |
| 695 cb.Run(Result()); // This object can be deleted here. | 699 cb.Run(Result()); // This object can be deleted here. |
| 696 } | 700 } |
| 697 } | 701 } |
| 698 | 702 |
| 699 } // namespace net | 703 } // namespace net |
| OLD | NEW |