summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/storage/StorageArea.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/storage/StorageArea.h')
-rw-r--r--src/3rdparty/webkit/WebCore/storage/StorageArea.h67
1 files changed, 41 insertions, 26 deletions
diff --git a/src/3rdparty/webkit/WebCore/storage/StorageArea.h b/src/3rdparty/webkit/WebCore/storage/StorageArea.h
index 2163287..69e7882 100644
--- a/src/3rdparty/webkit/WebCore/storage/StorageArea.h
+++ b/src/3rdparty/webkit/WebCore/storage/StorageArea.h
@@ -26,7 +26,13 @@
#ifndef StorageArea_h
#define StorageArea_h
+#if ENABLE(DOM_STORAGE)
+
#include "PlatformString.h"
+#include "SecurityOrigin.h"
+#include "StorageAreaSync.h"
+#include "StorageMap.h"
+#include "StorageSyncManager.h"
#include <wtf/Forward.h>
#include <wtf/PassRefPtr.h>
@@ -36,48 +42,57 @@
namespace WebCore {
class Frame;
+ class Page;
class SecurityOrigin;
+ class StorageAreaSync;
class StorageMap;
+ class StorageSyncManager;
typedef int ExceptionCode;
+ enum StorageType { LocalStorage, SessionStorage };
- class StorageArea : public RefCounted<StorageArea> {
+ class StorageArea : public ThreadSafeShared<StorageArea> {
public:
- virtual ~StorageArea();
-
- virtual unsigned length() const { return internalLength(); }
- virtual String key(unsigned index, ExceptionCode& ec) const { return internalKey(index, ec); }
- virtual String getItem(const String& key) const { return internalGetItem(key); }
- virtual void setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame) { internalSetItem(key, value, ec, sourceFrame); }
- virtual void removeItem(const String& key, Frame* sourceFrame) { internalRemoveItem(key, sourceFrame); }
- virtual void clear(Frame* sourceFrame) { internalClear(sourceFrame); }
- virtual bool contains(const String& key) const { return internalContains(key); }
-
+ static PassRefPtr<StorageArea> create(StorageType, SecurityOrigin*, PassRefPtr<StorageSyncManager>);
+ PassRefPtr<StorageArea> copy(SecurityOrigin*);
+
+ // The HTML5 DOM Storage API
+ unsigned length() const;
+ String key(unsigned index, ExceptionCode& ec) const;
+ String getItem(const String& key) const;
+ void setItem(const String& key, const String& value, ExceptionCode& ec, Frame* sourceFrame);
+ void removeItem(const String& key, Frame* sourceFrame);
+ void clear(Frame* sourceFrame);
+
+ bool contains(const String& key) const;
+ void close();
+
+ // Could be called from a background thread.
+ void importItem(const String& key, const String& value);
SecurityOrigin* securityOrigin() { return m_securityOrigin.get(); }
protected:
- StorageArea(SecurityOrigin*);
+ StorageArea(StorageType, SecurityOrigin*, PassRefPtr<StorageSyncManager>);
StorageArea(SecurityOrigin*, StorageArea*);
-
- unsigned internalLength() const;
- String internalKey(unsigned index, ExceptionCode&) const;
- String internalGetItem(const String&) const;
- void internalSetItem(const String& key, const String& value, ExceptionCode&, Frame* sourceFrame);
- void internalRemoveItem(const String&, Frame* sourceFrame);
- void internalClear(Frame* sourceFrame);
- bool internalContains(const String& key) const;
-
- // This is meant to be called from a background thread for LocalStorageArea's background thread import procedure.
- void importItem(const String& key, const String& value);
private:
- virtual void itemChanged(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) = 0;
- virtual void itemRemoved(const String& key, const String& oldValue, Frame* sourceFrame) = 0;
- virtual void areaCleared(Frame* sourceFrame) = 0;
+ void blockUntilImportComplete() const;
+
+ void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame);
+ 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
};
} // namespace WebCore
+#endif // ENABLE(DOM_STORAGE)
+
#endif // StorageArea_h