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(); |
93 | 94 |
94 // Create 'share_info' or 'temp_share_info' depending on value of | 95 // Create 'share_info' or 'temp_share_info' depending on value of |
95 // is_temporary. If with_notification_state is true, creates the | 96 // is_temporary. Returns an sqlite |
96 // table with the notification_state column. Returns an sqlite | |
97 // return code, SQLITE_DONE on success. | 97 // return code, SQLITE_DONE on success. |
98 int CreateShareInfoTable(bool is_temporary, bool with_notification_state); | 98 int CreateShareInfoTable(bool is_temporary); |
| 99 |
| 100 int CreateShareInfoTableVersion71(bool is_temporary); |
99 // Create 'metas' or 'temp_metas' depending on value of is_temporary. | 101 // Create 'metas' or 'temp_metas' depending on value of is_temporary. |
100 // Returns an sqlite return code, SQLITE_DONE on success. | 102 // Returns an sqlite return code, SQLITE_DONE on success. |
101 int CreateMetasTable(bool is_temporary); | 103 int CreateMetasTable(bool is_temporary); |
102 // Returns an sqlite return code, SQLITE_DONE on success. | 104 // Returns an sqlite return code, SQLITE_DONE on success. |
103 int CreateModelsTable(); | 105 int CreateModelsTable(); |
104 | 106 |
105 // We don't need to load any synced and applied deleted entries, we can | 107 // We don't need to load any synced and applied deleted entries, we can |
106 // in fact just purge them forever on startup. | 108 // in fact just purge them forever on startup. |
107 bool DropDeletedEntries(); | 109 bool DropDeletedEntries(); |
108 // Drops a table if it exists, harmless if the table did not already exist. | 110 // Drops a table if it exists, harmless if the table did not already exist. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 int old_value_column, | 167 int old_value_column, |
166 sync_pb::EntitySpecifics* mutable_new_value)); | 168 sync_pb::EntitySpecifics* mutable_new_value)); |
167 | 169 |
168 // Individual version migrations. | 170 // Individual version migrations. |
169 bool MigrateVersion67To68(); | 171 bool MigrateVersion67To68(); |
170 bool MigrateVersion68To69(); | 172 bool MigrateVersion68To69(); |
171 bool MigrateVersion69To70(); | 173 bool MigrateVersion69To70(); |
172 bool MigrateVersion70To71(); | 174 bool MigrateVersion70To71(); |
173 bool MigrateVersion71To72(); | 175 bool MigrateVersion71To72(); |
174 bool MigrateVersion72To73(); | 176 bool MigrateVersion72To73(); |
| 177 bool MigrateVersion73To74(); |
175 | 178 |
176 // The handle to our sqlite on-disk store for initialization and loading, and | 179 // The handle to our sqlite on-disk store for initialization and loading, and |
177 // for saving changes periodically via SaveChanges, respectively. | 180 // for saving changes periodically via SaveChanges, respectively. |
178 // TODO(timsteele): We should only have one handle here. The reason we need | 181 // 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 | 182 // 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 | 183 // 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. | 184 // need to change initialization so the DB is only accessed from one thread. |
182 sqlite3* load_dbhandle_; | 185 sqlite3* load_dbhandle_; |
183 sqlite3* save_dbhandle_; | 186 sqlite3* save_dbhandle_; |
184 | 187 |
185 std::string dir_name_; | 188 std::string dir_name_; |
186 FilePath backing_filepath_; | 189 FilePath backing_filepath_; |
187 | 190 |
188 // Set to true if migration left some old columns around that need to be | 191 // Set to true if migration left some old columns around that need to be |
189 // discarded. | 192 // discarded. |
190 bool needs_column_refresh_; | 193 bool needs_column_refresh_; |
191 | 194 |
192 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); | 195 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); |
193 }; | 196 }; |
194 | 197 |
195 } // namespace syncable | 198 } // namespace syncable |
196 | 199 |
197 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 200 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
OLD | NEW |