StorageNamespaceProvider.h [plain text]
#ifndef StorageNamespaceProvider_h
#define StorageNamespaceProvider_h
#include "SecurityOriginHash.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/RefCounted.h>
namespace WebCore {
class Document;
class Page;
class SecurityOrigin;
class StorageArea;
class StorageNamespace;
class StorageNamespaceProvider : public RefCounted<StorageNamespaceProvider> {
public:
WEBCORE_EXPORT StorageNamespaceProvider();
WEBCORE_EXPORT virtual ~StorageNamespaceProvider();
virtual RefPtr<StorageNamespace> createSessionStorageNamespace(Page&, unsigned quota) = 0;
RefPtr<StorageArea> localStorageArea(Document&);
void addPage(Page&);
void removePage(Page&);
protected:
StorageNamespace* optionalLocalStorageNamespace() { return m_localStorageNamespace.get(); }
private:
StorageNamespace& localStorageNamespace();
StorageNamespace& transientLocalStorageNamespace(SecurityOrigin&);
virtual RefPtr<StorageNamespace> createLocalStorageNamespace(unsigned quota) = 0;
virtual RefPtr<StorageNamespace> createTransientLocalStorageNamespace(SecurityOrigin&, unsigned quota) = 0;
HashSet<Page*> m_pages;
RefPtr<StorageNamespace> m_localStorageNamespace;
HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageNamespace>> m_transientLocalStorageMap;
};
}
#endif // StorageNamespaceProvider_h