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

Side by Side Diff: net/disk_cache/memory/mem_backend_impl.h

Issue 542733002: Remove void** from disk_cache interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix EnumerateAndMatchKeys 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_MEMORY_MEM_BACKEND_IMPL_H_ 7 #ifndef NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_
8 #define NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ 8 #define NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/memory/weak_ptr.h"
12 #include "net/disk_cache/disk_cache.h" 13 #include "net/disk_cache/disk_cache.h"
13 #include "net/disk_cache/memory/mem_rankings.h" 14 #include "net/disk_cache/memory/mem_rankings.h"
14 15
15 namespace net { 16 namespace net {
16 class NetLog; 17 class NetLog;
17 } // namespace net 18 } // namespace net
18 19
19 namespace disk_cache { 20 namespace disk_cache {
20 21
21 class MemEntryImpl; 22 class MemEntryImpl;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 virtual int CreateEntry(const std::string& key, Entry** entry, 70 virtual int CreateEntry(const std::string& key, Entry** entry,
70 const CompletionCallback& callback) OVERRIDE; 71 const CompletionCallback& callback) OVERRIDE;
71 virtual int DoomEntry(const std::string& key, 72 virtual int DoomEntry(const std::string& key,
72 const CompletionCallback& callback) OVERRIDE; 73 const CompletionCallback& callback) OVERRIDE;
73 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; 74 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE;
74 virtual int DoomEntriesBetween(base::Time initial_time, 75 virtual int DoomEntriesBetween(base::Time initial_time,
75 base::Time end_time, 76 base::Time end_time,
76 const CompletionCallback& callback) OVERRIDE; 77 const CompletionCallback& callback) OVERRIDE;
77 virtual int DoomEntriesSince(base::Time initial_time, 78 virtual int DoomEntriesSince(base::Time initial_time,
78 const CompletionCallback& callback) OVERRIDE; 79 const CompletionCallback& callback) OVERRIDE;
79 virtual int OpenNextEntry(void** iter, Entry** next_entry, 80 virtual scoped_ptr<Iterator> CreateIterator() OVERRIDE;
80 const CompletionCallback& callback) OVERRIDE;
81 virtual void EndEnumeration(void** iter) OVERRIDE;
82 virtual void GetStats( 81 virtual void GetStats(
83 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE {} 82 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE {}
84 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; 83 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE;
85 84
86 private: 85 private:
86 class MemIterator;
87 friend class MemIterator;
88
87 typedef base::hash_map<std::string, MemEntryImpl*> EntryMap; 89 typedef base::hash_map<std::string, MemEntryImpl*> EntryMap;
88 90
89 // Old Backend interface. 91 // Old Backend interface.
90 bool OpenEntry(const std::string& key, Entry** entry); 92 bool OpenEntry(const std::string& key, Entry** entry);
91 bool CreateEntry(const std::string& key, Entry** entry); 93 bool CreateEntry(const std::string& key, Entry** entry);
92 bool DoomEntry(const std::string& key); 94 bool DoomEntry(const std::string& key);
93 bool DoomAllEntries(); 95 bool DoomAllEntries();
94 bool DoomEntriesBetween(const base::Time initial_time, 96 bool DoomEntriesBetween(const base::Time initial_time,
95 const base::Time end_time); 97 const base::Time end_time);
96 bool DoomEntriesSince(const base::Time initial_time); 98 bool DoomEntriesSince(const base::Time initial_time);
97 bool OpenNextEntry(void** iter, Entry** next_entry);
98 99
99 // Deletes entries from the cache until the current size is below the limit. 100 // Deletes entries from the cache until the current size is below the limit.
100 // If empty is true, the whole cache will be trimmed, regardless of being in 101 // If empty is true, the whole cache will be trimmed, regardless of being in
101 // use. 102 // use.
102 void TrimCache(bool empty); 103 void TrimCache(bool empty);
103 104
104 // Handles the used storage count. 105 // Handles the used storage count.
105 void AddStorageSize(int32 bytes); 106 void AddStorageSize(int32 bytes);
106 void SubstractStorageSize(int32 bytes); 107 void SubstractStorageSize(int32 bytes);
107 108
108 EntryMap entries_; 109 EntryMap entries_;
109 MemRankings rankings_; // Rankings to be able to trim the cache. 110 MemRankings rankings_; // Rankings to be able to trim the cache.
110 int32 max_size_; // Maximum data size for this instance. 111 int32 max_size_; // Maximum data size for this instance.
111 int32 current_size_; 112 int32 current_size_;
112 113
113 net::NetLog* net_log_; 114 net::NetLog* net_log_;
114 115
116 base::WeakPtrFactory<MemBackendImpl> weak_factory_;
117
115 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); 118 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl);
116 }; 119 };
117 120
118 } // namespace disk_cache 121 } // namespace disk_cache
119 122
120 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ 123 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698