Index: content/browser/dom_storage/dom_storage_context_wrapper.h |
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.h b/content/browser/dom_storage/dom_storage_context_wrapper.h |
index b16b7235faff85f57550ef714a6760307fa91726..a7c93cc09de1b28fd8a6f6d6299cdde36a61a77f 100644 |
--- a/content/browser/dom_storage/dom_storage_context_wrapper.h |
+++ b/content/browser/dom_storage/dom_storage_context_wrapper.h |
@@ -10,6 +10,11 @@ |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "components/filesystem/public/interfaces/directory.mojom.h" |
+#include "components/filesystem/public/interfaces/file_system.mojom.h" |
+#include "components/leveldb/public/interfaces/leveldb.mojom.h" |
+#include "components/profile_service/public/interfaces/profile.mojom.h" |
#include "content/common/content_export.h" |
#include "content/common/storage_partition_service.mojom.h" |
#include "content/public/browser/dom_storage_context.h" |
@@ -26,6 +31,7 @@ namespace content { |
class DOMStorageContextImpl; |
class LevelDBWrapperImpl; |
+class MojoAppConnection; |
// This is owned by Storage Partition and encapsulates all its dom storage |
// state. |
@@ -34,9 +40,8 @@ class CONTENT_EXPORT DOMStorageContextWrapper : |
public base::RefCountedThreadSafe<DOMStorageContextWrapper> { |
public: |
// If |data_path| is empty, nothing will be saved to disk. |
- DOMStorageContextWrapper( |
- const base::FilePath& data_path, |
- storage::SpecialStoragePolicy* special_storage_policy); |
+ DOMStorageContextWrapper(BrowserContext* context, |
+ const base::FilePath& data_path); |
// DOMStorageContext implementation. |
void GetLocalStorageUsage( |
@@ -76,13 +81,44 @@ class CONTENT_EXPORT DOMStorageContextWrapper : |
void LevelDBWrapperImplHasNoBindings(const std::string& origin); |
+ // Part of our asynchronous directory opening called from OpenLocalStorage(). |
+ void OnDirectoryOpened(filesystem::FileError err); |
+ void OnDatabaseOpened(leveldb::DatabaseError status); |
+ |
+ void OnCrudWritten(leveldb::DatabaseError status); |
+ |
+ // The (possibly delayed) implementation of OpenLocalStorage(). Can be called |
+ // directly from that function, or through |on_database_open_callbacks_|. |
+ void BindLocalStorage( |
+ const mojo::String& origin, |
+ mojo::InterfaceRequest<LevelDBWrapper> request); |
+ |
// Used for mojo-based LocalStorage implementation (behind |
// --mojo-local-storage for now). Maps between an origin and its prefixed |
// LevelDB view. |
std::map<std::string, scoped_ptr<LevelDBWrapperImpl>> level_db_wrappers_; |
+ BrowserContext* browser_context_; |
scoped_refptr<DOMStorageContextImpl> context_; |
+ enum ConnectionState { |
+ NO_CONNECTION, |
+ CONNECITON_IN_PROGRESS, |
+ CONNECTED |
+ } connection_state_; |
+ |
+ scoped_ptr<MojoAppConnection> profile_connection_; |
+ profile::ProfileServicePtr profile_service_; |
+ filesystem::DirectoryPtr directory_; |
+ |
+ scoped_ptr<MojoAppConnection> leveldb_connection_; |
+ leveldb::LevelDBServicePtr leveldb_; |
+ leveldb::LevelDBDatabasePtr database_; |
+ |
+ std::vector<base::Closure> on_database_opened_callbacks_; |
+ |
+ base::WeakPtrFactory<DOMStorageContextWrapper> weak_ptr_factory_; |
+ |
DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper); |
}; |