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

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

Issue 127083002: **STILLBAKING** Decouple disk cache tests from backends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upstream rebase Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/blockfile/disk_cache_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.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
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
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
OLDNEW
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/blockfile/disk_cache_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698