#ifndef StorageAreaImpl_h
#define StorageAreaImpl_h
#include "StorageArea.h"
#include "Timer.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class SecurityOrigin;
class StorageMap;
class StorageAreaSync;
class StorageAreaImpl : public StorageArea {
public:
static PassRefPtr<StorageAreaImpl> create(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
virtual ~StorageAreaImpl();
virtual unsigned length(Frame* sourceFrame) const;
virtual String key(unsigned index, Frame* sourceFrame) const;
virtual String getItem(const String& key, Frame* sourceFrame) const;
virtual String setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame);
virtual String removeItem(const String& key, Frame* sourceFrame);
virtual bool clear(Frame* sourceFrame);
virtual bool contains(const String& key, Frame* sourceFrame) const;
virtual bool disabledByPrivateBrowsingInFrame(const Frame* sourceFrame) const;
virtual void incrementAccessCount();
virtual void decrementAccessCount();
PassRefPtr<StorageAreaImpl> copy();
void close();
void importItem(const String& key, const String& value);
void clearForOriginDeletion();
void sync();
private:
StorageAreaImpl(StorageType, PassRefPtr<SecurityOrigin>, PassRefPtr<StorageSyncManager>, unsigned quota);
StorageAreaImpl(StorageAreaImpl*);
void blockUntilImportComplete() const;
void closeDatabaseTimerFired(Timer<StorageAreaImpl>*);
StorageType m_storageType;
RefPtr<SecurityOrigin> m_securityOrigin;
RefPtr<StorageMap> m_storageMap;
RefPtr<StorageAreaSync> m_storageAreaSync;
RefPtr<StorageSyncManager> m_storageSyncManager;
#ifndef NDEBUG
bool m_isShutdown;
#endif
unsigned m_accessCount;
Timer<StorageAreaImpl> m_closeDatabaseTimer;
};
}
#endif // StorageAreaImpl_h