| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
| 6 #define CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 6 #define CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 virtual bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot); | 74 virtual bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot); |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion67To68); | 77 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion67To68); |
| 78 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion68To69); | 78 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion68To69); |
| 79 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion69To70); | 79 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion69To70); |
| 80 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion70To71); | 80 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion70To71); |
| 81 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion71To72); | 81 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion71To72); |
| 82 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, ModelTypeIds); | 82 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, ModelTypeIds); |
| 83 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, Corruption); | 83 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, Corruption); |
| 84 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, DeleteEntries); |
| 84 FRIEND_TEST_ALL_PREFIXES(MigrationTest, ToCurrentVersion); | 85 FRIEND_TEST_ALL_PREFIXES(MigrationTest, ToCurrentVersion); |
| 85 friend class MigrationTest; | 86 friend class MigrationTest; |
| 86 | 87 |
| 87 // General Directory initialization and load helpers. | 88 // General Directory initialization and load helpers. |
| 88 DirOpenResult InitializeTables(); | 89 DirOpenResult InitializeTables(); |
| 89 // Returns an sqlite return code, usually SQLITE_DONE. | 90 // Returns an sqlite return code, usually SQLITE_DONE. |
| 90 int CreateTables(); | 91 int CreateTables(); |
| 91 | 92 |
| 92 // Create 'share_info' or 'temp_share_info' depending on value of | 93 // Create 'share_info' or 'temp_share_info' depending on value of |
| 93 // is_temporary. Returns an sqlite return code, SQLITE_DONE on success. | 94 // is_temporary. Returns an sqlite return code, SQLITE_DONE on success. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 115 | 116 |
| 116 // Creates a new sqlite3 handle to the backing database. Sets sqlite operation | 117 // Creates a new sqlite3 handle to the backing database. Sets sqlite operation |
| 117 // timeout preferences and registers our overridden sqlite3 operators for | 118 // timeout preferences and registers our overridden sqlite3 operators for |
| 118 // said handle. Returns true on success, false if the sqlite open operation | 119 // said handle. Returns true on success, false if the sqlite open operation |
| 119 // did not succeed. | 120 // did not succeed. |
| 120 bool OpenAndConfigureHandleHelper(sqlite3** handle) const; | 121 bool OpenAndConfigureHandleHelper(sqlite3** handle) const; |
| 121 // Initialize and destroy load_dbhandle_. Broken out for testing. | 122 // Initialize and destroy load_dbhandle_. Broken out for testing. |
| 122 bool BeginLoad(); | 123 bool BeginLoad(); |
| 123 void EndLoad(); | 124 void EndLoad(); |
| 124 | 125 |
| 126 // Close save_dbhandle_. Broken out for testing. |
| 127 void EndSave(); |
| 128 |
| 129 // Removes each entry whose metahandle is in |handles| from the database. |
| 130 // Does synchronous I/O. Returns false on error. |
| 131 bool DeleteEntries(const MetahandleSet& handles); |
| 132 |
| 125 // Lazy creation of save_dbhandle_ for use by SaveChanges code path. | 133 // Lazy creation of save_dbhandle_ for use by SaveChanges code path. |
| 126 sqlite3* LazyGetSaveHandle(); | 134 sqlite3* LazyGetSaveHandle(); |
| 127 | 135 |
| 128 // Drop all tables in preparation for reinitialization. | 136 // Drop all tables in preparation for reinitialization. |
| 129 void DropAllTables(); | 137 void DropAllTables(); |
| 130 | 138 |
| 131 // Serialization helpers for syncable::ModelType. These convert between | 139 // Serialization helpers for syncable::ModelType. These convert between |
| 132 // the ModelType enum and the values we persist in the database to identify | 140 // the ModelType enum and the values we persist in the database to identify |
| 133 // a model. We persist a default instance of the specifics protobuf as the | 141 // a model. We persist a default instance of the specifics protobuf as the |
| 134 // ID, rather than the enum value. | 142 // ID, rather than the enum value. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // Set to true if migration left some old columns around that need to be | 177 // Set to true if migration left some old columns around that need to be |
| 170 // discarded. | 178 // discarded. |
| 171 bool needs_column_refresh_; | 179 bool needs_column_refresh_; |
| 172 | 180 |
| 173 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); | 181 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); |
| 174 }; | 182 }; |
| 175 | 183 |
| 176 } // namespace syncable | 184 } // namespace syncable |
| 177 | 185 |
| 178 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 186 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
| OLD | NEW |