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

Side by Side Diff: content/browser/dom_storage/local_storage_context_mojo.h

Issue 2847013002: Switch to mojo localstorage backend by default. (Closed)
Patch Set: rebase Created 3 years, 6 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 unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 namespace storage { 21 namespace storage {
22 class SpecialStoragePolicy; 22 class SpecialStoragePolicy;
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 26
27 class DOMStorageTaskRunner; 27 class DOMStorageTaskRunner;
28 class LevelDBWrapperImpl; 28 class LevelDBWrapperImpl;
29 struct LocalStorageUsageInfo; 29 struct LocalStorageUsageInfo;
30 30
31 // Used for mojo-based LocalStorage implementation (behind --mojo-local-storage 31 // Used for mojo-based LocalStorage implementation (can be disabled with
32 // for now). 32 // --disable-mojo-local-storage for now).
33 // Created on the UI thread, but all further methods are called on the IO 33 // Created on the UI thread, but all further methods are called on the IO
34 // thread. Furthermore since destruction of this class can involve asynchronous 34 // thread. Furthermore since destruction of this class can involve asynchronous
35 // steps, it can only be deleted by calling ShutdownAndDelete (on the IO 35 // steps, it can only be deleted by calling ShutdownAndDelete (on the IO
36 // thread), 36 // thread),
37 class CONTENT_EXPORT LocalStorageContextMojo { 37 class CONTENT_EXPORT LocalStorageContextMojo {
38 public: 38 public:
39 using GetStorageUsageCallback = 39 using GetStorageUsageCallback =
40 base::OnceCallback<void(std::vector<LocalStorageUsageInfo>)>; 40 base::OnceCallback<void(std::vector<LocalStorageUsageInfo>)>;
41 41
42 LocalStorageContextMojo( 42 LocalStorageContextMojo(
(...skipping 20 matching lines...) Expand all
63 // Called when the owning BrowserContext is ending. 63 // Called when the owning BrowserContext is ending.
64 // Schedules the commit of any unsaved changes and will delete 64 // Schedules the commit of any unsaved changes and will delete
65 // and keep data on disk per the content settings and special storage 65 // and keep data on disk per the content settings and special storage
66 // policies. 66 // policies.
67 void ShutdownAndDelete(); 67 void ShutdownAndDelete();
68 68
69 // Clears any caches, to free up as much memory as possible. Next access to 69 // Clears any caches, to free up as much memory as possible. Next access to
70 // storage for a particular origin will reload the data from the database. 70 // storage for a particular origin will reload the data from the database.
71 void PurgeMemory(); 71 void PurgeMemory();
72 72
73 leveldb::mojom::LevelDBDatabaseAssociatedRequest DatabaseRequestForTesting(); 73 void SetDatabaseForTesting(
74 leveldb::mojom::LevelDBDatabaseAssociatedPtr database);
74 75
75 // Converts a string from the old storage format to the new storage format. 76 // Converts a string from the old storage format to the new storage format.
76 static std::vector<uint8_t> MigrateString(const base::string16& input); 77 static std::vector<uint8_t> MigrateString(const base::string16& input);
77 78
78 private: 79 private:
79 friend class MojoDOMStorageBrowserTest; 80 friend class MojoDOMStorageBrowserTest;
80 81
81 class LevelDBWrapperHolder; 82 class LevelDBWrapperHolder;
82 83
83 ~LocalStorageContextMojo(); 84 ~LocalStorageContextMojo();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Used to access old data for migration. 149 // Used to access old data for migration.
149 scoped_refptr<DOMStorageTaskRunner> task_runner_; 150 scoped_refptr<DOMStorageTaskRunner> task_runner_;
150 base::FilePath old_localstorage_path_; 151 base::FilePath old_localstorage_path_;
151 152
152 base::WeakPtrFactory<LocalStorageContextMojo> weak_ptr_factory_; 153 base::WeakPtrFactory<LocalStorageContextMojo> weak_ptr_factory_;
153 }; 154 };
154 155
155 } // namespace content 156 } // namespace content
156 157
157 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ 158 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698