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

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: Review changes 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
« no previous file with comments | « chrome/browser/sync/backend_migrator.h ('k') | chrome/browser/sync/backend_migrator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..306afeb5eaf136f84c1c281cb626bfb1dbda90bb 100644
--- a/chrome/browser/sync/backend_migrator.cc
+++ b/chrome/browser/sync/backend_migrator.cc
@@ -28,12 +28,12 @@ MigrationObserver::~MigrationObserver() {}
BackendMigrator::BackendMigrator(const std::string& name,
sync_api::UserShare* user_share,
ProfileSyncService* service,
- DataTypeManager* manager)
+ DataTypeManager* manager,
+ const base::Closure &migration_done_callback)
: 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_));
+ weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
+ migration_done_callback_(migration_done_callback) {
}
BackendMigrator::~BackendMigrator() {
@@ -120,22 +120,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 +153,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 +217,9 @@ void BackendMigrator::OnConfigureDone(
SDVLOG(1) << "BackendMigrator: Migration complete for: "
<< syncable::ModelTypeSetToString(to_migrate_);
to_migrate_.Clear();
+
+ if (!migration_done_callback_.is_null())
+ migration_done_callback_.Run();
}
}
« no previous file with comments | « chrome/browser/sync/backend_migrator.h ('k') | chrome/browser/sync/backend_migrator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698