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

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: Reword comment based on Gavin's feedback; rebase Created 3 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
« no previous file with comments | « no previous file | net/disk_cache/disk_cache.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 // 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 virtual void GetStats(base::StringPairs* stats) = 0; 216 virtual void GetStats(base::StringPairs* stats) = 0;
217 217
218 // Called whenever an external cache in the system reuses the resource 218 // Called whenever an external cache in the system reuses the resource
219 // referred to by |key|. 219 // referred to by |key|.
220 virtual void OnExternalCacheHit(const std::string& key) = 0; 220 virtual void OnExternalCacheHit(const std::string& key) = 0;
221 221
222 // Returns the estimate of dynamically allocated memory in bytes. 222 // Returns the estimate of dynamically allocated memory in bytes.
223 virtual size_t DumpMemoryStats( 223 virtual size_t DumpMemoryStats(
224 base::trace_event::ProcessMemoryDump* pmd, 224 base::trace_event::ProcessMemoryDump* pmd,
225 const std::string& parent_absolute_name) const = 0; 225 const std::string& parent_absolute_name) const = 0;
226
227 // Backends can optionally permit one to store, probabilistically, up to a
228 // byte associated with a key of an existing entry in memory.
229
230 // GetMemoryEntryData has the following behavior:
231 // - If the data is not available at this time for any reason, returns 0.
232 // - Otherwise, returns a value that was with very high probability
233 // given to SetMemoryEntryData(|key|) (and with a very low probability
234 // to a different key that collides in the in-memory index).
235 //
236 // Due to the probability of collisions, including those that can be induced
237 // by hostile 3rd parties, this interface should not be used to make decisions
238 // that affect correctness (especially security).
239 virtual uint8_t GetMemoryEntryData(const std::string& key);
Maks Orlovich 2017/08/23 19:18:11 Suggestion from the impl CL: pasko 2017/06/29 16:
Maks Orlovich 2017/08/25 18:36:26 Done.
240 virtual void SetMemoryEntryData(const std::string& key, uint8_t data);
226 }; 241 };
227 242
228 // This interface represents an entry in the disk cache. 243 // This interface represents an entry in the disk cache.
229 class NET_EXPORT Entry { 244 class NET_EXPORT Entry {
230 public: 245 public:
231 typedef net::CompletionCallback CompletionCallback; 246 typedef net::CompletionCallback CompletionCallback;
232 typedef net::IOBuffer IOBuffer; 247 typedef net::IOBuffer IOBuffer;
233 248
234 // Marks this cache entry for deletion. 249 // Marks this cache entry for deletion.
235 virtual void Doom() = 0; 250 virtual void Doom() = 0;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 entry->Close(); 407 entry->Close();
393 } 408 }
394 }; 409 };
395 410
396 // Automatically closes an entry when it goes out of scope. 411 // Automatically closes an entry when it goes out of scope.
397 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; 412 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr;
398 413
399 } // namespace disk_cache 414 } // namespace disk_cache
400 415
401 #endif // NET_DISK_CACHE_DISK_CACHE_H_ 416 #endif // NET_DISK_CACHE_DISK_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/disk_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698