| 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 "components/sync/syncable/directory_backing_store.h" | 5 #include "components/sync/syncable/directory_backing_store.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 } | 1639 } |
| 1640 | 1640 |
| 1641 // This function checks to see if the given list of Metahandles has any nodes | 1641 // This function checks to see if the given list of Metahandles has any nodes |
| 1642 // whose PARENT_ID values refer to ID values that do not actually exist. | 1642 // whose PARENT_ID values refer to ID values that do not actually exist. |
| 1643 // This function also checks that a root node with the correct id exists in the | 1643 // This function also checks that a root node with the correct id exists in the |
| 1644 // set. | 1644 // set. |
| 1645 // Returns true on success. | 1645 // Returns true on success. |
| 1646 bool DirectoryBackingStore::VerifyReferenceIntegrity( | 1646 bool DirectoryBackingStore::VerifyReferenceIntegrity( |
| 1647 const Directory::MetahandlesMap* handles_map) { | 1647 const Directory::MetahandlesMap* handles_map) { |
| 1648 TRACE_EVENT0("sync", "SyncDatabaseIntegrityCheck"); | 1648 TRACE_EVENT0("sync", "SyncDatabaseIntegrityCheck"); |
| 1649 typedef std::unordered_set<std::string> IdsSet; | 1649 using IdsSet = std::unordered_set<std::string>; |
| 1650 | 1650 |
| 1651 IdsSet ids_set; | 1651 IdsSet ids_set; |
| 1652 bool is_ok = true; | 1652 bool is_ok = true; |
| 1653 | 1653 |
| 1654 for (auto it = handles_map->begin(); it != handles_map->end(); ++it) { | 1654 for (auto it = handles_map->begin(); it != handles_map->end(); ++it) { |
| 1655 EntryKernel* entry = it->second.get(); | 1655 EntryKernel* entry = it->second.get(); |
| 1656 bool is_duplicate_id = !(ids_set.insert(entry->ref(ID).value()).second); | 1656 bool is_duplicate_id = !(ids_set.insert(entry->ref(ID).value()).second); |
| 1657 is_ok = is_ok && !is_duplicate_id; | 1657 is_ok = is_ok && !is_duplicate_id; |
| 1658 } | 1658 } |
| 1659 | 1659 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 DCHECK(CalledOnValidThread()); | 1766 DCHECK(CalledOnValidThread()); |
| 1767 DCHECK(!catastrophic_error_handler.is_null()); | 1767 DCHECK(!catastrophic_error_handler.is_null()); |
| 1768 catastrophic_error_handler_ = catastrophic_error_handler; | 1768 catastrophic_error_handler_ = catastrophic_error_handler; |
| 1769 sql::Connection::ErrorCallback error_callback = | 1769 sql::Connection::ErrorCallback error_callback = |
| 1770 base::Bind(&OnSqliteError, catastrophic_error_handler_); | 1770 base::Bind(&OnSqliteError, catastrophic_error_handler_); |
| 1771 db_->set_error_callback(error_callback); | 1771 db_->set_error_callback(error_callback); |
| 1772 } | 1772 } |
| 1773 | 1773 |
| 1774 } // namespace syncable | 1774 } // namespace syncable |
| 1775 } // namespace syncer | 1775 } // namespace syncer |
| OLD | NEW |