blink/renderer/modules/storageThis directory contains the renderer side implementation of the DOM Storage API. This API is defined in the HTML Spec's section on Web Storage.
The browser side code for this lives in content/browser/dom_storage/.
DOMWindowStorageThis implements the partial Window interface in window_storage.idl, and provides bindings for window.localStorage and window.sessionStorage to the web platform. This creates & owns the StorageArea objects.
StorageAreaThis implements the WebIDL Storage interface in storage.idl, and provides access to localStorage and sessionStorage. This class holds a shared reference to a CachedStorageArea (which can be shared between multiple StorageAreas), and basically delegates most calls here.
This is also temporarily created & used by InspectorDOMStorageAgent to make modifications to local & session storage.
CachedStorageAreaThis is responsible for
StorageAreaMap),Sources that are using this cached storage area (which are StorageAreas),StorageArea mojo interface, andStorageArea interface and communicating these to all Sources, and InspectorEventListeners.StorageAreaMapThis represents an in-memory cache of a storage area. It holds key-value storage and keeps track of the total size of the bytes stored.
StorageNamespaceThis class is responsible for
CachedStorageAreas on a per-origin basis,DOMStorageInspectorAgents & telling them when a storage event was dispatched,StoragePartitionService and SessionStorageNamespace mojo interfaces to create StorageArea mojo ptrs for the CachedStorageAreas and clone namespaces for SessionStorage.There are two versions of this class - one version is the SessionStorage version, which holds a SessionStorageNamespace mojo ptr and lives on a Page as a Page Supplement. The other version is for LocalStorage, which just uses the StoragePartitionService to open the StorageAreas, and is owned by the StorageController.
StorageControllerThis is a singleton that is responsible for keeping track of all StorageNamespaces and provide access to the functionality of its single LocalStorage StorageNamespace that it owns. It holds weak references to all of the SessionStorage StorageNamespaces so it can account for the total amount of memory used by all of DOMStorage. If this gets too high, it can ask all namespaces to prune all unused CacheStorageAreas.
InspectorDOMStorageAgentThis is used by the Inspector (DevTools) code to listen to and modify local & session storage. The StorageNamespace class allows these agents to be added & removed by the Inspector system, and all events that are dispatched on that namespace are sent to its InspectorDOMStorageAgents.
This class also creates a temporary StorageArea to query & modify local & session storage.
StorageArea lives on the window. Instances of this class hold a reference to a CachedStorageArea instance. All StorageArea instances representing the same area use the same CachedStorageArea instance (which is reference counted). Two classes are used to create and manage CachedStorageAreas - the StorageController, and StorageNamespaces.
The StorageNamespace represents a SessionStorage namespace, but can also be used for LocalStorage. It creates & manages CachedStorageAreas per-origin. It keeps a reference to all CachedStorageAreas it creates for memory accounting and object re-use. It also contains weak references to InspectorDOMStorageAgents that it notifies when StorageEvents are dispatched.
SessionStorage StorageNamespace objects live as supplements on the Page, so each Page owns one. The LocalStorage StorageNamespace object lives in the StorageController.
The StorageController is a singleton. It owns the LocalStorage StorageNamespace, and hold weak references to each SessionStorage StorageNamespace.
Finally - InspectorDomStorageAgent will create temporary StorageArea objects when it wants to query or modify DOMStorage.