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

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

Issue 2784803004: [HTTP Cache] Prevent memory backend from exceeding its max size (Closed)
Patch Set: Address comments from PS4 Created 3 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/memory/mem_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_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 <stdint.h> 10 #include <stdint.h>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Signals that an entry has been doomed, and so it should be removed from the 67 // Signals that an entry has been doomed, and so it should be removed from the
68 // list of active entries as appropriate, as well as removed from the 68 // list of active entries as appropriate, as well as removed from the
69 // |lru_list_|. 69 // |lru_list_|.
70 void OnEntryDoomed(MemEntryImpl* entry); 70 void OnEntryDoomed(MemEntryImpl* entry);
71 71
72 // Adjust the current size of this backend by |delta|. This is used to 72 // Adjust the current size of this backend by |delta|. This is used to
73 // determine if eviction is neccessary and when eviction is finished. 73 // determine if eviction is neccessary and when eviction is finished.
74 void ModifyStorageSize(int32_t delta); 74 void ModifyStorageSize(int32_t delta);
75 75
76 // Returns true if the cache's size is greater than the maximum allowed
77 // size.
78 bool HasExceededStorageSize() const;
79
76 // Backend interface. 80 // Backend interface.
77 net::CacheType GetCacheType() const override; 81 net::CacheType GetCacheType() const override;
78 int32_t GetEntryCount() const override; 82 int32_t GetEntryCount() const override;
79 int OpenEntry(const std::string& key, 83 int OpenEntry(const std::string& key,
80 Entry** entry, 84 Entry** entry,
81 const CompletionCallback& callback) override; 85 const CompletionCallback& callback) override;
82 int CreateEntry(const std::string& key, 86 int CreateEntry(const std::string& key,
83 Entry** entry, 87 Entry** entry,
84 const CompletionCallback& callback) override; 88 const CompletionCallback& callback) override;
85 int DoomEntry(const std::string& key, 89 int DoomEntry(const std::string& key,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 net::NetLog* net_log_; 127 net::NetLog* net_log_;
124 128
125 base::WeakPtrFactory<MemBackendImpl> weak_factory_; 129 base::WeakPtrFactory<MemBackendImpl> weak_factory_;
126 130
127 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); 131 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl);
128 }; 132 };
129 133
130 } // namespace disk_cache 134 } // namespace disk_cache
131 135
132 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_ 136 #endif // NET_DISK_CACHE_MEMORY_MEM_BACKEND_IMPL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/memory/mem_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698