tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit e31fee540044734ce7f0f20fcc3f1c67e8f4137d
parent 93bd84a6183a234896adcbe257db12848046a5e8
Author: Randell Jesup <rjesup@mozilla.com>
Date:   Tue,  7 Oct 2025 14:07:01 +0000

Bug 1917963: Add Cache flags for Compression Dictionaries r=necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D258120

Diffstat:
Mnetwerk/cache2/CacheIndex.h | 19++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/netwerk/cache2/CacheIndex.h b/netwerk/cache2/CacheIndex.h @@ -90,8 +90,9 @@ struct CacheIndexRecord { * 0000 1000 0000 0000 0000 0000 0000 0000 : fresh * 0000 0100 0000 0000 0000 0000 0000 0000 : pinned * 0000 0010 0000 0000 0000 0000 0000 0000 : has cached alt data - * 0000 0001 0000 0000 0000 0000 0000 0000 : reserved + * 0000 0001 0000 0000 0000 0000 0000 0000 : is a dictionary * 0000 0000 1111 1111 1111 1111 1111 1111 : file size (in kB) + * Max file size is 16GiB */ uint32_t mFlags{0}; @@ -99,6 +100,16 @@ struct CacheIndexRecord { }; #pragma pack(pop) +// For Compression Dictionaries, we make special entries in the cache for +// each origin with a dictionary. In the data or metadata for each of +// these entries, we store the hashes of the dictionary, the match value +// (required), the match-dest value (optional), the id (optional) and the +// type (optional). + +// We mark an entry if it's a dictionary (use-as-dictionary); if it is, +// when the entry is removed, we remove it from the origin's dictionary +// entry. If the origin's dictionary list is empty, we remove the origin. + static_assert(sizeof(CacheIndexRecord::mHash) + sizeof(CacheIndexRecord::mFrecency) + sizeof(CacheIndexRecord::mOriginAttrsHash) + @@ -378,9 +389,11 @@ class CacheIndexEntry : public PLDHashEntryHdr { // Indicates there is cached alternative data in the entry. static const uint32_t kHasAltDataMask = 0x02000000; - static const uint32_t kReservedMask = 0x01000000; - // FileSize in kilobytes + // Indicates that this entry is a dictionary + static const uint32_t kDictionaryMask = 0x01000000; + + // FileSize in kilobytes (max 16GB) static const uint32_t kFileSizeMask = 0x00FFFFFF; RefPtr<CacheIndexRecordWrapper> mRec;