OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ | 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ |
6 #define CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ | 6 #define CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 LocalStorageContextMojo(service_manager::Connector* connector, | 33 LocalStorageContextMojo(service_manager::Connector* connector, |
34 const base::FilePath& subdirectory); | 34 const base::FilePath& subdirectory); |
35 ~LocalStorageContextMojo(); | 35 ~LocalStorageContextMojo(); |
36 | 36 |
37 void OpenLocalStorage(const url::Origin& origin, | 37 void OpenLocalStorage(const url::Origin& origin, |
38 mojom::LevelDBWrapperRequest request); | 38 mojom::LevelDBWrapperRequest request); |
39 void GetStorageUsage(GetStorageUsageCallback callback); | 39 void GetStorageUsage(GetStorageUsageCallback callback); |
40 void DeleteStorage(const url::Origin& origin); | 40 void DeleteStorage(const url::Origin& origin); |
41 // Like DeleteStorage(), but also deletes storage for all sub-origins. | 41 // Like DeleteStorage(), but also deletes storage for all sub-origins. |
42 void DeleteStorageForPhysicalOrigin(const url::Origin& origin); | 42 void DeleteStorageForPhysicalOrigin(const url::Origin& origin); |
| 43 void Flush(); |
43 | 44 |
44 void SetDatabaseForTesting(leveldb::mojom::LevelDBDatabasePtr database); | 45 void SetDatabaseForTesting(leveldb::mojom::LevelDBDatabasePtr database); |
45 | 46 |
46 private: | 47 private: |
47 // Runs |callback| immediately if already connected to a database, otherwise | 48 // Runs |callback| immediately if already connected to a database, otherwise |
48 // delays running |callback| untill after a connection has been established. | 49 // delays running |callback| untill after a connection has been established. |
49 // Initiates connecting to the database if no connection is in progres yet. | 50 // Initiates connecting to the database if no connection is in progres yet. |
50 void RunWhenConnected(base::OnceClosure callback); | 51 void RunWhenConnected(base::OnceClosure callback); |
51 | 52 |
52 void OnLevelDBWrapperHasNoBindings(const url::Origin& origin); | 53 void OnLevelDBWrapperHasNoBindings(const url::Origin& origin); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 102 |
102 // Maps between an origin and its prefixed LevelDB view. | 103 // Maps between an origin and its prefixed LevelDB view. |
103 std::map<url::Origin, std::unique_ptr<LevelDBWrapperImpl>> level_db_wrappers_; | 104 std::map<url::Origin, std::unique_ptr<LevelDBWrapperImpl>> level_db_wrappers_; |
104 | 105 |
105 base::WeakPtrFactory<LocalStorageContextMojo> weak_ptr_factory_; | 106 base::WeakPtrFactory<LocalStorageContextMojo> weak_ptr_factory_; |
106 }; | 107 }; |
107 | 108 |
108 } // namespace content | 109 } // namespace content |
109 | 110 |
110 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ | 111 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ |
OLD | NEW |