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

Side by Side Diff: components/sync/core/internal_components_factory_impl.cc

Issue 2413313004: [Sync] Move the last things out of core/. (Closed)
Patch Set: Address comments. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/sync/core/internal_components_factory_impl.h"
6
7 #include "components/sync/engine_impl/backoff_delay_provider.h"
8 #include "components/sync/engine_impl/cycle/sync_cycle_context.h"
9 #include "components/sync/engine_impl/sync_scheduler_impl.h"
10 #include "components/sync/engine_impl/syncer.h"
11 #include "components/sync/syncable/on_disk_directory_backing_store.h"
12
13 using base::TimeDelta;
14
15 namespace syncer {
16
17 InternalComponentsFactoryImpl::InternalComponentsFactoryImpl(
18 const Switches& switches)
19 : switches_(switches) {}
20
21 InternalComponentsFactoryImpl::~InternalComponentsFactoryImpl() {}
22
23 std::unique_ptr<SyncScheduler> InternalComponentsFactoryImpl::BuildScheduler(
24 const std::string& name,
25 SyncCycleContext* context,
26 CancelationSignal* cancelation_signal) {
27 std::unique_ptr<BackoffDelayProvider> delay(
28 BackoffDelayProvider::FromDefaults());
29
30 if (switches_.backoff_override == BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE)
31 delay.reset(BackoffDelayProvider::WithShortInitialRetryOverride());
32
33 return std::unique_ptr<SyncScheduler>(new SyncSchedulerImpl(
34 name, delay.release(), context, new Syncer(cancelation_signal)));
35 }
36
37 std::unique_ptr<SyncCycleContext> InternalComponentsFactoryImpl::BuildContext(
38 ServerConnectionManager* connection_manager,
39 syncable::Directory* directory,
40 ExtensionsActivity* extensions_activity,
41 const std::vector<SyncEngineEventListener*>& listeners,
42 DebugInfoGetter* debug_info_getter,
43 ModelTypeRegistry* model_type_registry,
44 const std::string& invalidation_client_id) {
45 return std::unique_ptr<SyncCycleContext>(
46 new SyncCycleContext(connection_manager, directory, extensions_activity,
47 listeners, debug_info_getter, model_type_registry,
48 switches_.encryption_method == ENCRYPTION_KEYSTORE,
49 switches_.pre_commit_updates_policy ==
50 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE,
51 invalidation_client_id));
52 }
53
54 std::unique_ptr<syncable::DirectoryBackingStore>
55 InternalComponentsFactoryImpl::BuildDirectoryBackingStore(
56 StorageOption storage,
57 const std::string& dir_name,
58 const base::FilePath& backing_filepath) {
59 if (storage == STORAGE_ON_DISK) {
60 return std::unique_ptr<syncable::DirectoryBackingStore>(
61 new syncable::OnDiskDirectoryBackingStore(dir_name, backing_filepath));
62 } else {
63 NOTREACHED();
64 return std::unique_ptr<syncable::DirectoryBackingStore>();
65 }
66 }
67
68 InternalComponentsFactory::Switches InternalComponentsFactoryImpl::GetSwitches()
69 const {
70 return switches_;
71 }
72
73 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/core/internal_components_factory_impl.h ('k') | components/sync/core/model_type_connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698