| 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 #include "chrome/browser/sync/syncable/directory_backing_store.h" | 5 #include "chrome/browser/sync/syncable/directory_backing_store.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
| 10 #include <CoreFoundation/CoreFoundation.h> | 10 #include <CoreFoundation/CoreFoundation.h> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #include <limits> | 13 #include <limits> |
| 14 | 14 |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/hash_tables.h" | 16 #include "base/hash_tables.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/stl_util-inl.h" | 18 #include "base/stl_util-inl.h" |
| 19 #include "base/string_number_conversions.h" |
| 19 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 20 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
| 20 #include "chrome/browser/sync/protocol/service_constants.h" | 21 #include "chrome/browser/sync/protocol/service_constants.h" |
| 21 #include "chrome/browser/sync/protocol/sync.pb.h" | 22 #include "chrome/browser/sync/protocol/sync.pb.h" |
| 22 #include "chrome/browser/sync/syncable/syncable-inl.h" | 23 #include "chrome/browser/sync/syncable/syncable-inl.h" |
| 23 #include "chrome/browser/sync/syncable/syncable_columns.h" | 24 #include "chrome/browser/sync/syncable/syncable_columns.h" |
| 24 #include "chrome/browser/sync/util/crypto_helpers.h" | 25 #include "chrome/browser/sync/util/crypto_helpers.h" |
| 25 #include "chrome/common/sqlite_utils.h" | 26 #include "chrome/common/sqlite_utils.h" |
| 26 #include "third_party/sqlite/preprocessed/sqlite3.h" | 27 #include "third_party/sqlite/preprocessed/sqlite3.h" |
| 27 | 28 |
| 28 // Sometimes threads contend on the DB lock itself, especially when one thread | 29 // Sometimes threads contend on the DB lock itself, especially when one thread |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 if (handles.empty()) | 280 if (handles.empty()) |
| 280 return true; | 281 return true; |
| 281 | 282 |
| 282 sqlite3* dbhandle = LazyGetSaveHandle(); | 283 sqlite3* dbhandle = LazyGetSaveHandle(); |
| 283 | 284 |
| 284 string query = "DELETE FROM metas WHERE metahandle IN ("; | 285 string query = "DELETE FROM metas WHERE metahandle IN ("; |
| 285 for (MetahandleSet::const_iterator it = handles.begin(); it != handles.end(); | 286 for (MetahandleSet::const_iterator it = handles.begin(); it != handles.end(); |
| 286 ++it) { | 287 ++it) { |
| 287 if (it != handles.begin()) | 288 if (it != handles.begin()) |
| 288 query.append(","); | 289 query.append(","); |
| 289 query.append(Int64ToString(*it)); | 290 query.append(base::Int64ToString(*it)); |
| 290 } | 291 } |
| 291 query.append(")"); | 292 query.append(")"); |
| 292 SQLStatement statement; | 293 SQLStatement statement; |
| 293 int result = statement.prepare(dbhandle, query.data(), query.size()); | 294 int result = statement.prepare(dbhandle, query.data(), query.size()); |
| 294 if (SQLITE_OK == result) | 295 if (SQLITE_OK == result) |
| 295 result = statement.step(); | 296 result = statement.step(); |
| 296 | 297 |
| 297 return SQLITE_DONE == result; | 298 return SQLITE_DONE == result; |
| 298 } | 299 } |
| 299 | 300 |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 "name TEXT, " | 961 "name TEXT, " |
| 961 "store_birthday TEXT, " | 962 "store_birthday TEXT, " |
| 962 "db_create_version TEXT, " | 963 "db_create_version TEXT, " |
| 963 "db_create_time INT, " | 964 "db_create_time INT, " |
| 964 "next_id INT default -2, " | 965 "next_id INT default -2, " |
| 965 "cache_guid TEXT)"); | 966 "cache_guid TEXT)"); |
| 966 return ExecQuery(load_dbhandle_, query.c_str()); | 967 return ExecQuery(load_dbhandle_, query.c_str()); |
| 967 } | 968 } |
| 968 | 969 |
| 969 } // namespace syncable | 970 } // namespace syncable |
| OLD | NEW |