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

Side by Side Diff: net/disk_cache/backend_impl.h

Issue 2869005: Disk Cache: Remove deprecated methods from the disk cache interface.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | « no previous file | net/disk_cache/backend_impl.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) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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 // See net/disk_cache/disk_cache.h for the public interface of the cache. 5 // See net/disk_cache/disk_cache.h for the public interface of the cache.
6 6
7 #ifndef NET_DISK_CACHE_BACKEND_IMPL_H_ 7 #ifndef NET_DISK_CACHE_BACKEND_IMPL_H_
8 #define NET_DISK_CACHE_BACKEND_IMPL_H_ 8 #define NET_DISK_CACHE_BACKEND_IMPL_H_
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 static int CreateBackend(const FilePath& full_path, bool force, 56 static int CreateBackend(const FilePath& full_path, bool force,
57 int max_bytes, net::CacheType type, 57 int max_bytes, net::CacheType type,
58 uint32 flags, base::MessageLoopProxy* thread, 58 uint32 flags, base::MessageLoopProxy* thread,
59 Backend** backend, CompletionCallback* callback); 59 Backend** backend, CompletionCallback* callback);
60 60
61 // Performs general initialization for this current instance of the cache. 61 // Performs general initialization for this current instance of the cache.
62 bool Init(); 62 bool Init();
63 63
64 // Backend interface. 64 // Backend interface.
65 virtual int32 GetEntryCount() const; 65 virtual int32 GetEntryCount() const;
66 virtual bool OpenEntry(const std::string& key, Entry** entry);
67 virtual int OpenEntry(const std::string& key, Entry** entry, 66 virtual int OpenEntry(const std::string& key, Entry** entry,
68 CompletionCallback* callback); 67 CompletionCallback* callback);
69 virtual bool CreateEntry(const std::string& key, Entry** entry);
70 virtual int CreateEntry(const std::string& key, Entry** entry, 68 virtual int CreateEntry(const std::string& key, Entry** entry,
71 CompletionCallback* callback); 69 CompletionCallback* callback);
72 virtual bool DoomEntry(const std::string& key);
73 virtual int DoomEntry(const std::string& key, CompletionCallback* callback); 70 virtual int DoomEntry(const std::string& key, CompletionCallback* callback);
74 virtual bool DoomAllEntries();
75 virtual int DoomAllEntries(CompletionCallback* callback); 71 virtual int DoomAllEntries(CompletionCallback* callback);
76 virtual bool DoomEntriesBetween(const base::Time initial_time,
77 const base::Time end_time);
78 virtual int DoomEntriesBetween(const base::Time initial_time, 72 virtual int DoomEntriesBetween(const base::Time initial_time,
79 const base::Time end_time, 73 const base::Time end_time,
80 CompletionCallback* callback); 74 CompletionCallback* callback);
81 virtual bool DoomEntriesSince(const base::Time initial_time);
82 virtual int DoomEntriesSince(const base::Time initial_time, 75 virtual int DoomEntriesSince(const base::Time initial_time,
83 CompletionCallback* callback); 76 CompletionCallback* callback);
84 virtual bool OpenNextEntry(void** iter, Entry** next_entry);
85 virtual int OpenNextEntry(void** iter, Entry** next_entry, 77 virtual int OpenNextEntry(void** iter, Entry** next_entry,
86 CompletionCallback* callback); 78 CompletionCallback* callback);
87 virtual void EndEnumeration(void** iter); 79 virtual void EndEnumeration(void** iter);
88 virtual void GetStats(StatsItems* stats); 80 virtual void GetStats(StatsItems* stats);
89 81
90 // Sets the maximum size for the total amount of data stored by this instance. 82 // Sets the maximum size for the total amount of data stored by this instance.
91 bool SetMaxSize(int max_bytes); 83 bool SetMaxSize(int max_bytes);
92 84
93 // Sets the cache type for this backend. 85 // Sets the cache type for this backend.
94 void SetType(net::CacheType type); 86 void SetType(net::CacheType type);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // Clears the counter of references to test handling of corruptions. 193 // Clears the counter of references to test handling of corruptions.
202 void ClearRefCountForTest(); 194 void ClearRefCountForTest();
203 195
204 // Peforms a simple self-check, and returns the number of dirty items 196 // Peforms a simple self-check, and returns the number of dirty items
205 // or an error code (negative value). 197 // or an error code (negative value).
206 int SelfCheck(); 198 int SelfCheck();
207 199
208 // Same bahavior as OpenNextEntry but walks the list from back to front. 200 // Same bahavior as OpenNextEntry but walks the list from back to front.
209 bool OpenPrevEntry(void** iter, Entry** prev_entry); 201 bool OpenPrevEntry(void** iter, Entry** prev_entry);
210 202
203 // Old Backend interface.
204 bool OpenEntry(const std::string& key, Entry** entry);
205 bool CreateEntry(const std::string& key, Entry** entry);
206 bool DoomEntry(const std::string& key);
207 bool DoomAllEntries();
208 bool DoomEntriesBetween(const base::Time initial_time,
209 const base::Time end_time);
210 bool DoomEntriesSince(const base::Time initial_time);
211 bool OpenNextEntry(void** iter, Entry** next_entry);
212
213 // Open or create an entry for the given |key|.
214 EntryImpl* OpenEntryImpl(const std::string& key);
215 EntryImpl* CreateEntryImpl(const std::string& key);
216
211 private: 217 private:
212 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; 218 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap;
213 219
214 // Creates a new backing file for the cache index. 220 // Creates a new backing file for the cache index.
215 bool CreateBackingStore(disk_cache::File* file); 221 bool CreateBackingStore(disk_cache::File* file);
216 bool InitBackingStore(bool* file_created); 222 bool InitBackingStore(bool* file_created);
217 void AdjustMaxCacheSize(int table_len); 223 void AdjustMaxCacheSize(int table_len);
218 224
219 // Deletes the cache and starts again. 225 // Deletes the cache and starts again.
220 void RestartCache(); 226 void RestartCache();
(...skipping 16 matching lines...) Expand all
237 // be set to NULL; in other words, it is used as an explicit iterator. 243 // be set to NULL; in other words, it is used as an explicit iterator.
238 bool OpenFollowingEntryFromList(bool forward, Rankings::List list, 244 bool OpenFollowingEntryFromList(bool forward, Rankings::List list,
239 CacheRankingsBlock** from_entry, 245 CacheRankingsBlock** from_entry,
240 EntryImpl** next_entry); 246 EntryImpl** next_entry);
241 247
242 // Returns the entry that is pointed by |next|. If we are trimming the cache, 248 // Returns the entry that is pointed by |next|. If we are trimming the cache,
243 // |to_evict| should be true so that we don't perform extra disk writes. 249 // |to_evict| should be true so that we don't perform extra disk writes.
244 EntryImpl* GetEnumeratedEntry(CacheRankingsBlock* next, bool to_evict); 250 EntryImpl* GetEnumeratedEntry(CacheRankingsBlock* next, bool to_evict);
245 251
246 // Re-opens an entry that was previously deleted. 252 // Re-opens an entry that was previously deleted.
247 bool ResurrectEntry(EntryImpl* deleted_entry, Entry** entry); 253 EntryImpl* ResurrectEntry(EntryImpl* deleted_entry);
248 254
249 void DestroyInvalidEntry(EntryImpl* entry); 255 void DestroyInvalidEntry(EntryImpl* entry);
250 void DestroyInvalidEntryFromEnumeration(EntryImpl* entry); 256 void DestroyInvalidEntryFromEnumeration(EntryImpl* entry);
251 257
252 // Handles the used storage count. 258 // Handles the used storage count.
253 void AddStorageSize(int32 bytes); 259 void AddStorageSize(int32 bytes);
254 void SubstractStorageSize(int32 bytes); 260 void SubstractStorageSize(int32 bytes);
255 261
256 // Update the number of referenced cache entries. 262 // Update the number of referenced cache entries.
257 void IncreaseNumRefs(); 263 void IncreaseNumRefs();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 313
308 DISALLOW_COPY_AND_ASSIGN(BackendImpl); 314 DISALLOW_COPY_AND_ASSIGN(BackendImpl);
309 }; 315 };
310 316
311 // Returns the prefered max cache size given the available disk space. 317 // Returns the prefered max cache size given the available disk space.
312 int PreferedCacheSize(int64 available); 318 int PreferedCacheSize(int64 available);
313 319
314 } // namespace disk_cache 320 } // namespace disk_cache
315 321
316 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_ 322 #endif // NET_DISK_CACHE_BACKEND_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698