| 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.h" | 5 #include "net/disk_cache/blockfile/backend_impl.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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 | 815 |
| 816 void BackendImpl::OnEntryDestroyBegin(Addr address) { | 816 void BackendImpl::OnEntryDestroyBegin(Addr address) { |
| 817 EntriesMap::iterator it = open_entries_.find(address.value()); | 817 EntriesMap::iterator it = open_entries_.find(address.value()); |
| 818 if (it != open_entries_.end()) | 818 if (it != open_entries_.end()) |
| 819 open_entries_.erase(it); | 819 open_entries_.erase(it); |
| 820 } | 820 } |
| 821 | 821 |
| 822 void BackendImpl::OnEntryDestroyEnd() { | 822 void BackendImpl::OnEntryDestroyEnd() { |
| 823 DecreaseNumRefs(); | 823 DecreaseNumRefs(); |
| 824 if (data_->header.num_bytes > max_size_ && !read_only_ && | 824 if (data_->header.num_bytes > max_size_ && !read_only_ && |
| 825 (up_ticks_ > kTrimDelay || user_flags_ & kNoRandom)) | 825 (up_ticks_ > kTrimDelay || user_flags_ & kNoRandom)) { |
| 826 eviction_.TrimCache(false); | 826 eviction_.TrimCache(false); |
| 827 } |
| 827 } | 828 } |
| 828 | 829 |
| 829 EntryImpl* BackendImpl::GetOpenEntry(CacheRankingsBlock* rankings) const { | 830 EntryImpl* BackendImpl::GetOpenEntry(CacheRankingsBlock* rankings) const { |
| 830 DCHECK(rankings->HasData()); | 831 DCHECK(rankings->HasData()); |
| 831 EntriesMap::const_iterator it = | 832 EntriesMap::const_iterator it = |
| 832 open_entries_.find(rankings->Data()->contents); | 833 open_entries_.find(rankings->Data()->contents); |
| 833 if (it != open_entries_.end()) { | 834 if (it != open_entries_.end()) { |
| 834 // We have this entry in memory. | 835 // We have this entry in memory. |
| 835 return it->second; | 836 return it->second; |
| 836 } | 837 } |
| (...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2093 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
| 2093 total_memory = kMaxBuffersSize; | 2094 total_memory = kMaxBuffersSize; |
| 2094 | 2095 |
| 2095 done = true; | 2096 done = true; |
| 2096 } | 2097 } |
| 2097 | 2098 |
| 2098 return static_cast<int>(total_memory); | 2099 return static_cast<int>(total_memory); |
| 2099 } | 2100 } |
| 2100 | 2101 |
| 2101 } // namespace disk_cache | 2102 } // namespace disk_cache |
| OLD | NEW |