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

Unified Diff: sync/syncable/directory.cc

Issue 10832329: Update next_id when loading sync DB (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win compile Created 8 years, 4 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 | « sync/syncable/dir_open_result.h ('k') | sync/syncable/syncable_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/directory.cc
diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc
index 9348338925f114f2e8052c7323fc4f30bebf0255..92ec65e07a51ce3b32355ae60b46b304a595ed4a 100644
--- a/sync/syncable/directory.cc
+++ b/sync/syncable/directory.cc
@@ -204,6 +204,14 @@ DirOpenResult Directory::OpenImpl(
kernel_ = new Kernel(name, info, delegate, transaction_observer);
kernel_->metahandles_index->swap(metas_bucket);
InitializeIndices();
+
+ // Write back the share info to reserve some space in 'next_id'. This will
+ // prevent local ID reuse in the case of an early crash. See the comments in
+ // TakeSnapshotForSaveChanges() or crbug.com/142987 for more information.
+ kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
+ if (!SaveChanges())
+ return FAILED_INITIAL_WRITE;
+
return OPENED;
}
« no previous file with comments | « sync/syncable/dir_open_result.h ('k') | sync/syncable/syncable_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698