The quota system's primary role is to set and enforce limits on disk usage at both the browser level, and at the origin level (see ./quota_settings.cc for these limit values). The quota system manages disk usage only for certain web platform storage APIs.
In order for a storage backend to integrate with the quota system, it must implement the QuotaClient interface.
Most work on the quota system is currently done on the browser process' IO thread. There are plans for quota to be moved to the Storage Service, which will run on its own process on desktop platforms.
The quota system's interface is comprised of the following classes:
The “heart” of the quota system. This class lives on the browser process' IO thread, but is primarily accessed through QuotaManagerProxy, which handles thread hops. In the future, QuotaManagerProxy will turn into mojom::QuotaManager, and the quota system will be accessed exclusively via mojo.
This interface must be implemented by any storage backend that wants to integrate with the quota system. This is probably the most used interface from outside of the quota system.
Helpers for computing quota usage for opaque resources. Features that store opaque resources (AppCache, Cache Storage) should use these helpers to avoid leaking cross-origin information via the quota usage they report.
Hook that allows browser features (currently Extensions and Chrome Apps) to change an origin's quota.
The quota system's implementation is made up of the following components:
QuotaManagerImpl helpers that distribute tasks (e.g. measure an origin's quota usage) across QuotaClient instances, and cache results as needed.
Stores persistent information in a per-profile SQLite database. Currently stores a few bits of implementation details, and will likely be expanded to cover Storage Buckets. The currently stored information is a usage count, last-modified-time, and last-accessed-time for each origin (used to implement LRU eviction on storage pressure, and Clear Site Data with a time filter), and quota granted via the deprecated API webkitStorageInfo.requestQuota(PERSISTENT,...).
Handles eviction and records stats about eviction rounds.
Implementation detail of QuotaManagerImpl.
A device is said to be under storage pressure when it is close to capacity. Storage pressure is used to signal a couple of behaviors in the quota system:
This is the process by which the quota system cleans up app‘s data as disk usage gets close to the disk’s capacity.