| OLD | NEW |
| 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" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 virtual int CreateEntry(const std::string& key, Entry** entry, | 69 virtual int CreateEntry(const std::string& key, Entry** entry, |
| 70 const CompletionCallback& callback) OVERRIDE; | 70 const CompletionCallback& callback) OVERRIDE; |
| 71 virtual int DoomEntry(const std::string& key, | 71 virtual int DoomEntry(const std::string& key, |
| 72 const CompletionCallback& callback) OVERRIDE; | 72 const CompletionCallback& callback) OVERRIDE; |
| 73 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; | 73 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; |
| 74 virtual int DoomEntriesBetween(base::Time initial_time, | 74 virtual int DoomEntriesBetween(base::Time initial_time, |
| 75 base::Time end_time, | 75 base::Time end_time, |
| 76 const CompletionCallback& callback) OVERRIDE; | 76 const CompletionCallback& callback) OVERRIDE; |
| 77 virtual int DoomEntriesSince(base::Time initial_time, | 77 virtual int DoomEntriesSince(base::Time initial_time, |
| 78 const CompletionCallback& callback) OVERRIDE; | 78 const CompletionCallback& callback) OVERRIDE; |
| 79 virtual int OpenNextEntry(void** iter, Entry** next_entry, | 79 virtual int OpenNextEntry(Iterator* iter, Entry** next_entry, |
| 80 const CompletionCallback& callback) 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: |
| 87 typedef base::hash_map<std::string, MemEntryImpl*> EntryMap; | 86 typedef base::hash_map<std::string, MemEntryImpl*> EntryMap; |
| 88 | 87 |
| 89 // Old Backend interface. | 88 // Old Backend interface. |
| 90 bool OpenEntry(const std::string& key, Entry** entry); | 89 bool OpenEntry(const std::string& key, Entry** entry); |
| 91 bool CreateEntry(const std::string& key, Entry** entry); | 90 bool CreateEntry(const std::string& key, Entry** entry); |
| 92 bool DoomEntry(const std::string& key); | 91 bool DoomEntry(const std::string& key); |
| 93 bool DoomAllEntries(); | 92 bool DoomAllEntries(); |
| 94 bool DoomEntriesBetween(const base::Time initial_time, | 93 bool DoomEntriesBetween(const base::Time initial_time, |
| 95 const base::Time end_time); | 94 const base::Time end_time); |
| 96 bool DoomEntriesSince(const base::Time initial_time); | 95 bool DoomEntriesSince(const base::Time initial_time); |
| 97 bool OpenNextEntry(void** iter, Entry** next_entry); | 96 bool OpenNextEntry(Iterator* iter, Entry** next_entry); |
| 98 | 97 |
| 99 // Deletes entries from the cache until the current size is below the limit. | 98 // 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 | 99 // If empty is true, the whole cache will be trimmed, regardless of being in |
| 101 // use. | 100 // use. |
| 102 void TrimCache(bool empty); | 101 void TrimCache(bool empty); |
| 103 | 102 |
| 104 // Handles the used storage count. | 103 // Handles the used storage count. |
| 105 void AddStorageSize(int32 bytes); | 104 void AddStorageSize(int32 bytes); |
| 106 void SubstractStorageSize(int32 bytes); | 105 void SubstractStorageSize(int32 bytes); |
| 107 | 106 |
| 108 EntryMap entries_; | 107 EntryMap entries_; |
| 109 MemRankings rankings_; // Rankings to be able to trim the cache. | 108 MemRankings rankings_; // Rankings to be able to trim the cache. |
| 110 int32 max_size_; // Maximum data size for this instance. | 109 int32 max_size_; // Maximum data size for this instance. |
| 111 int32 current_size_; | 110 int32 current_size_; |
| 112 | 111 |
| 113 net::NetLog* net_log_; | 112 net::NetLog* net_log_; |
| 114 | 113 |
| 115 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); | 114 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); |
| 116 }; | 115 }; |
| 117 | 116 |
| 118 } // namespace disk_cache | 117 } // namespace disk_cache |
| 119 | 118 |
| 120 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ | 119 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ |
| OLD | NEW |