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

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

Issue 2901083002: [CacheStorage] Pad and bin opaque resource sizes. (Closed)
Patch Set: Patch set 9 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
« no previous file with comments | « no previous file | content/browser/cache_storage/cache_storage.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 are also also cached, but in order to prevent "leaking" the siz e
jkarlin 2017/08/11 15:04:37 s/also also/also/
cmumford 2017/08/11 22:06:33 Done.
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 via quota APIs.
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. Each cache's key is persisted to disk in the cache index f ile
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 padding algorithm version is also written to each cache allowing for it
173 to be changed at a future date. CacheStorage will use the persisted key and
174 padding from the cache's index unless the padding 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698