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

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

Issue 583293002: Do not leak when iterator outlives disk cache backend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cacheenums-again
Patch Set: cleaner ownership 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) 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
71 int SyncCreateEntry(const std::string& key, Entry** entry); 71 int SyncCreateEntry(const std::string& key, Entry** entry);
72 int SyncDoomEntry(const std::string& key); 72 int SyncDoomEntry(const std::string& key);
73 int SyncDoomAllEntries(); 73 int SyncDoomAllEntries();
74 int SyncDoomEntriesBetween(base::Time initial_time, 74 int SyncDoomEntriesBetween(base::Time initial_time,
75 base::Time end_time); 75 base::Time end_time);
76 int SyncDoomEntriesSince(base::Time initial_time); 76 int SyncDoomEntriesSince(base::Time initial_time);
77 int SyncOpenNextEntry(void** iter, Entry** next_entry); 77 int SyncOpenNextEntry(Rankings::Iterator* iterator, Entry** next_entry);
78 void SyncEndEnumeration(void* iter); 78 void SyncEndEnumeration(scoped_ptr<Rankings::Iterator> iterator);
79 void SyncOnExternalCacheHit(const std::string& key); 79 void SyncOnExternalCacheHit(const std::string& key);
80 80
81 // Open or create an entry for the given |key| or |iter|. 81 // Open or create an entry for the given |key| or |iter|.
82 EntryImpl* OpenEntryImpl(const std::string& key); 82 EntryImpl* OpenEntryImpl(const std::string& key);
83 EntryImpl* CreateEntryImpl(const std::string& key); 83 EntryImpl* CreateEntryImpl(const std::string& key);
84 EntryImpl* OpenNextEntryImpl(void** iter); 84 EntryImpl* OpenNextEntryImpl(Rankings::Iterator* iter);
85 85
86 // Sets the maximum size for the total amount of data stored by this instance. 86 // Sets the maximum size for the total amount of data stored by this instance.
87 bool SetMaxSize(int max_bytes); 87 bool SetMaxSize(int max_bytes);
88 88
89 // Sets the cache type for this backend. 89 // Sets the cache type for this backend.
90 void SetType(net::CacheType type); 90 void SetType(net::CacheType type);
91 91
92 // Returns the full name for an external storage file. 92 // Returns the full name for an external storage file.
93 base::FilePath GetFileName(Addr address) const; 93 base::FilePath GetFileName(Addr address) const;
94 94
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 base::WaitableEvent done_; // Signals the end of background work. 397 base::WaitableEvent done_; // Signals the end of background work.
398 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing. 398 scoped_refptr<TraceObject> trace_object_; // Initializes internal tracing.
399 base::WeakPtrFactory<BackendImpl> ptr_factory_; 399 base::WeakPtrFactory<BackendImpl> ptr_factory_;
400 400
401 DISALLOW_COPY_AND_ASSIGN(BackendImpl); 401 DISALLOW_COPY_AND_ASSIGN(BackendImpl);
402 }; 402 };
403 403
404 } // namespace disk_cache 404 } // namespace disk_cache
405 405
406 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_ 406 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/blockfile/backend_impl.cc » ('j') | net/disk_cache/blockfile/backend_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698