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

Side by Side Diff: net/disk_cache/simple/simple_index_file.h

Issue 22406005: Index initialization improvements for Simple Cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add unit test, fix windows build. Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 bool app_on_background); 90 bool app_on_background);
91 91
92 // Doom the entries specified in |entry_hashes|, calling |reply_callback| 92 // Doom the entries specified in |entry_hashes|, calling |reply_callback|
93 // with the result on the current thread when done. 93 // with the result on the current thread when done.
94 virtual void DoomEntrySet(scoped_ptr<std::vector<uint64> > entry_hashes, 94 virtual void DoomEntrySet(scoped_ptr<std::vector<uint64> > entry_hashes,
95 const base::Callback<void(int)>& reply_callback); 95 const base::Callback<void(int)>& reply_callback);
96 96
97 private: 97 private:
98 friend class WrappedSimpleIndexFile; 98 friend class WrappedSimpleIndexFile;
99 99
100 // When loading the entries from disk, add this many extra hash buckets to
101 // prevent reallocation on the IO thread when merging in new live entries.
102 static const int kExtraSizeForMerge = 512;
103
100 // Synchronous (IO performing) implementation of LoadIndexEntries. 104 // Synchronous (IO performing) implementation of LoadIndexEntries.
101 static void SyncLoadIndexEntries(base::Time cache_last_modified, 105 static void SyncLoadIndexEntries(base::Time cache_last_modified,
102 const base::FilePath& cache_directory, 106 const base::FilePath& cache_directory,
103 const base::FilePath& index_file_path, 107 const base::FilePath& index_file_path,
104 SimpleIndexLoadResult* out_result); 108 SimpleIndexLoadResult* out_result);
105 109
106 // Load the index file from disk returning an EntrySet. Upon failure, returns 110 // Load the index file from disk returning an EntrySet. Upon failure, returns
107 // NULL. 111 // NULL.
108 static void SyncLoadFromDisk(const base::FilePath& index_filename, 112 static void SyncLoadFromDisk(const base::FilePath& index_filename,
109 SimpleIndexLoadResult* out_result); 113 SimpleIndexLoadResult* out_result);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 static const char kIndexFileName[]; 147 static const char kIndexFileName[];
144 static const char kTempIndexFileName[]; 148 static const char kTempIndexFileName[];
145 149
146 DISALLOW_COPY_AND_ASSIGN(SimpleIndexFile); 150 DISALLOW_COPY_AND_ASSIGN(SimpleIndexFile);
147 }; 151 };
148 152
149 153
150 } // namespace disk_cache 154 } // namespace disk_cache
151 155
152 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ 156 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698