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

Side by Side Diff: sync/internal_api/internal_components_factory_impl.cc

Issue 1866243002: Convert //sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 "sync/internal_api/public/internal_components_factory_impl.h" 5 #include "sync/internal_api/public/internal_components_factory_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "sync/engine/backoff_delay_provider.h" 10 #include "sync/engine/backoff_delay_provider.h"
11 #include "sync/engine/syncer.h" 11 #include "sync/engine/syncer.h"
12 #include "sync/engine/sync_scheduler_impl.h" 12 #include "sync/engine/sync_scheduler_impl.h"
13 #include "sync/sessions/sync_session_context.h" 13 #include "sync/sessions/sync_session_context.h"
14 #include "sync/syncable/on_disk_directory_backing_store.h" 14 #include "sync/syncable/on_disk_directory_backing_store.h"
15 15
16 using base::TimeDelta; 16 using base::TimeDelta;
17 17
18 namespace syncer { 18 namespace syncer {
19 19
20 InternalComponentsFactoryImpl::InternalComponentsFactoryImpl( 20 InternalComponentsFactoryImpl::InternalComponentsFactoryImpl(
21 const Switches& switches) : switches_(switches) { 21 const Switches& switches) : switches_(switches) {
22 } 22 }
23 23
24 InternalComponentsFactoryImpl::~InternalComponentsFactoryImpl() { } 24 InternalComponentsFactoryImpl::~InternalComponentsFactoryImpl() { }
25 25
26 scoped_ptr<SyncScheduler> InternalComponentsFactoryImpl::BuildScheduler( 26 std::unique_ptr<SyncScheduler> InternalComponentsFactoryImpl::BuildScheduler(
27 const std::string& name, 27 const std::string& name,
28 sessions::SyncSessionContext* context, 28 sessions::SyncSessionContext* context,
29 CancelationSignal* cancelation_signal) { 29 CancelationSignal* cancelation_signal) {
30 30 std::unique_ptr<BackoffDelayProvider> delay(
31 scoped_ptr<BackoffDelayProvider> delay(BackoffDelayProvider::FromDefaults()); 31 BackoffDelayProvider::FromDefaults());
32 32
33 if (switches_.backoff_override == BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE) 33 if (switches_.backoff_override == BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE)
34 delay.reset(BackoffDelayProvider::WithShortInitialRetryOverride()); 34 delay.reset(BackoffDelayProvider::WithShortInitialRetryOverride());
35 35
36 return scoped_ptr<SyncScheduler>(new SyncSchedulerImpl( 36 return std::unique_ptr<SyncScheduler>(new SyncSchedulerImpl(
37 name, 37 name, delay.release(), context, new Syncer(cancelation_signal)));
38 delay.release(),
39 context,
40 new Syncer(cancelation_signal)));
41 } 38 }
42 39
43 scoped_ptr<sessions::SyncSessionContext> 40 std::unique_ptr<sessions::SyncSessionContext>
44 InternalComponentsFactoryImpl::BuildContext( 41 InternalComponentsFactoryImpl::BuildContext(
45 ServerConnectionManager* connection_manager, 42 ServerConnectionManager* connection_manager,
46 syncable::Directory* directory, 43 syncable::Directory* directory,
47 ExtensionsActivity* extensions_activity, 44 ExtensionsActivity* extensions_activity,
48 const std::vector<SyncEngineEventListener*>& listeners, 45 const std::vector<SyncEngineEventListener*>& listeners,
49 sessions::DebugInfoGetter* debug_info_getter, 46 sessions::DebugInfoGetter* debug_info_getter,
50 ModelTypeRegistry* model_type_registry, 47 ModelTypeRegistry* model_type_registry,
51 const std::string& invalidation_client_id) { 48 const std::string& invalidation_client_id) {
52 return scoped_ptr<sessions::SyncSessionContext>( 49 return std::unique_ptr<sessions::SyncSessionContext>(
53 new sessions::SyncSessionContext( 50 new sessions::SyncSessionContext(
54 connection_manager, directory, extensions_activity, 51 connection_manager, directory, extensions_activity, listeners,
55 listeners, debug_info_getter, 52 debug_info_getter, model_type_registry,
56 model_type_registry,
57 switches_.encryption_method == ENCRYPTION_KEYSTORE, 53 switches_.encryption_method == ENCRYPTION_KEYSTORE,
58 switches_.pre_commit_updates_policy == 54 switches_.pre_commit_updates_policy ==
59 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE, 55 FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE,
60 invalidation_client_id)); 56 invalidation_client_id));
61 } 57 }
62 58
63 scoped_ptr<syncable::DirectoryBackingStore> 59 std::unique_ptr<syncable::DirectoryBackingStore>
64 InternalComponentsFactoryImpl::BuildDirectoryBackingStore( 60 InternalComponentsFactoryImpl::BuildDirectoryBackingStore(
65 StorageOption storage, const std::string& dir_name, 61 StorageOption storage,
62 const std::string& dir_name,
66 const base::FilePath& backing_filepath) { 63 const base::FilePath& backing_filepath) {
67 if (storage == STORAGE_ON_DISK) { 64 if (storage == STORAGE_ON_DISK) {
68 return scoped_ptr<syncable::DirectoryBackingStore>( 65 return std::unique_ptr<syncable::DirectoryBackingStore>(
69 new syncable::OnDiskDirectoryBackingStore(dir_name, backing_filepath)); 66 new syncable::OnDiskDirectoryBackingStore(dir_name, backing_filepath));
70 } else { 67 } else {
71 NOTREACHED(); 68 NOTREACHED();
72 return scoped_ptr<syncable::DirectoryBackingStore>(); 69 return std::unique_ptr<syncable::DirectoryBackingStore>();
73 } 70 }
74 } 71 }
75 72
76 InternalComponentsFactory::Switches 73 InternalComponentsFactory::Switches
77 InternalComponentsFactoryImpl::GetSwitches() const { 74 InternalComponentsFactoryImpl::GetSwitches() const {
78 return switches_; 75 return switches_;
79 } 76 }
80 77
81 } // namespace syncer 78 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698