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

Unified Diff: chrome/browser/sync/backend_migrator.cc

Issue 10167017: Fix some migration-related bugs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit tests Created 8 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: chrome/browser/sync/backend_migrator.cc
diff --git a/chrome/browser/sync/backend_migrator.cc b/chrome/browser/sync/backend_migrator.cc
index f17ee992c0ef5d5e919cacf36c922a0942421b2e..d23acea2b7b6595ab935b3d65c900e7ce4277f21 100644
--- a/chrome/browser/sync/backend_migrator.cc
+++ b/chrome/browser/sync/backend_migrator.cc
@@ -32,8 +32,6 @@ BackendMigrator::BackendMigrator(const std::string& name,
: name_(name), user_share_(user_share), service_(service),
manager_(manager), state_(IDLE),
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
- registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE,
- content::Source<DataTypeManager>(manager_));
}
BackendMigrator::~BackendMigrator() {
@@ -120,22 +118,18 @@ void BackendMigrator::RestartMigration() {
}
}
-void BackendMigrator::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, type);
+void BackendMigrator::OnConfigureDone(
+ const DataTypeManager::ConfigureResult& result) {
if (state_ == IDLE)
return;
// |manager_|'s methods aren't re-entrant, and we're notified from
// them, so post a task to avoid problems.
- SDVLOG(1) << "Posting OnConfigureDone from Observer";
+ SDVLOG(1) << "Posting OnConfigureDoneImpl";
MessageLoop::current()->PostTask(
FROM_HERE,
- base::Bind(&BackendMigrator::OnConfigureDone,
- weak_ptr_factory_.GetWeakPtr(),
- *content::Details<DataTypeManager::ConfigureResult>(
- details).ptr()));
+ base::Bind(&BackendMigrator::OnConfigureDoneImpl,
+ weak_ptr_factory_.GetWeakPtr(), result));
}
namespace {
@@ -157,7 +151,7 @@ syncable::ModelTypeSet GetUnsyncedDataTypes(sync_api::UserShare* user_share) {
} // namespace
-void BackendMigrator::OnConfigureDone(
+void BackendMigrator::OnConfigureDoneImpl(
const DataTypeManager::ConfigureResult& result) {
SDVLOG(1) << "OnConfigureDone with requested types "
<< ModelTypeSetToString(result.requested_types)
@@ -221,6 +215,8 @@ void BackendMigrator::OnConfigureDone(
SDVLOG(1) << "BackendMigrator: Migration complete for: "
<< syncable::ModelTypeSetToString(to_migrate_);
to_migrate_.Clear();
+
+ service_->StartSyncingWithServer();
}
}

Powered by Google App Engine
This is Rietveld 408576698