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

Unified Diff: components/sync/syncable/directory_backing_store.cc

Issue 2342133002: [sync] Verify existence of the root when loading DirectoryBackingStore (Closed)
Patch Set: include syncable_id, fix comment Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/sync/syncable/directory_backing_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/syncable/directory_backing_store.cc
diff --git a/components/sync/syncable/directory_backing_store.cc b/components/sync/syncable/directory_backing_store.cc
index b17ff27522c08c7659bf0c44585193f1cd4dfe93..bda092dbb90ab4434e40890280796bf190a07086 100644
--- a/components/sync/syncable/directory_backing_store.cc
+++ b/components/sync/syncable/directory_backing_store.cc
@@ -27,6 +27,7 @@
#include "components/sync/protocol/bookmark_specifics.pb.h"
#include "components/sync/protocol/sync.pb.h"
#include "components/sync/syncable/syncable_columns.h"
+#include "components/sync/syncable/syncable_id.h"
#include "components/sync/syncable/syncable_util.h"
#include "sql/connection.h"
#include "sql/error_delegate_util.h"
@@ -1642,6 +1643,8 @@ bool DirectoryBackingStore::CreateShareInfoTableVersion71(
// This function checks to see if the given list of Metahandles has any nodes
// whose PARENT_ID values refer to ID values that do not actually exist.
+// This function also checks that a root node with the correct id exists in the
+// set.
// Returns true on success.
bool DirectoryBackingStore::VerifyReferenceIntegrity(
const Directory::MetahandlesMap* handles_map) {
@@ -1667,6 +1670,9 @@ bool DirectoryBackingStore::VerifyReferenceIntegrity(
}
}
}
+ if (ids_set.find(Id::GetRoot().value()) == ids_set.end()) {
+ return false;
+ }
return is_ok;
}
« no previous file with comments | « no previous file | components/sync/syncable/directory_backing_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698