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

Unified Diff: sync/syncable/on_disk_directory_backing_store.cc

Issue 11441026: [Sync] Add support for loading, updating and querying delete journals in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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/on_disk_directory_backing_store.h ('k') | sync/syncable/syncable_base_transaction.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/syncable/on_disk_directory_backing_store.cc
diff --git a/sync/syncable/on_disk_directory_backing_store.cc b/sync/syncable/on_disk_directory_backing_store.cc
index 4201210bfc9826cc30f312f92048874a30e221af..7264e0c98c30eb7bf37ef7a0b8da5cdf70daba28 100644
--- a/sync/syncable/on_disk_directory_backing_store.cc
+++ b/sync/syncable/on_disk_directory_backing_store.cc
@@ -36,6 +36,7 @@ OnDiskDirectoryBackingStore::~OnDiskDirectoryBackingStore() { }
DirOpenResult OnDiskDirectoryBackingStore::TryLoad(
MetahandlesIndex* entry_bucket,
+ JournalIndex* delete_journals,
Directory::KernelLoadInfo* kernel_load_info) {
DCHECK(CalledOnValidThread());
if (!db_->is_open()) {
@@ -50,6 +51,8 @@ DirOpenResult OnDiskDirectoryBackingStore::TryLoad(
return FAILED_DATABASE_CORRUPT;
if (!LoadEntries(entry_bucket))
return FAILED_DATABASE_CORRUPT;
+ if (!LoadDeleteJournals(delete_journals))
+ return FAILED_DATABASE_CORRUPT;
if (!LoadInfo(kernel_load_info))
return FAILED_DATABASE_CORRUPT;
if (!VerifyReferenceIntegrity(*entry_bucket))
@@ -61,8 +64,10 @@ DirOpenResult OnDiskDirectoryBackingStore::TryLoad(
DirOpenResult OnDiskDirectoryBackingStore::Load(
MetahandlesIndex* entry_bucket,
+ JournalIndex* delete_journals,
Directory::KernelLoadInfo* kernel_load_info) {
- DirOpenResult result = TryLoad(entry_bucket, kernel_load_info);
+ DirOpenResult result = TryLoad(entry_bucket, delete_journals,
+ kernel_load_info);
if (result == OPENED) {
UMA_HISTOGRAM_ENUMERATION(
"Sync.DirectoryOpenResult", FIRST_TRY_SUCCESS, RESULT_COUNT);
@@ -72,12 +77,13 @@ DirOpenResult OnDiskDirectoryBackingStore::Load(
ReportFirstTryOpenFailure();
// The fallback: delete the current database and return a fresh one. We can
- // fetch the user's data from the could.
+ // fetch the user's data from the cloud.
STLDeleteElements(entry_bucket);
+ STLDeleteElements(delete_journals);
db_.reset(new sql::Connection);
file_util::Delete(backing_filepath_, false);
- result = TryLoad(entry_bucket, kernel_load_info);
+ result = TryLoad(entry_bucket, delete_journals, kernel_load_info);
if (result == OPENED) {
UMA_HISTOGRAM_ENUMERATION(
"Sync.DirectoryOpenResult", SECOND_TRY_SUCCESS, RESULT_COUNT);
« no previous file with comments | « sync/syncable/on_disk_directory_backing_store.h ('k') | sync/syncable/syncable_base_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698