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

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

Issue 2767103002: Fix localstorage data migration. (Closed)
Patch Set: share one encoding function Created 3 years, 8 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // Like DeleteStorage(), but also deletes storage for all sub-origins. 44 // Like DeleteStorage(), but also deletes storage for all sub-origins.
45 void DeleteStorageForPhysicalOrigin(const url::Origin& origin); 45 void DeleteStorageForPhysicalOrigin(const url::Origin& origin);
46 void Flush(); 46 void Flush();
47 47
48 // Clears any caches, to free up as much memory as possible. Next access to 48 // Clears any caches, to free up as much memory as possible. Next access to
49 // storage for a particular origin will reload the data from the database. 49 // storage for a particular origin will reload the data from the database.
50 void PurgeMemory(); 50 void PurgeMemory();
51 51
52 leveldb::mojom::LevelDBDatabaseAssociatedRequest DatabaseRequestForTesting(); 52 leveldb::mojom::LevelDBDatabaseAssociatedRequest DatabaseRequestForTesting();
53 53
54 // Converts a string from the old storage format to the new storage format.
55 static std::vector<uint8_t> MigrateString(const base::string16& input);
56
54 private: 57 private:
55 friend class MojoDOMStorageBrowserTest; 58 friend class MojoDOMStorageBrowserTest;
56 59
57 class LevelDBWrapperHolder; 60 class LevelDBWrapperHolder;
58 61
59 // Runs |callback| immediately if already connected to a database, otherwise 62 // Runs |callback| immediately if already connected to a database, otherwise
60 // delays running |callback| untill after a connection has been established. 63 // delays running |callback| untill after a connection has been established.
61 // Initiates connecting to the database if no connection is in progres yet. 64 // Initiates connecting to the database if no connection is in progres yet.
62 void RunWhenConnected(base::OnceClosure callback); 65 void RunWhenConnected(base::OnceClosure callback);
63 66
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Used to access old data for migration. 123 // Used to access old data for migration.
121 scoped_refptr<DOMStorageTaskRunner> task_runner_; 124 scoped_refptr<DOMStorageTaskRunner> task_runner_;
122 base::FilePath old_localstorage_path_; 125 base::FilePath old_localstorage_path_;
123 126
124 base::WeakPtrFactory<LocalStorageContextMojo> weak_ptr_factory_; 127 base::WeakPtrFactory<LocalStorageContextMojo> weak_ptr_factory_;
125 }; 128 };
126 129
127 } // namespace content 130 } // namespace content
128 131
129 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ 132 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_browsertest.cc ('k') | content/browser/dom_storage/local_storage_context_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698