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

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

Issue 1953703004: Purge browser cache for dom storage in a smarter way (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dom_storage
Patch Set: Created 4 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_DOM_STORAGE_DATABASE_H_ 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 25 matching lines...) Expand all
36 36
37 // Updates the backing database. Will remove all keys before updating 37 // Updates the backing database. Will remove all keys before updating
38 // the database if |clear_all_first| is set. Then all entries in 38 // the database if |clear_all_first| is set. Then all entries in
39 // |changes| will be examined - keys mapped to a null NullableString16 39 // |changes| will be examined - keys mapped to a null NullableString16
40 // will be removed and all others will be inserted/updated as appropriate. 40 // will be removed and all others will be inserted/updated as appropriate.
41 bool CommitChanges(bool clear_all_first, const DOMStorageValuesMap& changes); 41 bool CommitChanges(bool clear_all_first, const DOMStorageValuesMap& changes);
42 42
43 // Simple getter for the path we were constructed with. 43 // Simple getter for the path we were constructed with.
44 const base::FilePath& file_path() const { return file_path_; } 44 const base::FilePath& file_path() const { return file_path_; }
45 45
46 void TrimDatabase();
47
46 protected: 48 protected:
47 // Constructor that uses an in-memory sqlite database, for testing. 49 // Constructor that uses an in-memory sqlite database, for testing.
48 DOMStorageDatabase(); 50 DOMStorageDatabase();
49 51
50 private: 52 private:
51 friend class LocalStorageDatabaseAdapter; 53 friend class LocalStorageDatabaseAdapter;
52 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, SimpleOpenAndClose); 54 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, SimpleOpenAndClose);
53 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, TestLazyOpenIsLazy); 55 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, TestLazyOpenIsLazy);
54 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, TestDetectSchemaVersion); 56 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, TestDetectSchemaVersion);
55 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, 57 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 const base::FilePath file_path_; 112 const base::FilePath file_path_;
111 std::unique_ptr<sql::Connection> db_; 113 std::unique_ptr<sql::Connection> db_;
112 bool failed_to_open_; 114 bool failed_to_open_;
113 bool tried_to_recreate_; 115 bool tried_to_recreate_;
114 bool known_to_be_empty_; 116 bool known_to_be_empty_;
115 }; 117 };
116 118
117 } // namespace content 119 } // namespace content
118 120
119 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ 121 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698