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

Side by Side Diff: chrome/browser/sync/syncable/directory_backing_store.h

Issue 1733008: Delete and recreate the sync database if it is corrupt. (Closed)
Patch Set: Use scoped_sqlite_db_ptr Created 10 years, 8 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 (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
74 // DO NOT CALL THIS FROM MORE THAN ONE THREAD EVER. Also, whichever thread 74 // DO NOT CALL THIS FROM MORE THAN ONE THREAD EVER. Also, whichever thread
75 // calls SaveChanges *must* be the thread that owns/destroys |this|. 75 // calls SaveChanges *must* be the thread that owns/destroys |this|.
76 virtual bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot); 76 virtual bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot);
77 77
78 private: 78 private:
79 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion67To68); 79 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion67To68);
80 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion68To69); 80 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion68To69);
81 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion69To70); 81 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion69To70);
82 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion70To71); 82 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion70To71);
83 FRIEND_TEST(DirectoryBackingStoreTest, ModelTypeIds); 83 FRIEND_TEST(DirectoryBackingStoreTest, ModelTypeIds);
84 FRIEND_TEST(DirectoryBackingStoreTest, Corruption);
84 FRIEND_TEST(MigrationTest, ToCurrentVersion); 85 FRIEND_TEST(MigrationTest, ToCurrentVersion);
85 86
86 // General Directory initialization and load helpers. 87 // General Directory initialization and load helpers.
87 DirOpenResult InitializeTables(); 88 DirOpenResult InitializeTables();
88 // Returns an sqlite return code, usually SQLITE_DONE. 89 // Returns an sqlite return code, usually SQLITE_DONE.
89 int CreateTables(); 90 int CreateTables();
90 91
91 // Create 'share_info' or 'temp_share_info' depending on value of 92 // Create 'share_info' or 'temp_share_info' depending on value of
92 // is_temporary. Returns an sqlite return code, SQLITE_DONE on success. 93 // is_temporary. Returns an sqlite return code, SQLITE_DONE on success.
93 int CreateShareInfoTable(bool is_temporary); 94 int CreateShareInfoTable(bool is_temporary);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 static ModelType ModelIdToModelTypeEnum(const string& model_id); 142 static ModelType ModelIdToModelTypeEnum(const string& model_id);
142 static string ModelTypeEnumToModelId(ModelType model_type); 143 static string ModelTypeEnumToModelId(ModelType model_type);
143 144
144 // Migration utilities. 145 // Migration utilities.
145 bool AddColumn(const ColumnSpec* column); 146 bool AddColumn(const ColumnSpec* column);
146 bool RefreshColumns(); 147 bool RefreshColumns();
147 bool SetVersion(int version); 148 bool SetVersion(int version);
148 int GetVersion(); 149 int GetVersion();
149 bool MigrateToSpecifics(const char* old_columns, 150 bool MigrateToSpecifics(const char* old_columns,
150 const char* specifics_column, 151 const char* specifics_column,
151 void (*handler_function)( 152 void (*handler_function) (
152 SQLStatement* old_value_query, 153 SQLStatement* old_value_query,
153 int old_value_column, 154 int old_value_column,
154 sync_pb::EntitySpecifics* mutable_new_value)); 155 sync_pb::EntitySpecifics* mutable_new_value));
155 156
156 // Individual version migrations. 157 // Individual version migrations.
157 bool MigrateVersion67To68(); 158 bool MigrateVersion67To68();
158 bool MigrateVersion68To69(); 159 bool MigrateVersion68To69();
159 bool MigrateVersion69To70(); 160 bool MigrateVersion69To70();
160 bool MigrateVersion70To71(); 161 bool MigrateVersion70To71();
161 162
(...skipping 12 matching lines...) Expand all
174 // Set to true if migration left some old columns around that need to be 175 // Set to true if migration left some old columns around that need to be
175 // discarded. 176 // discarded.
176 bool needs_column_refresh_; 177 bool needs_column_refresh_;
177 178
178 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); 179 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore);
179 }; 180 };
180 181
181 } // namespace syncable 182 } // namespace syncable
182 183
183 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ 184 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698