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

Side by Side Diff: net/disk_cache/blockfile/backend_impl_v3.cc

Issue 542733002: Remove void** from disk_cache interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix EnumerateAndMatchKeys Created 6 years, 3 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
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/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
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 class BackendImplV3::IteratorImpl : public Backend::Iterator {
664 const CompletionCallback& callback) { 664 public:
665 DCHECK(!callback.is_null()); 665 explicit IteratorImpl(base::WeakPtr<InFlightBackendIO> background_queue)
666 background_queue_.OpenNextEntry(iter, next_entry, callback); 666 : background_queue_(background_queue), data_(NULL) {
667 return net::ERR_IO_PENDING; 667 }
668 }
669 668
670 void BackendImplV3::EndEnumeration(void** iter) { 669 virtual int OpenNextEntry(Entry** next_entry,
671 scoped_ptr<IndexIterator> iterator( 670 const net::CompletionCallback& callback) OVERRIDE {
672 reinterpret_cast<IndexIterator*>(*iter)); 671 if (!background_queue_)
673 *iter = NULL; 672 return net::ERR_FAILED;
673 background_queue_->OpenNextEntry(&data_, next_entry, callback);
674 return net::ERR_IO_PENDING;
675 }
676
677 private:
678 const base::WeakPtr<InFlightBackendIO> background_queue_;
679 void* data_;
680 };
681
682 scoped_ptr<Backend::Iterator> BackendImplV3::CreateIterator() {
683 return scoped_ptr<Backend::Iterator>(new IteratorImpl(GetBackgroundQueue()));
674 } 684 }
675 685
676 void BackendImplV3::GetStats(StatsItems* stats) { 686 void BackendImplV3::GetStats(StatsItems* stats) {
677 if (disabled_) 687 if (disabled_)
678 return; 688 return;
679 689
680 std::pair<std::string, std::string> item; 690 std::pair<std::string, std::string> item;
681 691
682 item.first = "Entries"; 692 item.first = "Entries";
683 item.second = base::StringPrintf("%d", data_->header.num_entries); 693 item.second = base::StringPrintf("%d", data_->header.num_entries);
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 base::Time end_time, 1500 base::Time end_time,
1491 const CompletionCallback& callback) { 1501 const CompletionCallback& callback) {
1492 return net::ERR_FAILED; 1502 return net::ERR_FAILED;
1493 } 1503 }
1494 1504
1495 int BackendImplV3::DoomEntriesSince(base::Time initial_time, 1505 int BackendImplV3::DoomEntriesSince(base::Time initial_time,
1496 const CompletionCallback& callback) { 1506 const CompletionCallback& callback) {
1497 return net::ERR_FAILED; 1507 return net::ERR_FAILED;
1498 } 1508 }
1499 1509
1500 int BackendImplV3::OpenNextEntry(void** iter, Entry** next_entry,
1501 const CompletionCallback& callback) {
1502 return net::ERR_FAILED;
1503 }
1504 1510
1505 void BackendImplV3::EndEnumeration(void** iter) { 1511 class BackendImplV3::NotImplementedIterator : public Backend::Iterator {
1506 NOTIMPLEMENTED(); 1512 public:
1513 virtual int OpenNextEntry(disk_cache::Entry** next_entry,
1514 const net::CompletionCallback& callback) OVERRIDE {
1515 return net::ERR_NOT_IMPLEMENTED;
1516 }
1517 };
1518
1519 scoped_ptr<Backend::Iterator> BackendImplV3::CreateIterator() {
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698