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/core/internal_components_factory_impl.h" | 5 #include "components/sync/engine/engine_components_factory_impl.h" |
6 | 6 |
7 #include "components/sync/engine_impl/backoff_delay_provider.h" | 7 #include "components/sync/engine_impl/backoff_delay_provider.h" |
8 #include "components/sync/engine_impl/cycle/sync_cycle_context.h" | 8 #include "components/sync/engine_impl/cycle/sync_cycle_context.h" |
9 #include "components/sync/engine_impl/sync_scheduler_impl.h" | 9 #include "components/sync/engine_impl/sync_scheduler_impl.h" |
10 #include "components/sync/engine_impl/syncer.h" | 10 #include "components/sync/engine_impl/syncer.h" |
11 #include "components/sync/syncable/on_disk_directory_backing_store.h" | 11 #include "components/sync/syncable/on_disk_directory_backing_store.h" |
12 | 12 |
13 using base::TimeDelta; | 13 using base::TimeDelta; |
14 | 14 |
15 namespace syncer { | 15 namespace syncer { |
16 | 16 |
17 InternalComponentsFactoryImpl::InternalComponentsFactoryImpl( | 17 EngineComponentsFactoryImpl::EngineComponentsFactoryImpl( |
18 const Switches& switches) | 18 const Switches& switches) |
19 : switches_(switches) {} | 19 : switches_(switches) {} |
20 | 20 |
21 InternalComponentsFactoryImpl::~InternalComponentsFactoryImpl() {} | 21 EngineComponentsFactoryImpl::~EngineComponentsFactoryImpl() {} |
22 | 22 |
23 std::unique_ptr<SyncScheduler> InternalComponentsFactoryImpl::BuildScheduler( | 23 std::unique_ptr<SyncScheduler> EngineComponentsFactoryImpl::BuildScheduler( |
24 const std::string& name, | 24 const std::string& name, |
25 SyncCycleContext* context, | 25 SyncCycleContext* context, |
26 CancelationSignal* cancelation_signal) { | 26 CancelationSignal* cancelation_signal) { |
27 std::unique_ptr<BackoffDelayProvider> delay( | 27 std::unique_ptr<BackoffDelayProvider> delay( |
28 BackoffDelayProvider::FromDefaults()); | 28 BackoffDelayProvider::FromDefaults()); |
29 | 29 |
30 if (switches_.backoff_override == BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE) | 30 if (switches_.backoff_override == BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE) |
31 delay.reset(BackoffDelayProvider::WithShortInitialRetryOverride()); | 31 delay.reset(BackoffDelayProvider::WithShortInitialRetryOverride()); |
32 | 32 |
33 return std::unique_ptr<SyncScheduler>(new SyncSchedulerImpl( | 33 return std::unique_ptr<SyncScheduler>(new SyncSchedulerImpl( |
34 name, delay.release(), context, new Syncer(cancelation_signal))); | 34 name, delay.release(), context, new Syncer(cancelation_signal))); |
35 } | 35 } |
36 | 36 |
37 std::unique_ptr<SyncCycleContext> InternalComponentsFactoryImpl::BuildContext( | 37 std::unique_ptr<SyncCycleContext> EngineComponentsFactoryImpl::BuildContext( |
38 ServerConnectionManager* connection_manager, | 38 ServerConnectionManager* connection_manager, |
39 syncable::Directory* directory, | 39 syncable::Directory* directory, |
40 ExtensionsActivity* extensions_activity, | 40 ExtensionsActivity* extensions_activity, |
41 const std::vector<SyncEngineEventListener*>& listeners, | 41 const std::vector<SyncEngineEventListener*>& listeners, |
42 DebugInfoGetter* debug_info_getter, | 42 DebugInfoGetter* debug_info_getter, |
43 ModelTypeRegistry* model_type_registry, | 43 ModelTypeRegistry* model_type_registry, |
44 const std::string& invalidation_client_id) { | 44 const std::string& invalidation_client_id) { |
45 return std::unique_ptr<SyncCycleContext>( | 45 return std::unique_ptr<SyncCycleContext>( |
46 new SyncCycleContext(connection_manager, directory, extensions_activity, | 46 new SyncCycleContext(connection_manager, directory, extensions_activity, |
47 listeners, debug_info_getter, model_type_registry, | 47 listeners, debug_info_getter, model_type_registry, |
48 switches_.encryption_method == ENCRYPTION_KEYSTORE, | 48 switches_.encryption_method == ENCRYPTION_KEYSTORE, |
49 switches_.pre_commit_updates_policy == | 49 switches_.pre_commit_updates_policy == |
50 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE, | 50 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE, |
51 invalidation_client_id)); | 51 invalidation_client_id)); |
52 } | 52 } |
53 | 53 |
54 std::unique_ptr<syncable::DirectoryBackingStore> | 54 std::unique_ptr<syncable::DirectoryBackingStore> |
55 InternalComponentsFactoryImpl::BuildDirectoryBackingStore( | 55 EngineComponentsFactoryImpl::BuildDirectoryBackingStore( |
56 StorageOption storage, | 56 StorageOption storage, |
57 const std::string& dir_name, | 57 const std::string& dir_name, |
58 const base::FilePath& backing_filepath) { | 58 const base::FilePath& backing_filepath) { |
59 if (storage == STORAGE_ON_DISK) { | 59 if (storage == STORAGE_ON_DISK) { |
60 return std::unique_ptr<syncable::DirectoryBackingStore>( | 60 return std::unique_ptr<syncable::DirectoryBackingStore>( |
61 new syncable::OnDiskDirectoryBackingStore(dir_name, backing_filepath)); | 61 new syncable::OnDiskDirectoryBackingStore(dir_name, backing_filepath)); |
62 } else { | 62 } else { |
63 NOTREACHED(); | 63 NOTREACHED(); |
64 return std::unique_ptr<syncable::DirectoryBackingStore>(); | 64 return std::unique_ptr<syncable::DirectoryBackingStore>(); |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 InternalComponentsFactory::Switches InternalComponentsFactoryImpl::GetSwitches() | 68 EngineComponentsFactory::Switches EngineComponentsFactoryImpl::GetSwitches() |
69 const { | 69 const { |
70 return switches_; | 70 return switches_; |
71 } | 71 } |
72 | 72 |
73 } // namespace syncer | 73 } // namespace syncer |
OLD | NEW |