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

Unified Diff: sync/internal_api/sync_backup_manager.h

Issue 235053006: Add sync manager classes for backup/rollback: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/internal_api/sync_backup_manager.h
diff --git a/sync/internal_api/sync_backup_manager.h b/sync/internal_api/sync_backup_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..aec2e6c0169c062607fcef1735976234661781b8
--- /dev/null
+++ b/sync/internal_api/sync_backup_manager.h
@@ -0,0 +1,43 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_
+#define SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_
+
+#include <set>
+
+#include "sync/internal_api/sync_rollback_manager_base.h"
+
+namespace syncer {
+
+// SyncBackupManager runs before user signs into sync to back up user's data
maniscalco 2014/04/15 16:29:14 How do you envision backups working with attachmen
haitaol1 2014/04/15 16:59:51 Backup is only for local data. Does local model cr
maniscalco 2014/04/15 17:21:19 Model type code will not create attachments when s
haitaol1 2014/04/15 18:11:20 Done.
+// into sync DB.
+class SyncBackupManager : public SyncRollbackManagerBase {
+ public:
+ SyncBackupManager();
+ virtual ~SyncBackupManager();
+
+ // SyncManager implementation.
+ virtual void SaveChanges() OVERRIDE;
+
+ // DirectoryChangeDelegate implementation.
+ virtual ModelTypeSet HandleTransactionEndingChangeEvent(
+ const syncable::ImmutableWriteTransactionInfo& write_transaction_info,
+ syncable::BaseTransaction* trans) OVERRIDE;
+
+ private:
+ // Replaces local IDs with server IDs and clear unsynced bit of modified
+ // entries.
+ void NormalizeEntries();
+
+ // Handles of unsynced entries caused by local model changes.
+ std::set<int64> unsynced_;
+
+ // True if NormalizeEntries() is being called.
+ bool in_normalization_;
+};
+
+} // namespace syncer
+
+#endif // SYNC_INTERNAL_API_SYNC_BACKUP_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698