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

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

Issue 6104003: sync: use progress markers instead of timestamps during GetUpdates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tim's fixes Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, MigrateVersion73To74);
84 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion74To75);
84 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, ModelTypeIds); 85 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, ModelTypeIds);
85 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, Corruption); 86 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, Corruption);
86 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, DeleteEntries); 87 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, DeleteEntries);
87 FRIEND_TEST_ALL_PREFIXES(MigrationTest, ToCurrentVersion); 88 FRIEND_TEST_ALL_PREFIXES(MigrationTest, ToCurrentVersion);
88 friend class MigrationTest; 89 friend class MigrationTest;
89 90
90 // General Directory initialization and load helpers. 91 // General Directory initialization and load helpers.
91 DirOpenResult InitializeTables(); 92 DirOpenResult InitializeTables();
92 // Returns an sqlite return code, usually SQLITE_DONE. 93 // Returns an sqlite return code, usually SQLITE_DONE.
93 int CreateTables(); 94 int CreateTables();
94 95
95 // Create 'share_info' or 'temp_share_info' depending on value of 96 // Create 'share_info' or 'temp_share_info' depending on value of
96 // is_temporary. Returns an sqlite 97 // is_temporary. Returns an sqlite
97 // return code, SQLITE_DONE on success. 98 // return code, SQLITE_DONE on success.
98 int CreateShareInfoTable(bool is_temporary); 99 int CreateShareInfoTable(bool is_temporary);
99 100
100 int CreateShareInfoTableVersion71(bool is_temporary); 101 int CreateShareInfoTableVersion71(bool is_temporary);
101 // Create 'metas' or 'temp_metas' depending on value of is_temporary. 102 // Create 'metas' or 'temp_metas' depending on value of is_temporary.
102 // Returns an sqlite return code, SQLITE_DONE on success. 103 // Returns an sqlite return code, SQLITE_DONE on success.
103 int CreateMetasTable(bool is_temporary); 104 int CreateMetasTable(bool is_temporary);
104 // Returns an sqlite return code, SQLITE_DONE on success. 105 // Returns an sqlite return code, SQLITE_DONE on success.
105 int CreateModelsTable(); 106 int CreateModelsTable();
107 int CreateV71ModelsTable();
106 108
107 // We don't need to load any synced and applied deleted entries, we can 109 // We don't need to load any synced and applied deleted entries, we can
108 // in fact just purge them forever on startup. 110 // in fact just purge them forever on startup.
109 bool DropDeletedEntries(); 111 bool DropDeletedEntries();
110 // Drops a table if it exists, harmless if the table did not already exist. 112 // Drops a table if it exists, harmless if the table did not already exist.
111 int SafeDropTable(const char* table_name); 113 int SafeDropTable(const char* table_name);
112 114
113 // Load helpers for entries and attributes. 115 // Load helpers for entries and attributes.
114 bool LoadEntries(MetahandlesIndex* entry_bucket); 116 bool LoadEntries(MetahandlesIndex* entry_bucket);
115 bool LoadInfo(Directory::KernelLoadInfo* info); 117 bool LoadInfo(Directory::KernelLoadInfo* info);
(...skipping 24 matching lines...) Expand all
140 // Lazy creation of save_dbhandle_ for use by SaveChanges code path. 142 // Lazy creation of save_dbhandle_ for use by SaveChanges code path.
141 sqlite3* LazyGetSaveHandle(); 143 sqlite3* LazyGetSaveHandle();
142 144
143 // Drop all tables in preparation for reinitialization. 145 // Drop all tables in preparation for reinitialization.
144 void DropAllTables(); 146 void DropAllTables();
145 147
146 // Serialization helpers for syncable::ModelType. These convert between 148 // Serialization helpers for syncable::ModelType. These convert between
147 // the ModelType enum and the values we persist in the database to identify 149 // the ModelType enum and the values we persist in the database to identify
148 // a model. We persist a default instance of the specifics protobuf as the 150 // a model. We persist a default instance of the specifics protobuf as the
149 // ID, rather than the enum value. 151 // ID, rather than the enum value.
150 static ModelType ModelIdToModelTypeEnum(const string& model_id); 152 static ModelType ModelIdToModelTypeEnum(const void* data, int length);
151 static string ModelTypeEnumToModelId(ModelType model_type); 153 static string ModelTypeEnumToModelId(ModelType model_type);
152 154
153 // Runs an integrity check on the current database. If the 155 // Runs an integrity check on the current database. If the
154 // integrity check fails, false is returned and error is populated 156 // integrity check fails, false is returned and error is populated
155 // with an error message. 157 // with an error message.
156 bool CheckIntegrity(sqlite3* handle, string* error) const; 158 bool CheckIntegrity(sqlite3* handle, string* error) const;
157 159
158 // Migration utilities. 160 // Migration utilities.
159 bool AddColumn(const ColumnSpec* column); 161 bool AddColumn(const ColumnSpec* column);
160 bool RefreshColumns(); 162 bool RefreshColumns();
161 bool SetVersion(int version); 163 bool SetVersion(int version);
162 int GetVersion(); 164 int GetVersion();
163 bool MigrateToSpecifics(const char* old_columns, 165 bool MigrateToSpecifics(const char* old_columns,
164 const char* specifics_column, 166 const char* specifics_column,
165 void(*handler_function) ( 167 void(*handler_function) (
166 SQLStatement* old_value_query, 168 SQLStatement* old_value_query,
167 int old_value_column, 169 int old_value_column,
168 sync_pb::EntitySpecifics* mutable_new_value)); 170 sync_pb::EntitySpecifics* mutable_new_value));
169 171
170 // Individual version migrations. 172 // Individual version migrations.
171 bool MigrateVersion67To68(); 173 bool MigrateVersion67To68();
172 bool MigrateVersion68To69(); 174 bool MigrateVersion68To69();
173 bool MigrateVersion69To70(); 175 bool MigrateVersion69To70();
174 bool MigrateVersion70To71(); 176 bool MigrateVersion70To71();
175 bool MigrateVersion71To72(); 177 bool MigrateVersion71To72();
176 bool MigrateVersion72To73(); 178 bool MigrateVersion72To73();
177 bool MigrateVersion73To74(); 179 bool MigrateVersion73To74();
180 bool MigrateVersion74To75();
178 181
179 // The handle to our sqlite on-disk store for initialization and loading, and 182 // The handle to our sqlite on-disk store for initialization and loading, and
180 // for saving changes periodically via SaveChanges, respectively. 183 // for saving changes periodically via SaveChanges, respectively.
181 // TODO(timsteele): We should only have one handle here. The reason we need 184 // TODO(timsteele): We should only have one handle here. The reason we need
182 // two at the moment is because the DB can be opened by either the AuthWatcher 185 // two at the moment is because the DB can be opened by either the AuthWatcher
183 // or SyncCore threads, but SaveChanges is always called by the latter. We 186 // or SyncCore threads, but SaveChanges is always called by the latter. We
184 // need to change initialization so the DB is only accessed from one thread. 187 // need to change initialization so the DB is only accessed from one thread.
185 sqlite3* load_dbhandle_; 188 sqlite3* load_dbhandle_;
186 sqlite3* save_dbhandle_; 189 sqlite3* save_dbhandle_;
187 190
188 std::string dir_name_; 191 std::string dir_name_;
189 FilePath backing_filepath_; 192 FilePath backing_filepath_;
190 193
191 // Set to true if migration left some old columns around that need to be 194 // Set to true if migration left some old columns around that need to be
192 // discarded. 195 // discarded.
193 bool needs_column_refresh_; 196 bool needs_column_refresh_;
194 197
195 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); 198 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore);
196 }; 199 };
197 200
198 } // namespace syncable 201 } // namespace syncable
199 202
200 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ 203 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_ui_util.cc ('k') | chrome/browser/sync/syncable/directory_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698