OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/backend_impl.h" | 5 #include "net/disk_cache/backend_impl.h" |
6 | 6 |
7 #include "base/field_trial.h" | 7 #include "base/field_trial.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 DecreaseNumEntries(); | 755 DecreaseNumEntries(); |
756 } | 756 } |
757 | 757 |
758 void BackendImpl::CacheEntryDestroyed(Addr address) { | 758 void BackendImpl::CacheEntryDestroyed(Addr address) { |
759 EntriesMap::iterator it = open_entries_.find(address.value()); | 759 EntriesMap::iterator it = open_entries_.find(address.value()); |
760 if (it != open_entries_.end()) | 760 if (it != open_entries_.end()) |
761 open_entries_.erase(it); | 761 open_entries_.erase(it); |
762 DecreaseNumRefs(); | 762 DecreaseNumRefs(); |
763 } | 763 } |
764 | 764 |
765 bool BackendImpl::IsOpen(CacheRankingsBlock* rankings) const { | 765 EntryImpl* BackendImpl::GetOpenEntry(CacheRankingsBlock* rankings) const { |
766 DCHECK(rankings->HasData()); | 766 DCHECK(rankings->HasData()); |
767 EntriesMap::const_iterator it = | 767 EntriesMap::const_iterator it = |
768 open_entries_.find(rankings->Data()->contents); | 768 open_entries_.find(rankings->Data()->contents); |
769 if (it != open_entries_.end()) { | 769 if (it != open_entries_.end()) { |
770 // We have this entry in memory. | 770 // We have this entry in memory. |
771 return rankings->Data()->pointer == it->second; | 771 return it->second; |
772 } | 772 } |
773 | 773 |
774 return false; | 774 return NULL; |
775 } | 775 } |
776 | 776 |
777 int32 BackendImpl::GetCurrentEntryId() const { | 777 int32 BackendImpl::GetCurrentEntryId() const { |
778 return data_->header.this_id; | 778 return data_->header.this_id; |
779 } | 779 } |
780 | 780 |
781 int BackendImpl::MaxFileSize() const { | 781 int BackendImpl::MaxFileSize() const { |
782 return max_size_ / 8; | 782 return max_size_ / 8; |
783 } | 783 } |
784 | 784 |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 if (num_entries + num_dirty != data_->header.num_entries) { | 1634 if (num_entries + num_dirty != data_->header.num_entries) { |
1635 LOG(ERROR) << "Number of entries mismatch"; | 1635 LOG(ERROR) << "Number of entries mismatch"; |
1636 return ERR_NUM_ENTRIES_MISMATCH; | 1636 return ERR_NUM_ENTRIES_MISMATCH; |
1637 } | 1637 } |
1638 | 1638 |
1639 return num_dirty; | 1639 return num_dirty; |
1640 } | 1640 } |
1641 | 1641 |
1642 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { | 1642 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { |
1643 RankingsNode* rankings = cache_entry->rankings()->Data(); | 1643 RankingsNode* rankings = cache_entry->rankings()->Data(); |
1644 return !rankings->pointer; | 1644 return !rankings->dummy; |
1645 } | 1645 } |
1646 | 1646 |
1647 } // namespace disk_cache | 1647 } // namespace disk_cache |
OLD | NEW |