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

Unified Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 6874018: make new syncer thread the default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Send for CR. Created 9 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/glue/sync_backend_host.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index 50fc35cf4dcfb94846fd6fa0492bdf8648bc30ca..9d57a8f9d60335e533eb311fd06749d78c473214 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -66,9 +66,6 @@ SyncBackendHost::SyncBackendHost(Profile* profile)
sync_data_folder_path_(
profile_->GetPath().Append(kSyncDataFolderName)),
last_auth_error_(AuthError::None()),
- using_new_syncer_thread_(
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kNewSyncerThread)),
syncapi_initialized_(false) {
}
@@ -78,9 +75,6 @@ SyncBackendHost::SyncBackendHost()
profile_(NULL),
frontend_(NULL),
last_auth_error_(AuthError::None()),
- using_new_syncer_thread_(
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kNewSyncerThread)),
syncapi_initialized_(false) {
}
@@ -409,16 +403,7 @@ void SyncBackendHost::ConfigureDataTypes(
&registrar_.routing_info));
}
- // If we're doing the first configure (at startup) this is redundant as the
- // syncer thread always must start in config mode.
- if (using_new_syncer_thread_) {
- core_thread_.message_loop()->PostTask(
- FROM_HERE,
- NewRunnableMethod(core_.get(),
- &SyncBackendHost::Core::DoStartConfigurationMode));
- } else {
- FinishConfigureDataTypesOnFrontendLoop();
- }
+ FinishConfigureDataTypesOnFrontendLoop();
}
void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() {
@@ -433,15 +418,11 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() {
// downloading updates for newly added data types. Once this is
// complete, the configure_state_.ready_task_ is run via an
// OnInitializationComplete notification.
- bool request_nudge = false;
+
if (pending_config_mode_state_->deleted_type) {
- if (using_new_syncer_thread_) {
- core_thread_.message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(core_.get(),
- &SyncBackendHost::Core::DeferNudgeForCleanup));
- } else {
- request_nudge = true;
- }
+ core_thread_.message_loop()->PostTask(FROM_HERE,
+ NewRunnableMethod(core_.get(),
+ &SyncBackendHost::Core::DeferNudgeForCleanup));
}
if (pending_config_mode_state_->added_types.none() &&
@@ -464,17 +445,14 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() {
pending_config_mode_state_->ready_task->Run();
} else {
pending_download_state_.reset(pending_config_mode_state_.release());
- if (using_new_syncer_thread_) {
- RequestConfig(pending_download_state_->added_types);
- } else {
- request_nudge = true;
- }
- }
- // TODO(tim): Remove this when we get rid of the old syncer thread.
- if (request_nudge) {
- CHECK(!using_new_syncer_thread_);
- RequestNudge(FROM_HERE);
+ syncable::ModelTypeBitSet types_copy(pending_download_state_->added_types);
+ if (IsNigoriEnabled())
+ types_copy.set(syncable::NIGORI);
+ core_thread_.message_loop()->PostTask(FROM_HERE,
+ NewRunnableMethod(core_.get(),
+ &SyncBackendHost::Core::DoRequestConfig,
+ types_copy));
}
pending_config_mode_state_.reset();
@@ -499,17 +477,6 @@ void SyncBackendHost::RequestNudge(const tracked_objects::Location& location) {
location));
}
-void SyncBackendHost::RequestConfig(
- const syncable::ModelTypeBitSet& added_types) {
- DCHECK(core_->syncapi());
-
- syncable::ModelTypeBitSet types_copy(added_types);
- if (IsNigoriEnabled())
- types_copy.set(syncable::NIGORI);
-
- core_->syncapi()->RequestConfig(types_copy);
-}
-
void SyncBackendHost::ActivateDataType(
DataTypeController* data_type_controller,
ChangeProcessor* change_processor) {
@@ -541,20 +508,6 @@ void SyncBackendHost::DeactivateDataType(
DCHECK_EQ(erased, 1U);
}
-bool SyncBackendHost::RequestPause() {
- DCHECK(!using_new_syncer_thread_);
- core_thread_.message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoRequestPause));
- return true;
-}
-
-bool SyncBackendHost::RequestResume() {
- DCHECK(!using_new_syncer_thread_);
- core_thread_.message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoRequestResume));
- return true;
-}
-
bool SyncBackendHost::RequestClearServerData() {
core_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(),
@@ -565,20 +518,6 @@ bool SyncBackendHost::RequestClearServerData() {
SyncBackendHost::Core::~Core() {
}
-void SyncBackendHost::Core::NotifyPaused() {
- DCHECK(!host_ || !host_->using_new_syncer_thread_);
- NotificationService::current()->Notify(NotificationType::SYNC_PAUSED,
- NotificationService::AllSources(),
- NotificationService::NoDetails());
-}
-
-void SyncBackendHost::Core::NotifyResumed() {
- DCHECK(!host_ || !host_->using_new_syncer_thread_);
- NotificationService::current()->Notify(NotificationType::SYNC_RESUMED,
- NotificationService::AllSources(),
- NotificationService::NoDetails());
-}
-
void SyncBackendHost::Core::NotifyPassphraseRequired(bool for_decryption) {
if (!host_ || !host_->frontend_)
return;
@@ -832,6 +771,11 @@ void SyncBackendHost::Core::DoEncryptDataTypes(
syncapi_->EncryptDataTypes(encrypted_types);
}
+void SyncBackendHost::Core::DoRequestConfig(
+ const syncable::ModelTypeBitSet& added_types) {
+ syncapi_->RequestConfig(added_types);
+}
+
UIModelWorker* SyncBackendHost::ui_worker() {
ModelSafeWorker* w = registrar_.workers[GROUP_UI];
if (w == NULL)
@@ -949,7 +893,6 @@ void SyncBackendHost::Core::HandleSyncCycleCompletedOnFrontendLoop(
}
if (!found_all_added) {
CHECK(false);
- DCHECK(!host_->using_new_syncer_thread_);
} else {
host_->pending_download_state_->ready_task->Run();
host_->pending_download_state_.reset();
@@ -1027,18 +970,6 @@ void SyncBackendHost::Core::OnPassphraseAccepted(
bootstrap_token));
}
-void SyncBackendHost::Core::OnPaused() {
- host_->frontend_loop_->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &Core::NotifyPaused));
-}
-
-void SyncBackendHost::Core::OnResumed() {
- host_->frontend_loop_->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &Core::NotifyResumed));
-}
-
void SyncBackendHost::Core::OnStopSyncingPermanently() {
host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
&Core::HandleStopSyncingPermanentlyOnFrontendLoop));
@@ -1130,14 +1061,6 @@ void SyncBackendHost::Core::DoRequestClearServerData() {
syncapi_->RequestClearServerData();
}
-void SyncBackendHost::Core::DoRequestResume() {
- syncapi_->RequestResume();
-}
-
-void SyncBackendHost::Core::DoRequestPause() {
- syncapi()->RequestPause();
-}
-
void SyncBackendHost::Core::SaveChanges() {
syncapi_->SaveChanges();
}
@@ -1213,11 +1136,6 @@ void SyncBackendHost::Core::DoProcessMessage(
syncapi_->GetJsBackend()->ProcessMessage(name, args, sender);
}
-void SyncBackendHost::Core::DoStartConfigurationMode() {
- syncapi_->StartConfigurationMode(NewCallback(this,
- &SyncBackendHost::Core::FinishConfigureDataTypes));
-}
-
void SyncBackendHost::Core::DeferNudgeForCleanup() {
DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop());
deferred_nudge_for_cleanup_requested_ = true;

Powered by Google App Engine
This is Rietveld 408576698