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

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

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/blockfile/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) 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 // 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_BLOCKFILE_BACKEND_IMPL_H_ 7 #ifndef NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_
8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ 8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 friend class Eviction; 50 friend class Eviction;
51 public: 51 public:
52 BackendImpl(const base::FilePath& path, 52 BackendImpl(const base::FilePath& path,
53 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, 53 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread,
54 net::NetLog* net_log); 54 net::NetLog* net_log);
55 // mask can be used to limit the usable size of the hash table, for testing. 55 // mask can be used to limit the usable size of the hash table, for testing.
56 BackendImpl(const base::FilePath& path, 56 BackendImpl(const base::FilePath& path,
57 uint32 mask, 57 uint32 mask,
58 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, 58 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread,
59 net::NetLog* net_log); 59 net::NetLog* net_log);
60 virtual ~BackendImpl(); 60 ~BackendImpl() override;
61 61
62 // Performs general initialization for this current instance of the cache. 62 // Performs general initialization for this current instance of the cache.
63 int Init(const CompletionCallback& callback); 63 int Init(const CompletionCallback& callback);
64 64
65 // Performs the actual initialization and final cleanup on destruction. 65 // Performs the actual initialization and final cleanup on destruction.
66 int SyncInit(); 66 int SyncInit();
67 void CleanupCache(); 67 void CleanupCache();
68 68
69 // Synchronous implementation of the asynchronous interface. 69 // Synchronous implementation of the asynchronous interface.
70 int SyncOpenEntry(const std::string& key, Entry** entry); 70 int SyncOpenEntry(const std::string& key, Entry** entry);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 base::RepeatingTimer<BackendImpl>* GetTimerForTest(); 252 base::RepeatingTimer<BackendImpl>* GetTimerForTest();
253 253
254 // Performs a simple self-check, and returns the number of dirty items 254 // Performs a simple self-check, and returns the number of dirty items
255 // or an error code (negative value). 255 // or an error code (negative value).
256 int SelfCheck(); 256 int SelfCheck();
257 257
258 // Ensures the index is flushed to disk (a no-op on platforms with mmap). 258 // Ensures the index is flushed to disk (a no-op on platforms with mmap).
259 void FlushIndex(); 259 void FlushIndex();
260 260
261 // Backend implementation. 261 // Backend implementation.
262 virtual net::CacheType GetCacheType() const override; 262 net::CacheType GetCacheType() const override;
263 virtual int32 GetEntryCount() const override; 263 int32 GetEntryCount() const override;
264 virtual int OpenEntry(const std::string& key, Entry** entry, 264 int OpenEntry(const std::string& key,
265 const CompletionCallback& callback) override; 265 Entry** entry,
266 virtual int CreateEntry(const std::string& key, Entry** entry, 266 const CompletionCallback& callback) override;
267 const CompletionCallback& callback) override; 267 int CreateEntry(const std::string& key,
268 virtual int DoomEntry(const std::string& key, 268 Entry** entry,
269 const CompletionCallback& callback) override; 269 const CompletionCallback& callback) override;
270 virtual int DoomAllEntries(const CompletionCallback& callback) override; 270 int DoomEntry(const std::string& key,
271 virtual int DoomEntriesBetween(base::Time initial_time, 271 const CompletionCallback& callback) override;
272 base::Time end_time, 272 int DoomAllEntries(const CompletionCallback& callback) override;
273 const CompletionCallback& callback) override; 273 int DoomEntriesBetween(base::Time initial_time,
274 virtual int DoomEntriesSince(base::Time initial_time, 274 base::Time end_time,
275 const CompletionCallback& callback) override; 275 const CompletionCallback& callback) override;
276 int DoomEntriesSince(base::Time initial_time,
277 const CompletionCallback& callback) override;
276 // NOTE: The blockfile Backend::Iterator::OpenNextEntry method does not modify 278 // NOTE: The blockfile Backend::Iterator::OpenNextEntry method does not modify
277 // the last_used field of the entry, and therefore it does not impact the 279 // the last_used field of the entry, and therefore it does not impact the
278 // eviction ranking of the entry. However, an enumeration will go through all 280 // eviction ranking of the entry. However, an enumeration will go through all
279 // entries on the cache only if the cache is not modified while the 281 // entries on the cache only if the cache is not modified while the
280 // enumeration is taking place. Significantly altering the entry pointed by 282 // enumeration is taking place. Significantly altering the entry pointed by
281 // the iterator (for example, deleting the entry) will invalidate the 283 // the iterator (for example, deleting the entry) will invalidate the
282 // iterator. Performing operations on an entry that modify the entry may 284 // iterator. Performing operations on an entry that modify the entry may
283 // result in loops in the iteration, skipped entries or similar. 285 // result in loops in the iteration, skipped entries or similar.
284 virtual scoped_ptr<Iterator> CreateIterator() override; 286 scoped_ptr<Iterator> CreateIterator() override;
285 virtual void GetStats(StatsItems* stats) override; 287 void GetStats(StatsItems* stats) override;
286 virtual void OnExternalCacheHit(const std::string& key) override; 288 void OnExternalCacheHit(const std::string& key) override;
287 289
288 private: 290 private:
289 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; 291 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap;
290 class IteratorImpl; 292 class IteratorImpl;
291 293
292 // Creates a new backing file for the cache index. 294 // Creates a new backing file for the cache index.
293 bool CreateBackingStore(disk_cache::File* file); 295 bool CreateBackingStore(disk_cache::File* file);
294 bool InitBackingStore(bool* file_created); 296 bool InitBackingStore(bool* file_created);
295 void AdjustMaxCacheSize(int table_len); 297 void AdjustMaxCacheSize(int table_len);
296 298
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 base::WaitableEvent done_; // Signals the end of background work. 399 base::WaitableEvent done_; // Signals the end of background work.
398 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. 400 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing.
399 base::WeakPtrFactory<BackendImpl> ptr_factory_; 401 base::WeakPtrFactory<BackendImpl> ptr_factory_;
400 402
401 DISALLOW_COPY_AND_ASSIGN(BackendImpl); 403 DISALLOW_COPY_AND_ASSIGN(BackendImpl);
402 }; 404 };
403 405
404 } // namespace disk_cache 406 } // namespace disk_cache
405 407
406 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ 408 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/blockfile/backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698