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

Unified Diff: sync/internal_api/internal_components_factory_impl.cc

Issue 10837231: sync: add InternalComponentsFactory::Switches to simplify passing switches to internal components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pass switches in test_profile_sync_service.cc Created 8 years, 4 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: sync/internal_api/internal_components_factory_impl.cc
diff --git a/sync/internal_api/internal_components_factory_impl.cc b/sync/internal_api/internal_components_factory_impl.cc
index 3342d096ca14693bdaa6766d6eeb077b815b4ee2..746d25cc6cf8ae3493df83c37de5184b822f939a 100644
--- a/sync/internal_api/internal_components_factory_impl.cc
+++ b/sync/internal_api/internal_components_factory_impl.cc
@@ -4,20 +4,32 @@
#include "sync/internal_api/public/internal_components_factory_impl.h"
+#include "sync/engine/backoff_delay_provider.h"
#include "sync/engine/syncer.h"
#include "sync/engine/sync_scheduler_impl.h"
#include "sync/sessions/sync_session_context.h"
#include "sync/syncable/on_disk_directory_backing_store.h"
+using base::TimeDelta;
+
namespace syncer {
-InternalComponentsFactoryImpl::InternalComponentsFactoryImpl() { }
+InternalComponentsFactoryImpl::InternalComponentsFactoryImpl(
+ const Switches& switches) : switches_(switches) {
+}
+
InternalComponentsFactoryImpl::~InternalComponentsFactoryImpl() { }
scoped_ptr<SyncScheduler> InternalComponentsFactoryImpl::BuildScheduler(
const std::string& name, sessions::SyncSessionContext* context) {
+
+ scoped_ptr<BackoffDelayProvider> delay(BackoffDelayProvider::FromDefaults());
+
+ if (switches_.backoff_override == BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE)
rlarocque 2012/08/14 19:54:07 nit: Again, I think this would be nicer as an if/e
+ delay.reset(BackoffDelayProvider::WithShortInitialRetryOverride());
+
return scoped_ptr<SyncScheduler>(
- new SyncSchedulerImpl(name, context, new Syncer()));
+ new SyncSchedulerImpl(name, delay.release(), context, new Syncer()));
}
scoped_ptr<sessions::SyncSessionContext>
@@ -29,14 +41,13 @@ InternalComponentsFactoryImpl::BuildContext(
ThrottledDataTypeTracker* throttled_data_type_tracker,
const std::vector<SyncEngineEventListener*>& listeners,
sessions::DebugInfoGetter* debug_info_getter,
- TrafficRecorder* traffic_recorder,
- bool keystore_encryption_enabled) {
+ TrafficRecorder* traffic_recorder) {
return scoped_ptr<sessions::SyncSessionContext>(
new sessions::SyncSessionContext(
connection_manager, directory, workers, monitor,
throttled_data_type_tracker, listeners, debug_info_getter,
traffic_recorder,
- keystore_encryption_enabled));
+ switches_.encryption_method == ENCRYPTION_KEYSTORE));
}
scoped_ptr<syncable::DirectoryBackingStore>
@@ -46,4 +57,9 @@ InternalComponentsFactoryImpl::BuildDirectoryBackingStore(
new syncable::OnDiskDirectoryBackingStore(dir_name, backing_filepath));
}
+InternalComponentsFactory::Switches
+InternalComponentsFactoryImpl::GetSwitches() const {
+ return switches_;
+}
+
} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698