| OLD | NEW |
| 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 Loading... |
| 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 // Reduce the size of sqlite caches. |
| 47 void TrimMemory(); |
| 48 |
| 46 protected: | 49 protected: |
| 47 // Constructor that uses an in-memory sqlite database, for testing. | 50 // Constructor that uses an in-memory sqlite database, for testing. |
| 48 DOMStorageDatabase(); | 51 DOMStorageDatabase(); |
| 49 | 52 |
| 50 private: | 53 private: |
| 51 friend class LocalStorageDatabaseAdapter; | 54 friend class LocalStorageDatabaseAdapter; |
| 52 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, SimpleOpenAndClose); | 55 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, SimpleOpenAndClose); |
| 53 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, TestLazyOpenIsLazy); | 56 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, TestLazyOpenIsLazy); |
| 54 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, TestDetectSchemaVersion); | 57 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, TestDetectSchemaVersion); |
| 55 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, | 58 FRIEND_TEST_ALL_PREFIXES(DOMStorageDatabaseTest, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 const base::FilePath file_path_; | 113 const base::FilePath file_path_; |
| 111 std::unique_ptr<sql::Connection> db_; | 114 std::unique_ptr<sql::Connection> db_; |
| 112 bool failed_to_open_; | 115 bool failed_to_open_; |
| 113 bool tried_to_recreate_; | 116 bool tried_to_recreate_; |
| 114 bool known_to_be_empty_; | 117 bool known_to_be_empty_; |
| 115 }; | 118 }; |
| 116 | 119 |
| 117 } // namespace content | 120 } // namespace content |
| 118 | 121 |
| 119 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ | 122 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ |
| OLD | NEW |