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

Unified Diff: components/sync/driver/backend_migrator.cc

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: 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
« no previous file with comments | « components/sync/driver/backend_migrator.h ('k') | components/sync/driver/backend_migrator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/driver/backend_migrator.cc
diff --git a/components/sync/driver/backend_migrator.cc b/components/sync/driver/backend_migrator.cc
index f1162804c44255ea8db3dc2634a17f1f28b295b5..9b95781d724e366256d6d839ffc7c7e8c66829ac 100644
--- a/components/sync/driver/backend_migrator.cc
+++ b/components/sync/driver/backend_migrator.cc
@@ -15,14 +15,18 @@
#include "components/sync/protocol/sync.pb.h"
#include "components/sync/syncable/directory.h" // TODO(tim): Bug 131130.
-namespace syncer {
+using syncer::ModelTypeSet;
+
+namespace browser_sync {
+
+using syncer::ModelTypeToString;
MigrationObserver::~MigrationObserver() {}
BackendMigrator::BackendMigrator(const std::string& name,
- UserShare* user_share,
- SyncService* service,
- DataTypeManager* manager,
+ syncer::UserShare* user_share,
+ sync_driver::SyncService* service,
+ sync_driver::DataTypeManager* manager,
const base::Closure& migration_done_callback)
: name_(name),
user_share_(user_share),
@@ -41,7 +45,7 @@ BackendMigrator::~BackendMigrator() {}
#define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": "
-void BackendMigrator::MigrateTypes(ModelTypeSet types) {
+void BackendMigrator::MigrateTypes(syncer::ModelTypeSet types) {
const ModelTypeSet old_to_migrate = to_migrate_;
to_migrate_.PutAll(types);
SDVLOG(1) << "MigrateTypes called with " << ModelTypeSetToString(types)
@@ -87,7 +91,7 @@ void BackendMigrator::ChangeState(State new_state) {
bool BackendMigrator::TryStart() {
DCHECK_EQ(state_, WAITING_TO_START);
- if (manager_->state() == DataTypeManager::CONFIGURED) {
+ if (manager_->state() == sync_driver::DataTypeManager::CONFIGURED) {
RestartMigration();
return true;
}
@@ -100,11 +104,11 @@ void BackendMigrator::RestartMigration() {
SDVLOG(1) << "BackendMigrator disabling types "
<< ModelTypeSetToString(to_migrate_);
- manager_->PurgeForMigration(to_migrate_, CONFIGURE_REASON_MIGRATION);
+ manager_->PurgeForMigration(to_migrate_, syncer::CONFIGURE_REASON_MIGRATION);
}
void BackendMigrator::OnConfigureDone(
- const DataTypeManager::ConfigureResult& result) {
+ const sync_driver::DataTypeManager::ConfigureResult& result) {
if (state_ == IDLE)
return;
@@ -118,11 +122,12 @@ void BackendMigrator::OnConfigureDone(
namespace {
-ModelTypeSet GetUnsyncedDataTypes(UserShare* user_share) {
- ReadTransaction trans(FROM_HERE, user_share);
- ModelTypeSet unsynced_data_types;
- for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
- ModelType type = ModelTypeFromInt(i);
+syncer::ModelTypeSet GetUnsyncedDataTypes(syncer::UserShare* user_share) {
+ syncer::ReadTransaction trans(FROM_HERE, user_share);
+ syncer::ModelTypeSet unsynced_data_types;
+ for (int i = syncer::FIRST_REAL_MODEL_TYPE; i < syncer::MODEL_TYPE_COUNT;
+ ++i) {
+ syncer::ModelType type = syncer::ModelTypeFromInt(i);
sync_pb::DataTypeProgressMarker progress_marker;
trans.GetDirectory()->GetDownloadProgress(type, &progress_marker);
if (progress_marker.token().empty()) {
@@ -135,7 +140,7 @@ ModelTypeSet GetUnsyncedDataTypes(UserShare* user_share) {
} // namespace
void BackendMigrator::OnConfigureDoneImpl(
- const DataTypeManager::ConfigureResult& result) {
+ const sync_driver::DataTypeManager::ConfigureResult& result) {
SDVLOG(1) << "OnConfigureDone with requested types "
<< ModelTypeSetToString(result.requested_types) << ", status "
<< result.status
@@ -158,7 +163,7 @@ void BackendMigrator::OnConfigureDoneImpl(
return;
}
- if (result.status != DataTypeManager::OK) {
+ if (result.status != sync_driver::DataTypeManager::OK) {
// If this fails, and we're disabling types, a type may or may not be
// disabled until the user restarts the browser. If this wasn't an abort,
// any failure will be reported as an unrecoverable error to the UI. If it
@@ -173,12 +178,13 @@ void BackendMigrator::OnConfigureDoneImpl(
}
if (state_ == DISABLING_TYPES) {
- const ModelTypeSet unsynced_types = GetUnsyncedDataTypes(user_share_);
+ const syncer::ModelTypeSet unsynced_types =
+ GetUnsyncedDataTypes(user_share_);
if (!unsynced_types.HasAll(to_migrate_)) {
SLOG(WARNING) << "Set of unsynced types: "
- << ModelTypeSetToString(unsynced_types)
+ << syncer::ModelTypeSetToString(unsynced_types)
<< " does not contain types to migrate: "
- << ModelTypeSetToString(to_migrate_)
+ << syncer::ModelTypeSetToString(to_migrate_)
<< "; not re-enabling yet";
return;
}
@@ -188,14 +194,14 @@ void BackendMigrator::OnConfigureDoneImpl(
// may have chosen to disable types during the migration.
const ModelTypeSet full_set = service_->GetPreferredDataTypes();
SDVLOG(1) << "BackendMigrator re-enabling types: "
- << ModelTypeSetToString(full_set);
- manager_->Configure(full_set, CONFIGURE_REASON_MIGRATION);
+ << syncer::ModelTypeSetToString(full_set);
+ manager_->Configure(full_set, syncer::CONFIGURE_REASON_MIGRATION);
} else if (state_ == REENABLING_TYPES) {
// We're done!
ChangeState(IDLE);
SDVLOG(1) << "BackendMigrator: Migration complete for: "
- << ModelTypeSetToString(to_migrate_);
+ << syncer::ModelTypeSetToString(to_migrate_);
to_migrate_.Clear();
if (!migration_done_callback_.is_null())
@@ -207,7 +213,7 @@ BackendMigrator::State BackendMigrator::state() const {
return state_;
}
-ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const {
+syncer::ModelTypeSet BackendMigrator::GetPendingMigrationTypesForTest() const {
return to_migrate_;
}
« no previous file with comments | « components/sync/driver/backend_migrator.h ('k') | components/sync/driver/backend_migrator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698