| OLD | NEW |
| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 return false; | 259 return false; |
| 260 DCHECK_EQ(db_->GetLastChangeCount(), 1); | 260 DCHECK_EQ(db_->GetLastChangeCount(), 1); |
| 261 | 261 |
| 262 sql::Statement s2(db_->GetCachedStatement( | 262 sql::Statement s2(db_->GetCachedStatement( |
| 263 SQL_FROM_HERE, | 263 SQL_FROM_HERE, |
| 264 "INSERT OR REPLACE " | 264 "INSERT OR REPLACE " |
| 265 "INTO models (model_id, progress_marker, transaction_version) " | 265 "INTO models (model_id, progress_marker, transaction_version) " |
| 266 "VALUES (?, ?, ?)")); | 266 "VALUES (?, ?, ?)")); |
| 267 | 267 |
| 268 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 268 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
| 269 ModelType type = ModelTypeFromInt(i); |
| 270 if (VirtualTypes().Has(type)) |
| 271 continue; |
| 269 // We persist not ModelType but rather a protobuf-derived ID. | 272 // We persist not ModelType but rather a protobuf-derived ID. |
| 270 string model_id = ModelTypeEnumToModelId(ModelTypeFromInt(i)); | 273 string model_id = ModelTypeEnumToModelId(type); |
| 271 string progress_marker; | 274 string progress_marker; |
| 272 info.download_progress[i].SerializeToString(&progress_marker); | 275 info.download_progress[i].SerializeToString(&progress_marker); |
| 273 s2.BindBlob(0, model_id.data(), model_id.length()); | 276 s2.BindBlob(0, model_id.data(), model_id.length()); |
| 274 s2.BindBlob(1, progress_marker.data(), progress_marker.length()); | 277 s2.BindBlob(1, progress_marker.data(), progress_marker.length()); |
| 275 s2.BindInt64(2, info.transaction_version[i]); | 278 s2.BindInt64(2, info.transaction_version[i]); |
| 276 if (!s2.Run()) | 279 if (!s2.Run()) |
| 277 return false; | 280 return false; |
| 278 DCHECK_EQ(db_->GetLastChangeCount(), 1); | 281 DCHECK_EQ(db_->GetLastChangeCount(), 1); |
| 279 s2.Reset(true); | 282 s2.Reset(true); |
| 280 } | 283 } |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 } | 1355 } |
| 1353 query.append(" ) "); | 1356 query.append(" ) "); |
| 1354 values.append(" )"); | 1357 values.append(" )"); |
| 1355 query.append(values); | 1358 query.append(values); |
| 1356 save_statement->Assign(db_->GetUniqueStatement( | 1359 save_statement->Assign(db_->GetUniqueStatement( |
| 1357 base::StringPrintf(query.c_str(), "metas").c_str())); | 1360 base::StringPrintf(query.c_str(), "metas").c_str())); |
| 1358 } | 1361 } |
| 1359 | 1362 |
| 1360 } // namespace syncable | 1363 } // namespace syncable |
| 1361 } // namespace syncer | 1364 } // namespace syncer |
| OLD | NEW |