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

Side by Side Diff: content/browser/cache_storage/README.md

Issue 2901083002: [CacheStorage] Pad and bin opaque resource sizes. (Closed)
Patch Set: Patch Set 8 changes. Created 3 years, 4 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
OLDNEW
1 # Architecture (as of July 29th 2016) 1 # Architecture (as of July 29th 2016)
2 This document descibes the browser-process implementation of the [Cache 2 This document describes the browser-process implementation of the [Cache
3 Storage specification]( 3 Storage specification](
4 https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html). 4 https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html).
5 5
6 ## Major Classes and Ownership 6 ## Major Classes and Ownership
7 ### Ownership 7 ### Ownership
8 Where '=>' represents ownership, '->' is a reference, and '~>' is a weak 8 Where '=>' represents ownership, '->' is a reference, and '~>' is a weak
9 reference. 9 reference.
10 10
11 ##### `CacheStorageContextImpl`=>`CacheStorageManager`=>`CacheStorage`=>`CacheSt orageCache` 11 ##### `CacheStorageContextImpl`=>`CacheStorageManager`=>`CacheStorage`=>`CacheSt orageCache`
12 * A `CacheStorageManager` can own multiple `CacheStorage` objects. 12 * A `CacheStorageManager` can own multiple `CacheStorage` objects.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 `CacheStorage` as well. This has happened in the past (`Cache::Put` called 145 `CacheStorage` as well. This has happened in the past (`Cache::Put` called
146 `QuotaManager` to determine how much room was available, which in turn called 146 `QuotaManager` to determine how much room was available, which in turn called
147 `Cache::Size`). Be careful to avoid situations in which one operation triggers 147 `Cache::Size`). Be careful to avoid situations in which one operation triggers
148 a dependency on another operation from the same scheduler. 148 a dependency on another operation from the same scheduler.
149 149
150 At the end of an operation, the scheduler needs to be kicked to start the next 150 At the end of an operation, the scheduler needs to be kicked to start the next
151 operation. The idiom for this in CacheStorage/ is to wrap the operation's 151 operation. The idiom for this in CacheStorage/ is to wrap the operation's
152 callback with a function that will run the callback as well as advance the 152 callback with a function that will run the callback as well as advance the
153 scheduler. So long as the operation runs its wrapped callback the scheduler 153 scheduler. So long as the operation runs its wrapped callback the scheduler
154 will advance. 154 will advance.
155
156 ## Opaque Resource Size Obfuscation
157 Applications can cache cross-origin resources as per
158 [Cross-Origin Resources and CORS](https://www.w3.org/TR/service-workers-1/#cross -origin-resources).
159 Opaque responses may only be cached, and in order to prevent "leaking" the size
jkarlin 2017/07/31 14:03:24 what do you mean "may only be cached". What is it
cmumford 2017/08/10 16:37:10 haha - yeah, good point.
160 of opaque responses their sizes are obfuscated. Random padding is added to the
161 actual size making it difficult for an attacker to ascertain the actual resource
162 size.
jkarlin 2017/07/31 14:03:24 actual resource size via quota apis.
cmumford 2017/08/10 16:37:10 Done.
163
164 When Chromium starts, a new random padding key is generated and used
165 for all new caches created. This key is used by each cache to calculate padding
166 for opaque resources. This key is also persisted to the cache index.
jkarlin 2017/07/31 14:03:24 How about replacing the last line with: Each cach
cmumford 2017/08/10 16:37:10 Done.
167
168 Each cache maintains the total padding for all opaque resources within the
169 cache. This padding is added to the actual resource size when reporting sizes
170 to the quota manager.
171
172 The algorithm version is also written to each cache. This allows for the
jkarlin 2017/07/31 14:03:24 s/algorithm/padding algorithm/
cmumford 2017/08/10 16:37:10 Done.
173 algorithm to be changed at a future date. CacheStorage will use the persisted
174 key and padding from the cache's index unless the algorithm has been changed,
175 one of values is missing, or deemed to be incorrect. In this situation the cache
176 is enumerated and the padding recalculated during open.
OLDNEW
« no previous file with comments | « no previous file | content/browser/cache_storage/cache_storage.h » ('j') | content/browser/cache_storage/cache_storage.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698