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/disk_cache/blockfile/backend_impl_v3.h" | 5 #include "net/disk_cache/blockfile/backend_impl_v3.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 SyncEndEnumeration(iter); | 653 SyncEndEnumeration(iter); |
654 return net::OK; | 654 return net::OK; |
655 } | 655 } |
656 | 656 |
657 entry->DoomImpl(); | 657 entry->DoomImpl(); |
658 entry->Release(); | 658 entry->Release(); |
659 SyncEndEnumeration(iter); // Dooming the entry invalidates the iterator. | 659 SyncEndEnumeration(iter); // Dooming the entry invalidates the iterator. |
660 } | 660 } |
661 } | 661 } |
662 | 662 |
663 int BackendImplV3::OpenNextEntry(void** iter, Entry** next_entry, | 663 scoped_ptr<Backend::Iterator> BackendImplV3::CreateIterator() { |
664 const CompletionCallback& callback) { | 664 class BackendIterator FINAL : public Backend::Iterator { |
665 DCHECK(!callback.is_null()); | 665 public: |
666 background_queue_.OpenNextEntry(iter, next_entry, callback); | 666 explicit BackendIterator(base::WeakPtr<InFlightBackendIO> background_queue) |
667 return net::ERR_IO_PENDING; | 667 : background_queue_(background_queue), data_(NULL) {} |
668 } | |
669 | 668 |
670 void BackendImplV3::EndEnumeration(void** iter) { | 669 virtual int OpenNextEntry( |
671 scoped_ptr<IndexIterator> iterator( | 670 Entry** next_entry, |
672 reinterpret_cast<IndexIterator*>(*iter)); | 671 const net::CompletionCallback& callback) OVERRIDE { |
673 *iter = NULL; | 672 if (!background_queue_) |
673 return net::ERR_FAILED; | |
674 background_queue_->OpenNextEntry(&data_, next_entry, callback); | |
675 return net::ERR_IO_PENDING; | |
676 } | |
677 | |
678 private: | |
679 const base::WeakPtr<InFlightBackendIO> background_queue_; | |
680 void* data_; | |
681 }; | |
682 | |
683 return | |
684 scoped_ptr<Backend::Iterator>(new BackendIterator(GetBackgroundQueue())); | |
674 } | 685 } |
675 | 686 |
676 void BackendImplV3::GetStats(StatsItems* stats) { | 687 void BackendImplV3::GetStats(StatsItems* stats) { |
677 if (disabled_) | 688 if (disabled_) |
678 return; | 689 return; |
679 | 690 |
680 std::pair<std::string, std::string> item; | 691 std::pair<std::string, std::string> item; |
681 | 692 |
682 item.first = "Entries"; | 693 item.first = "Entries"; |
683 item.second = base::StringPrintf("%d", data_->header.num_entries); | 694 item.second = base::StringPrintf("%d", data_->header.num_entries); |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1490 base::Time end_time, | 1501 base::Time end_time, |
1491 const CompletionCallback& callback) { | 1502 const CompletionCallback& callback) { |
1492 return net::ERR_FAILED; | 1503 return net::ERR_FAILED; |
1493 } | 1504 } |
1494 | 1505 |
1495 int BackendImplV3::DoomEntriesSince(base::Time initial_time, | 1506 int BackendImplV3::DoomEntriesSince(base::Time initial_time, |
1496 const CompletionCallback& callback) { | 1507 const CompletionCallback& callback) { |
1497 return net::ERR_FAILED; | 1508 return net::ERR_FAILED; |
1498 } | 1509 } |
1499 | 1510 |
1500 int BackendImplV3::OpenNextEntry(void** iter, Entry** next_entry, | 1511 scoped_ptr<Backend::Iterator> BackendImplV3::CreateIterator() { |
1501 const CompletionCallback& callback) { | 1512 class NotImplementedIterator FINAL : public Iterator { |
rvargas (doing something else)
2014/09/18 02:32:12
ditto. (out of the method and no FINAL)
gavinp
2014/09/18 18:13:04
Done.
| |
1502 return net::ERR_FAILED; | 1513 public: |
1503 } | 1514 virtual int OpenNextEntry( |
1504 | 1515 disk_cache::Entry** next_entry, |
1505 void BackendImplV3::EndEnumeration(void** iter) { | 1516 const net::CompletionCallback& callback) OVERRIDE { |
1506 NOTIMPLEMENTED(); | 1517 return net::ERR_NOT_IMPLEMENTED; |
1518 } | |
1519 }; | |
1520 return scoped_ptr<Iterator>(new NotImplementedIterator()); | |
1507 } | 1521 } |
1508 | 1522 |
1509 void BackendImplV3::GetStats(StatsItems* stats) { | 1523 void BackendImplV3::GetStats(StatsItems* stats) { |
1510 NOTIMPLEMENTED(); | 1524 NOTIMPLEMENTED(); |
1511 } | 1525 } |
1512 | 1526 |
1513 void BackendImplV3::OnExternalCacheHit(const std::string& key) { | 1527 void BackendImplV3::OnExternalCacheHit(const std::string& key) { |
1514 NOTIMPLEMENTED(); | 1528 NOTIMPLEMENTED(); |
1515 } | 1529 } |
1516 | 1530 |
1517 void BackendImplV3::CleanupCache() { | 1531 void BackendImplV3::CleanupCache() { |
1518 } | 1532 } |
1519 | 1533 |
1520 } // namespace disk_cache | 1534 } // namespace disk_cache |
OLD | NEW |