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

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

Issue 542733002: Remove void** from disk_cache interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: narrow given upstream 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) 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_BACKEND_IMPL_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 virtual int CreateEntry(const std::string& key, Entry** entry, 90 virtual int CreateEntry(const std::string& key, Entry** entry,
91 const CompletionCallback& callback) OVERRIDE; 91 const CompletionCallback& callback) OVERRIDE;
92 virtual int DoomEntry(const std::string& key, 92 virtual int DoomEntry(const std::string& key,
93 const CompletionCallback& callback) OVERRIDE; 93 const CompletionCallback& callback) OVERRIDE;
94 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; 94 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE;
95 virtual int DoomEntriesBetween(base::Time initial_time, 95 virtual int DoomEntriesBetween(base::Time initial_time,
96 base::Time end_time, 96 base::Time end_time,
97 const CompletionCallback& callback) OVERRIDE; 97 const CompletionCallback& callback) OVERRIDE;
98 virtual int DoomEntriesSince(base::Time initial_time, 98 virtual int DoomEntriesSince(base::Time initial_time,
99 const CompletionCallback& callback) OVERRIDE; 99 const CompletionCallback& callback) OVERRIDE;
100 virtual int OpenNextEntry(void** iter, Entry** next_entry, 100 virtual int OpenNextEntry(Iterator* iter, Entry** next_entry,
101 const CompletionCallback& callback) OVERRIDE; 101 const CompletionCallback& callback) OVERRIDE;
102 virtual void EndEnumeration(void** iter) OVERRIDE;
103 virtual void GetStats( 102 virtual void GetStats(
104 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; 103 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE;
105 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; 104 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE;
106 105
107 private: 106 private:
108 typedef base::hash_map<uint64, SimpleEntryImpl*> EntryMap; 107 typedef base::hash_map<uint64, SimpleEntryImpl*> EntryMap;
109 108
110 typedef base::Callback<void(base::Time mtime, uint64 max_size, int result)> 109 typedef base::Callback<void(base::Time mtime, uint64 max_size, int result)>
111 InitializeIndexCallback; 110 InitializeIndexCallback;
112 111
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 const CompletionCallback& callback); 150 const CompletionCallback& callback);
152 151
153 // Doom the entry corresponding to |entry_hash|, if it's active or currently 152 // Doom the entry corresponding to |entry_hash|, if it's active or currently
154 // pending doom. This function does not block if there is an active entry, 153 // pending doom. This function does not block if there is an active entry,
155 // which is very important to prevent races in DoomEntries() above. 154 // which is very important to prevent races in DoomEntries() above.
156 int DoomEntryFromHash(uint64 entry_hash, const CompletionCallback & callback); 155 int DoomEntryFromHash(uint64 entry_hash, const CompletionCallback & callback);
157 156
158 // Called when the index is initilized to find the next entry in the iterator 157 // Called when the index is initilized to find the next entry in the iterator
159 // |iter|. If there are no more hashes in the iterator list, net::ERR_FAILED 158 // |iter|. If there are no more hashes in the iterator list, net::ERR_FAILED
160 // is returned. Otherwise, calls OpenEntryFromHash. 159 // is returned. Otherwise, calls OpenEntryFromHash.
161 void GetNextEntryInIterator(void** iter, 160 void OpenNextEntryImpl(Iterator* iter,
162 Entry** next_entry, 161 Entry** next_entry,
163 const CompletionCallback& callback, 162 const CompletionCallback& callback,
164 int error_code); 163 int index_initialization_error_code);
165 164
166 // Called when we tried to open an entry with hash alone. When a blank entry 165 // Called when we tried to open an entry with hash alone. When a blank entry
167 // has been created and filled in with information from the disk - based on a 166 // has been created and filled in with information from the disk - based on a
168 // hash alone - this checks that a duplicate active entry was not created 167 // hash alone - this checks that a duplicate active entry was not created
169 // using a key in the meantime. 168 // using a key in the meantime.
170 void OnEntryOpenedFromHash(uint64 hash, 169 void OnEntryOpenedFromHash(uint64 hash,
171 Entry** entry, 170 Entry** entry,
172 const scoped_refptr<SimpleEntryImpl>& simple_entry, 171 const scoped_refptr<SimpleEntryImpl>& simple_entry,
173 const CompletionCallback& callback, 172 const CompletionCallback& callback,
174 int error_code); 173 int error_code);
175 174
176 // Called when we tried to open an entry from key. When the entry has been 175 // Called when we tried to open an entry from key. When the entry has been
177 // opened, a check for key mismatch is performed. 176 // opened, a check for key mismatch is performed.
178 void OnEntryOpenedFromKey(const std::string key, 177 void OnEntryOpenedFromKey(const std::string key,
179 Entry** entry, 178 Entry** entry,
180 const scoped_refptr<SimpleEntryImpl>& simple_entry, 179 const scoped_refptr<SimpleEntryImpl>& simple_entry,
181 const CompletionCallback& callback, 180 const CompletionCallback& callback,
182 int error_code); 181 int error_code);
183 182
184 // Called at the end of the asynchronous operation triggered by 183 // Called at the end of the asynchronous operation triggered by
185 // OpenEntryFromHash. Makes sure to continue iterating if the open entry was 184 // OpenEntryFromHash. Makes sure to continue iterating if the open entry was
186 // not a success. 185 // not a success.
187 void CheckIterationReturnValue(void** iter, 186 void CheckIterationReturnValue(Iterator* iter,
188 Entry** entry, 187 Entry** entry,
189 const CompletionCallback& callback, 188 const CompletionCallback& callback,
190 int error_code); 189 int error_code);
191 190
192 // A callback thunk used by DoomEntries to clear the |entries_pending_doom_| 191 // A callback thunk used by DoomEntries to clear the |entries_pending_doom_|
193 // after a mass doom. 192 // after a mass doom.
194 void DoomEntriesComplete(scoped_ptr<std::vector<uint64> > entry_hashes, 193 void DoomEntriesComplete(scoped_ptr<std::vector<uint64> > entry_hashes,
195 const CompletionCallback& callback, 194 const CompletionCallback& callback,
196 int result); 195 int result);
197 196
(...skipping 13 matching lines...) Expand all
211 // is complete. The base::Closure map target is used to store deferred 210 // is complete. The base::Closure map target is used to store deferred
212 // operations to be run at the completion of the Doom. 211 // operations to be run at the completion of the Doom.
213 base::hash_map<uint64, std::vector<base::Closure> > entries_pending_doom_; 212 base::hash_map<uint64, std::vector<base::Closure> > entries_pending_doom_;
214 213
215 net::NetLog* const net_log_; 214 net::NetLog* const net_log_;
216 }; 215 };
217 216
218 } // namespace disk_cache 217 } // namespace disk_cache
219 218
220 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ 219 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698