| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/sync/engine/engine_components_factory_impl.h" | 5 #include "components/sync/engine/engine_components_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "components/sync/engine_impl/backoff_delay_provider.h" | 8 #include "components/sync/engine_impl/backoff_delay_provider.h" |
| 9 #include "components/sync/engine_impl/cycle/sync_cycle_context.h" | 9 #include "components/sync/engine_impl/cycle/sync_cycle_context.h" |
| 10 #include "components/sync/engine_impl/sync_scheduler_impl.h" | 10 #include "components/sync/engine_impl/sync_scheduler_impl.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 EngineComponentsFactoryImpl::EngineComponentsFactoryImpl( | 22 EngineComponentsFactoryImpl::EngineComponentsFactoryImpl( |
| 23 const Switches& switches) | 23 const Switches& switches) |
| 24 : switches_(switches) {} | 24 : switches_(switches) {} |
| 25 | 25 |
| 26 EngineComponentsFactoryImpl::~EngineComponentsFactoryImpl() {} | 26 EngineComponentsFactoryImpl::~EngineComponentsFactoryImpl() {} |
| 27 | 27 |
| 28 std::unique_ptr<SyncScheduler> EngineComponentsFactoryImpl::BuildScheduler( | 28 std::unique_ptr<SyncScheduler> EngineComponentsFactoryImpl::BuildScheduler( |
| 29 const std::string& name, | 29 const std::string& name, |
| 30 SyncCycleContext* context, | 30 SyncCycleContext* context, |
| 31 CancelationSignal* cancelation_signal) { | 31 CancelationSignal* cancelation_signal, |
| 32 bool ignore_auth_credentials) { |
| 32 std::unique_ptr<BackoffDelayProvider> delay( | 33 std::unique_ptr<BackoffDelayProvider> delay( |
| 33 BackoffDelayProvider::FromDefaults()); | 34 BackoffDelayProvider::FromDefaults()); |
| 34 | 35 |
| 35 if (switches_.backoff_override == BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE) { | 36 if (switches_.backoff_override == BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE) { |
| 36 delay.reset(BackoffDelayProvider::WithShortInitialRetryOverride()); | 37 delay.reset(BackoffDelayProvider::WithShortInitialRetryOverride()); |
| 37 } | 38 } |
| 38 | 39 |
| 39 std::unique_ptr<SyncSchedulerImpl> scheduler = | 40 std::unique_ptr<SyncSchedulerImpl> scheduler = |
| 40 base::MakeUnique<SyncSchedulerImpl>(name, delay.release(), context, | 41 base::MakeUnique<SyncSchedulerImpl>(name, delay.release(), context, |
| 41 new Syncer(cancelation_signal)); | 42 new Syncer(cancelation_signal), |
| 43 ignore_auth_credentials); |
| 42 if (switches_.nudge_delay == NudgeDelay::SHORT_NUDGE_DELAY) { | 44 if (switches_.nudge_delay == NudgeDelay::SHORT_NUDGE_DELAY) { |
| 43 // Set the default nudge delay to 0 because the default is used as a floor | 45 // Set the default nudge delay to 0 because the default is used as a floor |
| 44 // for override values, and we don't want the below override to be ignored. | 46 // for override values, and we don't want the below override to be ignored. |
| 45 scheduler->SetDefaultNudgeDelay(TimeDelta::FromMilliseconds(0)); | 47 scheduler->SetDefaultNudgeDelay(TimeDelta::FromMilliseconds(0)); |
| 46 // Only protocol types can have their delay customized. | 48 // Only protocol types can have their delay customized. |
| 47 ModelTypeSet protocol_types = syncer::ProtocolTypes(); | 49 ModelTypeSet protocol_types = syncer::ProtocolTypes(); |
| 48 std::map<ModelType, base::TimeDelta> nudge_delays; | 50 std::map<ModelType, base::TimeDelta> nudge_delays; |
| 49 for (ModelTypeSet::Iterator it = protocol_types.First(); it.Good(); | 51 for (ModelTypeSet::Iterator it = protocol_types.First(); it.Good(); |
| 50 it.Inc()) { | 52 it.Inc()) { |
| 51 nudge_delays[it.Get()] = | 53 nudge_delays[it.Get()] = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 return std::unique_ptr<syncable::DirectoryBackingStore>(); | 88 return std::unique_ptr<syncable::DirectoryBackingStore>(); |
| 87 } | 89 } |
| 88 } | 90 } |
| 89 | 91 |
| 90 EngineComponentsFactory::Switches EngineComponentsFactoryImpl::GetSwitches() | 92 EngineComponentsFactory::Switches EngineComponentsFactoryImpl::GetSwitches() |
| 91 const { | 93 const { |
| 92 return switches_; | 94 return switches_; |
| 93 } | 95 } |
| 94 | 96 |
| 95 } // namespace syncer | 97 } // namespace syncer |
| OLD | NEW |