| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // calls SaveChanges *must* be the thread that owns/destroys |this|. | 73 // calls SaveChanges *must* be the thread that owns/destroys |this|. |
| 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, MigrateVersion72To73); | 82 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion72To73); |
| 83 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion73To74); |
| 83 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, ModelTypeIds); | 84 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, ModelTypeIds); |
| 84 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, Corruption); | 85 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, Corruption); |
| 85 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, DeleteEntries); | 86 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, DeleteEntries); |
| 86 FRIEND_TEST_ALL_PREFIXES(MigrationTest, ToCurrentVersion); | 87 FRIEND_TEST_ALL_PREFIXES(MigrationTest, ToCurrentVersion); |
| 87 friend class MigrationTest; | 88 friend class MigrationTest; |
| 88 | 89 |
| 89 // General Directory initialization and load helpers. | 90 // General Directory initialization and load helpers. |
| 90 DirOpenResult InitializeTables(); | 91 DirOpenResult InitializeTables(); |
| 91 // Returns an sqlite return code, usually SQLITE_DONE. | 92 // Returns an sqlite return code, usually SQLITE_DONE. |
| 92 int CreateTables(); | 93 int CreateTables(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 int old_value_column, | 166 int old_value_column, |
| 166 sync_pb::EntitySpecifics* mutable_new_value)); | 167 sync_pb::EntitySpecifics* mutable_new_value)); |
| 167 | 168 |
| 168 // Individual version migrations. | 169 // Individual version migrations. |
| 169 bool MigrateVersion67To68(); | 170 bool MigrateVersion67To68(); |
| 170 bool MigrateVersion68To69(); | 171 bool MigrateVersion68To69(); |
| 171 bool MigrateVersion69To70(); | 172 bool MigrateVersion69To70(); |
| 172 bool MigrateVersion70To71(); | 173 bool MigrateVersion70To71(); |
| 173 bool MigrateVersion71To72(); | 174 bool MigrateVersion71To72(); |
| 174 bool MigrateVersion72To73(); | 175 bool MigrateVersion72To73(); |
| 176 bool MigrateVersion73To74(); |
| 175 | 177 |
| 176 // The handle to our sqlite on-disk store for initialization and loading, and | 178 // The handle to our sqlite on-disk store for initialization and loading, and |
| 177 // for saving changes periodically via SaveChanges, respectively. | 179 // for saving changes periodically via SaveChanges, respectively. |
| 178 // TODO(timsteele): We should only have one handle here. The reason we need | 180 // TODO(timsteele): We should only have one handle here. The reason we need |
| 179 // two at the moment is because the DB can be opened by either the AuthWatcher | 181 // two at the moment is because the DB can be opened by either the AuthWatcher |
| 180 // or SyncCore threads, but SaveChanges is always called by the latter. We | 182 // or SyncCore threads, but SaveChanges is always called by the latter. We |
| 181 // need to change initialization so the DB is only accessed from one thread. | 183 // need to change initialization so the DB is only accessed from one thread. |
| 182 sqlite3* load_dbhandle_; | 184 sqlite3* load_dbhandle_; |
| 183 sqlite3* save_dbhandle_; | 185 sqlite3* save_dbhandle_; |
| 184 | 186 |
| 185 std::string dir_name_; | 187 std::string dir_name_; |
| 186 FilePath backing_filepath_; | 188 FilePath backing_filepath_; |
| 187 | 189 |
| 188 // Set to true if migration left some old columns around that need to be | 190 // Set to true if migration left some old columns around that need to be |
| 189 // discarded. | 191 // discarded. |
| 190 bool needs_column_refresh_; | 192 bool needs_column_refresh_; |
| 191 | 193 |
| 192 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); | 194 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); |
| 193 }; | 195 }; |
| 194 | 196 |
| 195 } // namespace syncable | 197 } // namespace syncable |
| 196 | 198 |
| 197 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 199 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
| OLD | NEW |