Chromium Code Reviews| 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..6071c939d99473dd337e1b158f6b1dfe37934978 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. |
| @@ -35,6 +41,7 @@ class CONTENT_EXPORT DOMStorageContextWrapper : |
| public: |
| // If |data_path| is empty, nothing will be saved to disk. |
| DOMStorageContextWrapper( |
| + uint32_t mojo_user_id, |
| const base::FilePath& data_path, |
| storage::SpecialStoragePolicy* special_storage_policy); |
| @@ -76,13 +83,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_; |
| + uint32_t mojo_user_id_; |
|
michaeln
2016/03/05 01:38:54
I'd prefer to factor the new mojo based impl out i
Elliot Glaysher
2016/03/10 21:00:35
Moved all implementation details into their own in
|
| 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_; |
|
michaeln
2016/03/05 01:38:54
Since we only need leveldb_connection_ and databas
Elliot Glaysher
2016/03/10 21:00:35
I previously tried to do this, and had problems. T
|
| + |
| + std::vector<base::Closure> on_database_opened_callbacks_; |
| + |
| + base::WeakPtrFactory<DOMStorageContextWrapper> weak_ptr_factory_; |
| + |
| DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper); |
| }; |