| Index: components/sync/core_impl/sync_manager_impl.cc
|
| diff --git a/components/sync/core_impl/sync_manager_impl.cc b/components/sync/core_impl/sync_manager_impl.cc
|
| index 4093b743b8b4468ad55ede7b3406fa3bdf702404..f9c7f72f39f22af98436767b2a22114f22a1bb00 100644
|
| --- a/components/sync/core_impl/sync_manager_impl.cc
|
| +++ b/components/sync/core_impl/sync_manager_impl.cc
|
| @@ -38,9 +38,9 @@
|
| #include "components/sync/core_impl/change_reorder_buffer.h"
|
| #include "components/sync/core_impl/model_type_connector_proxy.h"
|
| #include "components/sync/core_impl/syncapi_internal.h"
|
| -#include "components/sync/core_impl/syncapi_server_connection_manager.h"
|
| #include "components/sync/engine/polling_constants.h"
|
| #include "components/sync/engine_impl/cycle/directory_type_debug_info_emitter.h"
|
| +#include "components/sync/engine_impl/net/loopback_connection_manager.h"
|
| #include "components/sync/engine_impl/sync_scheduler.h"
|
| #include "components/sync/engine_impl/syncer_types.h"
|
| #include "components/sync/protocol/proto_value_conversions.h"
|
| @@ -222,9 +222,10 @@ void SyncManagerImpl::Init(InitArgs* args) {
|
| CHECK(!initialized_);
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(args->post_factory.get());
|
| - DCHECK(!args->credentials.account_id.empty());
|
| - DCHECK(!args->credentials.sync_token.empty());
|
| - DCHECK(!args->credentials.scope_set.empty());
|
| + // ### Only run this when needed.
|
| + //DCHECK(!args->credentials.account_id.empty());
|
| + //DCHECK(!args->credentials.sync_token.empty());
|
| + //DCHECK(!args->credentials.scope_set.empty());
|
| DCHECK(args->cancelation_signal);
|
| DVLOG(1) << "SyncManager starting Init...";
|
|
|
| @@ -285,11 +286,8 @@ void SyncManagerImpl::Init(InitArgs* args) {
|
| args->saved_nigori_state.reset();
|
| }
|
|
|
| - connection_manager_.reset(new SyncAPIServerConnectionManager(
|
| - args->service_url.host() + args->service_url.path(),
|
| - args->service_url.EffectiveIntPort(),
|
| - args->service_url.SchemeIsCryptographic(), args->post_factory.release(),
|
| - args->cancelation_signal));
|
| + connection_manager_.reset(new LoopbackConnectionManager(
|
| + directory(), args->cancelation_signal));
|
| connection_manager_->set_client_id(directory()->cache_guid());
|
| connection_manager_->AddListener(this);
|
|
|
| @@ -320,13 +318,15 @@ void SyncManagerImpl::Init(InitArgs* args) {
|
|
|
| initialized_ = true;
|
|
|
| - net::NetworkChangeNotifier::AddIPAddressObserver(this);
|
| - net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
|
| - observing_network_connectivity_changes_ = true;
|
| + // ### Only when needed.
|
| + // net::NetworkChangeNotifier::AddIPAddressObserver(this);
|
| + // net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
|
| + // observing_network_connectivity_changes_ = true;
|
|
|
| UpdateCredentials(args->credentials);
|
|
|
| NotifyInitializationSuccess();
|
| + LOG(ERROR) << "SyncManagerImpl::Init finished";
|
| }
|
|
|
| void SyncManagerImpl::NotifyInitializationSuccess() {
|
| @@ -477,12 +477,14 @@ bool SyncManagerImpl::PurgeDisabledTypes(ModelTypeSet to_purge,
|
| void SyncManagerImpl::UpdateCredentials(const SyncCredentials& credentials) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK(initialized_);
|
| - DCHECK(!credentials.account_id.empty());
|
| - DCHECK(!credentials.sync_token.empty());
|
| - DCHECK(!credentials.scope_set.empty());
|
| + // ### Only when needed.
|
| + // DCHECK(!credentials.account_id.empty());
|
| + // DCHECK(!credentials.sync_token.empty());
|
| + // DCHECK(!credentials.scope_set.empty());
|
| cycle_context_->set_account_name(credentials.email);
|
|
|
| - observing_network_connectivity_changes_ = true;
|
| + // ### Why here again?
|
| + // observing_network_connectivity_changes_ = true;
|
| if (!connection_manager_->SetAuthToken(credentials.sync_token))
|
| return; // Auth token is known to be invalid, so exit early.
|
|
|
|
|