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 b6fe5da6ba26b3925fc0f54da15c1f3721bd88cb..7e06cafc9e9c18f084e291b599c7d25ec2575b18 100644 |
--- a/webkit/dom_storage/dom_storage_context.h |
+++ b/webkit/dom_storage/dom_storage_context.h |
@@ -7,6 +7,7 @@ |
#pragma once |
#include <map> |
+#include <set> |
#include <vector> |
#include "base/atomic_sequence_num.h" |
@@ -35,6 +36,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. |
@@ -160,6 +162,11 @@ class DomStorageContext |
void CloneSessionNamespace(int64 existing_id, int64 new_id, |
const std::string& new_persistent_id); |
+ // Deletes all namespaces which don't have an associated DomStorageNamespace |
+ // alive. This function is used for deleting possible leftover data after an |
+ // unclean exit. May be called on any thread. |
+ void StartScavengingUnusedSessionStorage(); |
+ |
private: |
friend class DomStorageContextTest; |
FRIEND_TEST_ALL_PREFIXES(DomStorageContextTest, Basics); |
@@ -171,6 +178,9 @@ class DomStorageContext |
void ClearSessionOnlyOrigins(); |
+ void FindUnusedSessionStorageInCommitSequence(); |
+ void DeleteNextUnunsedNamespaceInCommitSequence(); |
+ |
// Collection of namespaces keyed by id. |
StorageNamespaceMap namespaces_; |
@@ -195,6 +205,14 @@ class DomStorageContext |
bool is_shutdown_; |
bool force_keep_session_state_; |
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
+ scoped_refptr<SessionStorageDatabase> session_storage_database_; |
+ |
+ // Persistent namespace IDs to protect from leftover data deletion (they will |
+ // be needed for session restore). |
+ std::set<std::string> protected_persistent_session_ids_; |
+ |
+ // For cleaning up unused namespaces gradually. |
+ std::vector<std::string> deletable_persistent_namespace_ids_; |
}; |
} // namespace dom_storage |