| 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 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 it != handles_map->end(); ++it) { | 1541 it != handles_map->end(); ++it) { |
| 1542 EntryKernel* entry = it->second; | 1542 EntryKernel* entry = it->second; |
| 1543 bool is_duplicate_id = !(ids_set.insert(entry->ref(ID).value()).second); | 1543 bool is_duplicate_id = !(ids_set.insert(entry->ref(ID).value()).second); |
| 1544 is_ok = is_ok && !is_duplicate_id; | 1544 is_ok = is_ok && !is_duplicate_id; |
| 1545 } | 1545 } |
| 1546 | 1546 |
| 1547 IdsSet::iterator end = ids_set.end(); | 1547 IdsSet::iterator end = ids_set.end(); |
| 1548 for (Directory::MetahandlesMap::const_iterator it = handles_map->begin(); | 1548 for (Directory::MetahandlesMap::const_iterator it = handles_map->begin(); |
| 1549 it != handles_map->end(); ++it) { | 1549 it != handles_map->end(); ++it) { |
| 1550 EntryKernel* entry = it->second; | 1550 EntryKernel* entry = it->second; |
| 1551 bool parent_exists = (ids_set.find(entry->ref(PARENT_ID).value()) != end); | 1551 if (!entry->ref(PARENT_ID).IsNull()) { |
| 1552 if (!parent_exists) { | 1552 bool parent_exists = (ids_set.find(entry->ref(PARENT_ID).value()) != end); |
| 1553 return false; | 1553 if (!parent_exists) { |
| 1554 return false; |
| 1555 } |
| 1554 } | 1556 } |
| 1555 } | 1557 } |
| 1556 return is_ok; | 1558 return is_ok; |
| 1557 } | 1559 } |
| 1558 | 1560 |
| 1559 void DirectoryBackingStore::PrepareSaveEntryStatement( | 1561 void DirectoryBackingStore::PrepareSaveEntryStatement( |
| 1560 EntryTable table, sql::Statement* save_statement) { | 1562 EntryTable table, sql::Statement* save_statement) { |
| 1561 if (save_statement->is_valid()) | 1563 if (save_statement->is_valid()) |
| 1562 return; | 1564 return; |
| 1563 | 1565 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1586 } | 1588 } |
| 1587 query.append(" ) "); | 1589 query.append(" ) "); |
| 1588 values.append(" )"); | 1590 values.append(" )"); |
| 1589 query.append(values); | 1591 query.append(values); |
| 1590 save_statement->Assign(db_->GetUniqueStatement( | 1592 save_statement->Assign(db_->GetUniqueStatement( |
| 1591 base::StringPrintf(query.c_str(), "metas").c_str())); | 1593 base::StringPrintf(query.c_str(), "metas").c_str())); |
| 1592 } | 1594 } |
| 1593 | 1595 |
| 1594 } // namespace syncable | 1596 } // namespace syncable |
| 1595 } // namespace syncer | 1597 } // namespace syncer |
| OLD | NEW |