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

Unified Diff: components/sync/engine_impl/model_type_worker.cc

Issue 2442583003: [Sync] Start implementation of migration for USS. (Closed)
Patch Set: Rebase. Created 4 years, 2 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: components/sync/engine_impl/model_type_worker.cc
diff --git a/components/sync/engine_impl/model_type_worker.cc b/components/sync/engine_impl/model_type_worker.cc
index 0536334f608f55f6f445945e51593f551df706c7..b834a6871e9382abfc3b4dd5fbd1a07ee73f834e 100644
--- a/components/sync/engine_impl/model_type_worker.cc
+++ b/components/sync/engine_impl/model_type_worker.cc
@@ -28,6 +28,7 @@ namespace syncer {
ModelTypeWorker::ModelTypeWorker(
ModelType type,
const sync_pb::ModelTypeState& initial_state,
+ bool trigger_initial_sync,
std::unique_ptr<Cryptographer> cryptographer,
NudgeHandler* nudge_handler,
std::unique_ptr<ModelTypeProcessor> model_type_processor,
@@ -42,7 +43,7 @@ ModelTypeWorker::ModelTypeWorker(
DCHECK(model_type_processor_);
// Request an initial sync if it hasn't been completed yet.
- if (!model_type_state_.initial_sync_done()) {
+ if (trigger_initial_sync) {
nudge_handler_->NudgeForInitialDownload(type_);
}
@@ -312,6 +313,15 @@ void ModelTypeWorker::OnCommitResponse(CommitResponseDataList* response_list) {
model_type_processor_->OnCommitCompleted(model_type_state_, *response_list);
}
+void ModelTypeWorker::AbortMigration() {
+ DCHECK(!model_type_state_.initial_sync_done());
+ model_type_state_ = sync_pb::ModelTypeState();
+ entities_.clear();
+ pending_updates_.clear();
+ has_encrypted_updates_ = false;
+ nudge_handler_->NudgeForInitialDownload(type_);
+}
+
base::WeakPtr<ModelTypeWorker> ModelTypeWorker::AsWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}

Powered by Google App Engine
This is Rietveld 408576698