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

Unified Diff: sync/syncable/directory.cc

Issue 1008103002: Sync: Avoid 3 passes over SyncDarta DB when loading the directory from the disk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
Index: sync/syncable/directory.cc
diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc
index 12616959984419a1c9e5cae9f412c821305460dd..9a689ac8063b91add9b8ef5be14e011180b36896 100644
--- a/sync/syncable/directory.cc
+++ b/sync/syncable/directory.cc
@@ -77,7 +77,8 @@ Directory::SaveChangesSnapshot::~SaveChangesSnapshot() {
Directory::Kernel::Kernel(
const std::string& name,
- const KernelLoadInfo& info, DirectoryChangeDelegate* delegate,
+ const KernelLoadInfo& info,
+ DirectoryChangeDelegate* delegate,
const WeakHandle<TransactionObserver>& transaction_observer)
: next_write_transaction_id(0),
name(name),
@@ -178,12 +179,13 @@ DirOpenResult Directory::OpenImpl(
// Avoids mem leaks on failure. Harmlessly deletes the empty hash map after
// the swap in the success case.
- STLValueDeleter<Directory::MetahandlesMap> deleter(&tmp_handles_map);
+ STLValueDeleter<MetahandlesMap> deleter(&tmp_handles_map);
JournalIndex delete_journals;
+ MetahandleSet metahandles_to_purge;
- DirOpenResult result =
- store_->Load(&tmp_handles_map, &delete_journals, &info);
+ DirOpenResult result = store_->Load(&tmp_handles_map, &delete_journals,
+ &metahandles_to_purge, &info);
if (OPENED != result)
return result;
@@ -195,6 +197,8 @@ DirOpenResult Directory::OpenImpl(
// 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;
+
+ kernel_->metahandles_to_purge.swap(metahandles_to_purge);
if (!SaveChanges())
return FAILED_INITIAL_WRITE;

Powered by Google App Engine
This is Rietveld 408576698