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

Side by Side Diff: sync/syncable/directory_backing_store.cc

Issue 11958029: [Sync] Add support for proxy types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch to ProxyTypes Created 7 years, 10 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
« no previous file with comments | « sync/syncable/directory.cc ('k') | sync/syncable/directory_backing_store_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #include "sync/syncable/directory_backing_store.h" 5 #include "sync/syncable/directory_backing_store.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (!s1.Run()) 255 if (!s1.Run())
256 return false; 256 return false;
257 DCHECK_EQ(db_->GetLastChangeCount(), 1); 257 DCHECK_EQ(db_->GetLastChangeCount(), 1);
258 258
259 sql::Statement s2(db_->GetCachedStatement( 259 sql::Statement s2(db_->GetCachedStatement(
260 SQL_FROM_HERE, 260 SQL_FROM_HERE,
261 "INSERT OR REPLACE " 261 "INSERT OR REPLACE "
262 "INTO models (model_id, progress_marker, transaction_version) " 262 "INTO models (model_id, progress_marker, transaction_version) "
263 "VALUES (?, ?, ?)")); 263 "VALUES (?, ?, ?)"));
264 264
265 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { 265 ModelTypeSet protocol_types = ProtocolTypes();
266 for (ModelTypeSet::Iterator iter = protocol_types.First(); iter.Good();
267 iter.Inc()) {
268 ModelType type = iter.Get();
266 // We persist not ModelType but rather a protobuf-derived ID. 269 // We persist not ModelType but rather a protobuf-derived ID.
267 string model_id = ModelTypeEnumToModelId(ModelTypeFromInt(i)); 270 string model_id = ModelTypeEnumToModelId(type);
268 string progress_marker; 271 string progress_marker;
269 info.download_progress[i].SerializeToString(&progress_marker); 272 info.download_progress[type].SerializeToString(&progress_marker);
270 s2.BindBlob(0, model_id.data(), model_id.length()); 273 s2.BindBlob(0, model_id.data(), model_id.length());
271 s2.BindBlob(1, progress_marker.data(), progress_marker.length()); 274 s2.BindBlob(1, progress_marker.data(), progress_marker.length());
272 s2.BindInt64(2, info.transaction_version[i]); 275 s2.BindInt64(2, info.transaction_version[type]);
273 if (!s2.Run()) 276 if (!s2.Run())
274 return false; 277 return false;
275 DCHECK_EQ(db_->GetLastChangeCount(), 1); 278 DCHECK_EQ(db_->GetLastChangeCount(), 1);
276 s2.Reset(true); 279 s2.Reset(true);
277 } 280 }
278 } 281 }
279 282
280 return transaction.Commit(); 283 return transaction.Commit();
281 } 284 }
282 285
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 } 1354 }
1352 query.append(" ) "); 1355 query.append(" ) ");
1353 values.append(" )"); 1356 values.append(" )");
1354 query.append(values); 1357 query.append(values);
1355 save_statement->Assign(db_->GetUniqueStatement( 1358 save_statement->Assign(db_->GetUniqueStatement(
1356 base::StringPrintf(query.c_str(), "metas").c_str())); 1359 base::StringPrintf(query.c_str(), "metas").c_str()));
1357 } 1360 }
1358 1361
1359 } // namespace syncable 1362 } // namespace syncable
1360 } // namespace syncer 1363 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/directory.cc ('k') | sync/syncable/directory_backing_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698