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

Unified Diff: sync/syncable/directory_backing_store.h

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_backing_store.h
diff --git a/sync/syncable/directory_backing_store.h b/sync/syncable/directory_backing_store.h
index 254fff4d8e7477d9286eebc956e68b4a985f6cfc..36a2f0afd2308b6ae99708f19267df6852cfdc30 100644
--- a/sync/syncable/directory_backing_store.h
+++ b/sync/syncable/directory_backing_store.h
@@ -49,16 +49,18 @@ class SYNC_EXPORT_PRIVATE DirectoryBackingStore : public base::NonThreadSafe {
virtual ~DirectoryBackingStore();
// Loads and drops all currently persisted meta entries into |handles_map|
- // and loads appropriate persisted kernel info into |info_bucket|.
+ // and loads appropriate persisted kernel info into |kernel_load_info|.
+ // The function determines which entries can be safely dropped and inserts
+ // their keys into |metahandles_to_purge|. It is up to the caller to
+ // perform the actual cleanup.
//
- // This function can perform some cleanup tasks behind the scenes. It will
- // clean up unused entries from the database and migrate to the latest
- // database version. The caller can safely ignore these details.
+ // This function will migrate to the latest database version.
//
// NOTE: On success (return value of OPENED), the buckets are populated with
// newly allocated items, meaning ownership is bestowed upon the caller.
virtual DirOpenResult Load(Directory::MetahandlesMap* handles_map,
JournalIndex* delete_journals,
+ MetahandleSet* metahandles_to_purge,
Directory::KernelLoadInfo* kernel_load_info) = 0;
// Updates the on-disk store with the input |snapshot| as a database
@@ -90,16 +92,15 @@ class SYNC_EXPORT_PRIVATE DirectoryBackingStore : public base::NonThreadSafe {
bool CreateV75ModelsTable();
bool CreateV81ModelsTable();
- // We don't need to load any synced and applied deleted entries, we can
- // in fact just purge them forever on startup.
- bool DropDeletedEntries();
// Drops a table if it exists, harmless if the table did not already exist.
bool SafeDropTable(const char* table_name);
// Load helpers for entries and attributes.
- bool LoadEntries(Directory::MetahandlesMap* handles_map);
+ bool LoadEntries(Directory::MetahandlesMap* handles_map,
+ MetahandleSet* metahandles_to_purge);
bool LoadDeleteJournals(JournalIndex* delete_journals);
bool LoadInfo(Directory::KernelLoadInfo* info);
+ bool SafeToPurgeOnLoading(const EntryKernel& entry) const;
// Save/update helpers for entries. Return false if sqlite commit fails.
static bool SaveEntryToDB(sql::Statement* save_statement,

Powered by Google App Engine
This is Rietveld 408576698