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

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

Issue 2958033002: Interface for associating in-memory hint bytes with disk cache entries. (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | net/disk_cache/disk_cache.cc » ('j') | net/http/mock_http_cache.h » ('J')
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 // Defines the public interface of the disk cache. For more details see 5 // Defines the public interface of the disk cache. For more details see
6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache 6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache
7 7
8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_ 8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_
9 #define NET_DISK_CACHE_DISK_CACHE_H_ 9 #define NET_DISK_CACHE_DISK_CACHE_H_
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 virtual void GetStats(base::StringPairs* stats) = 0; 177 virtual void GetStats(base::StringPairs* stats) = 0;
178 178
179 // Called whenever an external cache in the system reuses the resource 179 // Called whenever an external cache in the system reuses the resource
180 // referred to by |key|. 180 // referred to by |key|.
181 virtual void OnExternalCacheHit(const std::string& key) = 0; 181 virtual void OnExternalCacheHit(const std::string& key) = 0;
182 182
183 // Returns the estimate of dynamically allocated memory in bytes. 183 // Returns the estimate of dynamically allocated memory in bytes.
184 virtual size_t DumpMemoryStats( 184 virtual size_t DumpMemoryStats(
185 base::trace_event::ProcessMemoryDump* pmd, 185 base::trace_event::ProcessMemoryDump* pmd,
186 const std::string& parent_absolute_name) const = 0; 186 const std::string& parent_absolute_name) const = 0;
187
188 // Backends can optionally permit one to store, probabilistically, up to a
189 // byte associated with a key of an existing entry in memory.
190
191 // GetMemoryEntryData has the following behavior:
192 // - If the feature is not supported by the backend, returns 0.
193 // - If the entry is not in the cache, returns 0.
Randy Smith (Not in Mondays) 2017/06/27 21:33:56 Definitively isn't in the cache, or isn't in the i
Maks Orlovich 2017/06/28 13:54:31 Hmm, good point. It's actually sort of a mixture e
gavinp 2017/08/04 17:33:14 This is subtle; because of course yes we can opera
Maks Orlovich 2017/08/23 18:52:05 Rephrased, but added "at this time".
194 // - Otherwise, returns a value that was with very high probability
195 // given to SetMemoryEntryData(|key|) (and with a very low probability
196 // to a different key that collides in the in-memory index).
Randy Smith (Not in Mondays) 2017/06/27 21:33:55 Hmmm. I'd rather have an interface that distingui
Maks Orlovich 2017/06/28 13:54:31 Not sure how you would use that.
197 //
198 // Due to the probability of collisions, including those that can be induced
199 // by hostile 3rd parties, this interface should not be used to make decisions
200 // that affect correctness (especially security).
201 virtual uint8_t GetMemoryEntryData(const std::string& key);
202 virtual void SetMemoryEntryData(const std::string& key, uint8_t data);
187 }; 203 };
188 204
189 // This interface represents an entry in the disk cache. 205 // This interface represents an entry in the disk cache.
190 class NET_EXPORT Entry { 206 class NET_EXPORT Entry {
191 public: 207 public:
192 typedef net::CompletionCallback CompletionCallback; 208 typedef net::CompletionCallback CompletionCallback;
193 typedef net::IOBuffer IOBuffer; 209 typedef net::IOBuffer IOBuffer;
194 210
195 // Marks this cache entry for deletion. 211 // Marks this cache entry for deletion.
196 virtual void Doom() = 0; 212 virtual void Doom() = 0;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 entry->Close(); 369 entry->Close();
354 } 370 }
355 }; 371 };
356 372
357 // Automatically closes an entry when it goes out of scope. 373 // Automatically closes an entry when it goes out of scope.
358 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; 374 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr;
359 375
360 } // namespace disk_cache 376 } // namespace disk_cache
361 377
362 #endif // NET_DISK_CACHE_DISK_CACHE_H_ 378 #endif // NET_DISK_CACHE_DISK_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/disk_cache.cc » ('j') | net/http/mock_http_cache.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698