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

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

Issue 1894733002: Change scoped_ptr to std::unique_ptr in //net/disk_cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 <stdint.h> 10 #include <stdint.h>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // Synchronous implementation of the asynchronous interface. 72 // Synchronous implementation of the asynchronous interface.
73 int SyncOpenEntry(const std::string& key, Entry** entry); 73 int SyncOpenEntry(const std::string& key, Entry** entry);
74 int SyncCreateEntry(const std::string& key, Entry** entry); 74 int SyncCreateEntry(const std::string& key, Entry** entry);
75 int SyncDoomEntry(const std::string& key); 75 int SyncDoomEntry(const std::string& key);
76 int SyncDoomAllEntries(); 76 int SyncDoomAllEntries();
77 int SyncDoomEntriesBetween(base::Time initial_time, 77 int SyncDoomEntriesBetween(base::Time initial_time,
78 base::Time end_time); 78 base::Time end_time);
79 int SyncCalculateSizeOfAllEntries(); 79 int SyncCalculateSizeOfAllEntries();
80 int SyncDoomEntriesSince(base::Time initial_time); 80 int SyncDoomEntriesSince(base::Time initial_time);
81 int SyncOpenNextEntry(Rankings::Iterator* iterator, Entry** next_entry); 81 int SyncOpenNextEntry(Rankings::Iterator* iterator, Entry** next_entry);
82 void SyncEndEnumeration(scoped_ptr<Rankings::Iterator> iterator); 82 void SyncEndEnumeration(std::unique_ptr<Rankings::Iterator> iterator);
83 void SyncOnExternalCacheHit(const std::string& key); 83 void SyncOnExternalCacheHit(const std::string& key);
84 84
85 // Open or create an entry for the given |key| or |iter|. 85 // Open or create an entry for the given |key| or |iter|.
86 EntryImpl* OpenEntryImpl(const std::string& key); 86 EntryImpl* OpenEntryImpl(const std::string& key);
87 EntryImpl* CreateEntryImpl(const std::string& key); 87 EntryImpl* CreateEntryImpl(const std::string& key);
88 EntryImpl* OpenNextEntryImpl(Rankings::Iterator* iter); 88 EntryImpl* OpenNextEntryImpl(Rankings::Iterator* iter);
89 89
90 // Sets the maximum size for the total amount of data stored by this instance. 90 // Sets the maximum size for the total amount of data stored by this instance.
91 bool SetMaxSize(int max_bytes); 91 bool SetMaxSize(int max_bytes);
92 92
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 const CompletionCallback& callback) override; 281 const CompletionCallback& callback) override;
282 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; 282 int CalculateSizeOfAllEntries(const CompletionCallback& callback) override;
283 // NOTE: The blockfile Backend::Iterator::OpenNextEntry method does not modify 283 // NOTE: The blockfile Backend::Iterator::OpenNextEntry method does not modify
284 // the last_used field of the entry, and therefore it does not impact the 284 // the last_used field of the entry, and therefore it does not impact the
285 // eviction ranking of the entry. However, an enumeration will go through all 285 // eviction ranking of the entry. However, an enumeration will go through all
286 // entries on the cache only if the cache is not modified while the 286 // entries on the cache only if the cache is not modified while the
287 // enumeration is taking place. Significantly altering the entry pointed by 287 // enumeration is taking place. Significantly altering the entry pointed by
288 // the iterator (for example, deleting the entry) will invalidate the 288 // the iterator (for example, deleting the entry) will invalidate the
289 // iterator. Performing operations on an entry that modify the entry may 289 // iterator. Performing operations on an entry that modify the entry may
290 // result in loops in the iteration, skipped entries or similar. 290 // result in loops in the iteration, skipped entries or similar.
291 scoped_ptr<Iterator> CreateIterator() override; 291 std::unique_ptr<Iterator> CreateIterator() override;
292 void GetStats(StatsItems* stats) override; 292 void GetStats(StatsItems* stats) override;
293 void OnExternalCacheHit(const std::string& key) override; 293 void OnExternalCacheHit(const std::string& key) override;
294 294
295 private: 295 private:
296 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; 296 typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap;
297 class IteratorImpl; 297 class IteratorImpl;
298 298
299 // Creates a new backing file for the cache index. 299 // Creates a new backing file for the cache index.
300 bool CreateBackingStore(disk_cache::File* file); 300 bool CreateBackingStore(disk_cache::File* file);
301 bool InitBackingStore(bool* file_created); 301 bool InitBackingStore(bool* file_created);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 bool unit_test_; 396 bool unit_test_;
397 bool read_only_; // Prevents updates of the rankings data (used by tools). 397 bool read_only_; // Prevents updates of the rankings data (used by tools).
398 bool disabled_; 398 bool disabled_;
399 bool new_eviction_; // What eviction algorithm should be used. 399 bool new_eviction_; // What eviction algorithm should be used.
400 bool first_timer_; // True if the timer has not been called. 400 bool first_timer_; // True if the timer has not been called.
401 bool user_load_; // True if we see a high load coming from the caller. 401 bool user_load_; // True if we see a high load coming from the caller.
402 402
403 net::NetLog* net_log_; 403 net::NetLog* net_log_;
404 404
405 Stats stats_; // Usage statistics. 405 Stats stats_; // Usage statistics.
406 scoped_ptr<base::RepeatingTimer> timer_; // Usage timer. 406 std::unique_ptr<base::RepeatingTimer> timer_; // Usage timer.
407 base::WaitableEvent done_; // Signals the end of background work. 407 base::WaitableEvent done_; // Signals the end of background work.
408 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. 408 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing.
409 base::WeakPtrFactory<BackendImpl> ptr_factory_; 409 base::WeakPtrFactory<BackendImpl> ptr_factory_;
410 410
411 DISALLOW_COPY_AND_ASSIGN(BackendImpl); 411 DISALLOW_COPY_AND_ASSIGN(BackendImpl);
412 }; 412 };
413 413
414 } // namespace disk_cache 414 } // namespace disk_cache
415 415
416 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ 416 #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