Chromium Code Reviews| Index: chrome/browser/sync/engine/syncapi.cc |
| diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc |
| index 7792dc6830555c37795f9c06509713ca9edf7987..1e10326294044461f0964dd638c2133319bf03a8 100644 |
| --- a/chrome/browser/sync/engine/syncapi.cc |
| +++ b/chrome/browser/sync/engine/syncapi.cc |
| @@ -28,11 +28,11 @@ |
| #include "chrome/browser/sync/engine/all_status.h" |
| #include "chrome/browser/sync/engine/change_reorder_buffer.h" |
| #include "chrome/browser/sync/engine/model_safe_worker.h" |
| +#include "chrome/browser/sync/engine/nudge_source.h" |
| #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
| #include "chrome/browser/sync/engine/net/syncapi_server_connection_manager.h" |
| #include "chrome/browser/sync/engine/syncer.h" |
| #include "chrome/browser/sync/engine/syncer_thread.h" |
| -#include "chrome/browser/sync/engine/syncer_thread2.h" |
| #include "chrome/browser/sync/engine/syncer_thread_adapter.h" |
| #include "chrome/browser/sync/engine/http_post_provider_factory.h" |
| #include "chrome/browser/sync/js_arg_list.h" |
| @@ -1664,33 +1664,21 @@ bool SyncManager::IsUsingExplicitPassphrase() { |
| return data_ && data_->IsUsingExplicitPassphrase(); |
| } |
| -bool SyncManager::RequestPause() { |
| - if (data_->syncer_thread()) |
| - return data_->syncer_thread()->RequestPause(); |
| - return false; |
| -} |
| - |
| -bool SyncManager::RequestResume() { |
| - if (data_->syncer_thread()) |
| - return data_->syncer_thread()->RequestResume(); |
| - return false; |
| -} |
| - |
| void SyncManager::RequestNudge(const tracked_objects::Location& location) { |
| if (data_->syncer_thread()) |
| - data_->syncer_thread()->NudgeSyncer(0, SyncerThread::kLocal, location); |
| + data_->syncer_thread()->NudgeSyncer( |
| + 0, browser_sync::NUDGE_SOURCE_LOCAL, location); |
| } |
| void SyncManager::RequestClearServerData() { |
| if (data_->syncer_thread()) |
| - data_->syncer_thread()->NudgeSyncer(0, SyncerThread::kClearPrivateData, |
| - FROM_HERE); |
| + data_->syncer_thread()->NudgeSyncer( |
| + 0, browser_sync::CLEAR_USER_PRIVATE_DATA, FROM_HERE); |
|
tim (not reviewing)
2011/04/18 16:11:47
SyncerThread has a "ScheduleClear..." operation, y
lipalani1
2011/04/18 20:36:41
Done.
|
| } |
| void SyncManager::RequestConfig(const syncable::ModelTypeBitSet& types) { |
| if (!data_->syncer_thread()) |
| return; |
| - // It is an error for this to be called if new_impl is null. |
| StartConfigurationMode(NULL); |
| data_->syncer_thread()->new_impl()->ScheduleConfig(types); |
| } |
| @@ -1701,7 +1689,7 @@ void SyncManager::StartConfigurationMode(ModeChangeCallback* callback) { |
| if (!data_->syncer_thread()->new_impl()) |
| return; |
| data_->syncer_thread()->new_impl()->Start( |
| - browser_sync::s3::SyncerThread::CONFIGURATION_MODE, callback); |
| + browser_sync::SyncerThread::CONFIGURATION_MODE, callback); |
| } |
| const std::string& SyncManager::GetAuthenticatedUsername() { |
| @@ -1739,16 +1727,7 @@ bool SyncManager::SyncInternal::Init( |
| net::NetworkChangeNotifier::AddIPAddressObserver(this); |
| - bool new_syncer_thread = CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kNewSyncerThread); |
| - |
| - if (new_syncer_thread) { |
| - connection_manager()->AddListener(this); |
| - } else { |
| - connection_manager_hookup_.reset( |
| - NewEventListenerHookup(connection_manager()->channel(), this, |
| - &SyncManager::SyncInternal::HandleServerConnectionEvent)); |
| - } |
| + connection_manager()->AddListener(this); |
| // TODO(akalin): CheckServerReachable() can block, which may cause jank if we |
| // try to shut down sync. Fix this. |
| @@ -1769,8 +1748,7 @@ bool SyncManager::SyncInternal::Init( |
| listeners); |
| context->set_account_name(credentials.email); |
| // The SyncerThread takes ownership of |context|. |
| - syncer_thread_.reset(new SyncerThreadAdapter(context, |
| - new_syncer_thread)); |
| + syncer_thread_.reset(new SyncerThreadAdapter(context)); |
|
tim (not reviewing)
2011/04/18 16:11:47
Can we just yank SyncerThreadAdapter now too?
lipalani1
2011/04/18 20:36:41
Done.
|
| } |
| bool signed_in = SignIn(credentials); |
| @@ -1882,9 +1860,6 @@ bool SyncManager::SyncInternal::OpenDirectory() { |
| connection_manager()->set_client_id(lookup->cache_guid()); |
| - if (syncer_thread()) |
| - syncer_thread()->CreateSyncer(username_for_share()); |
| - |
| MarkAndNotifyInitializationComplete(); |
| dir_change_hookup_.reset(lookup->AddChangeObserver(this)); |
| return true; |
| @@ -2419,7 +2394,7 @@ void SyncManager::SyncInternal::HandleCalculateChangesChangeEventFromSyncApi( |
| kPreferencesNudgeDelayMilliseconds : kDefaultNudgeDelayMilliseconds; |
| syncer_thread()->NudgeSyncerWithDataTypes( |
| nudge_delay, |
| - SyncerThread::kLocal, |
| + browser_sync::NUDGE_SOURCE_LOCAL, |
| model_types, |
| FROM_HERE); |
| } |
| @@ -2575,18 +2550,6 @@ void SyncManager::SyncInternal::OnSyncEngineEvent( |
| } |
| } |
| - if (event.what_happened == SyncEngineEvent::SYNCER_THREAD_PAUSED) { |
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| - OnPaused()); |
| - return; |
| - } |
| - |
| - if (event.what_happened == SyncEngineEvent::SYNCER_THREAD_RESUMED) { |
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| - OnResumed()); |
| - return; |
| - } |
| - |
| if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) { |
| FOR_EACH_OBSERVER(SyncManager::Observer, observers_, |
| OnStopSyncingPermanently()); |
| @@ -2770,7 +2733,7 @@ void SyncManager::SyncInternal::OnIncomingNotification( |
| if (syncer_thread()) { |
| syncer_thread()->NudgeSyncerWithPayloads( |
| kSyncerThreadDelayMsec, |
| - SyncerThread::kNotification, |
| + browser_sync::NUDGE_SOURCE_NOTIFICATION, |
| type_payloads, FROM_HERE); |
| } |
| allstatus_.IncrementNotificationsReceived(); |