Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1100)

Unified Diff: webkit/dom_storage/dom_storage_context.h

Issue 9963107: Persist sessionStorage on disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Draft: associate with session restore. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/dom_storage/dom_storage_context.h
diff --git a/webkit/dom_storage/dom_storage_context.h b/webkit/dom_storage/dom_storage_context.h
index ca2b570f618d74cb9cc0f66e3717faf6fde6fb4a..f54d65adfadb31e941e4033b0dd57caba57c9a85 100644
--- a/webkit/dom_storage/dom_storage_context.h
+++ b/webkit/dom_storage/dom_storage_context.h
@@ -35,6 +35,7 @@ class DomStorageArea;
class DomStorageNamespace;
class DomStorageSession;
class DomStorageTaskRunner;
+class SessionStorageDatabase;
// The Context is the root of an object containment hierachy for
// Namespaces and Areas related to the owning profile.
@@ -88,6 +89,13 @@ class DomStorageContext
virtual ~EventObserver() {}
};
+ class SessionStorageObserver {
+ public:
+ virtual void OnSessionStorageNamespaceAssociated(
+ int64 real_namespace_id) = 0;
+ virtual ~SessionStorageObserver() {}
+ };
+
DomStorageContext(
const FilePath& localstorage_directory, // empty for incognito profiles
const FilePath& sessionstorage_directory, // empty for incognito profiles
@@ -148,6 +156,15 @@ class DomStorageContext
const DomStorageArea* area,
const GURL& page_url);
+ // Adds |observer| to get notified about the association between
+ // |namespace_id| and its real id in the database.
+ void AddSessionStorageObserver(int64 namespace_id,
+ SessionStorageObserver* observer);
+ void RemoveSessionStorageObserver(int64 namespace_id);
+
+ void NotifySessionStorageNamespaceAssociated(int64 namespace_id,
+ int64 real_namespace_id);
+
// May be called on any thread.
int64 AllocateSessionId() {
return session_id_sequence_.GetNext();
@@ -158,6 +175,9 @@ class DomStorageContext
void DeleteSessionNamespace(int64 namespace_id);
void CloneSessionNamespace(int64 existing_id, int64 new_id);
+ // May be called on any thread.
+ void AssociateSessionStorage(int64 namespace_id, int64 real_id);
+
private:
friend class DomStorageContextTest;
FRIEND_TEST_ALL_PREFIXES(DomStorageContextTest, Basics);
@@ -169,6 +189,11 @@ class DomStorageContext
void ClearLocalStateInCommitSequence();
+ void DeleteSessionNamespaceInCommitSequence(int64 namespace_id);
+ void DeleteLeftoverDataInCommitSequence();
+
+ void SessionStorageAssociated(int64 id, int64 real_id);
+
// Collection of namespaces keyed by id.
StorageNamespaceMap namespaces_;
@@ -186,6 +211,10 @@ class DomStorageContext
// List of objects observing local storage events.
ObserverList<EventObserver> event_observers_;
+ // Map of objects observing the association between session storage namespace
+ // ids and real ids in the database.
+ std::map<int64, SessionStorageObserver*> session_storage_observers_;
+
// We use a 32 bit identifier for per tab storage sessions.
// At a tab per second, this range is large enough for 68 years.
base::AtomicSequenceNumber session_id_sequence_;
@@ -194,6 +223,7 @@ class DomStorageContext
bool clear_local_state_;
bool save_session_state_;
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
+ scoped_refptr<SessionStorageDatabase> session_storage_database_;
};
} // namespace dom_storage

Powered by Google App Engine
This is Rietveld 408576698