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

Side by Side Diff: components/sync_driver/generic_change_processor_factory.h

Issue 1907683003: Convert //components/sync_driver from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix, address feedback 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_
6 #define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_ 6 #define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "sync/internal_api/public/base/model_type.h" 12 #include "sync/internal_api/public/base/model_type.h"
12 13
13 namespace syncer { 14 namespace syncer {
14 class AttachmentService; 15 class AttachmentService;
15 class SyncableService; 16 class SyncableService;
16 class SyncMergeResult; 17 class SyncMergeResult;
17 struct UserShare; 18 struct UserShare;
18 } 19 }
19 20
20 namespace sync_driver { 21 namespace sync_driver {
21 22
22 class DataTypeErrorHandler; 23 class DataTypeErrorHandler;
23 class GenericChangeProcessor; 24 class GenericChangeProcessor;
24 class SyncClient; 25 class SyncClient;
25 26
26 // Because GenericChangeProcessors are created and used only from the model 27 // Because GenericChangeProcessors are created and used only from the model
27 // thread, their lifetime is strictly shorter than other components like 28 // thread, their lifetime is strictly shorter than other components like
28 // DataTypeController, which live before / after communication with model 29 // DataTypeController, which live before / after communication with model
29 // threads begins and ends. 30 // threads begins and ends.
30 // The GCP is created "on the fly" at just the right time, on just the right 31 // The GCP is created "on the fly" at just the right time, on just the right
31 // thread. Given that, we use a factory to instantiate GenericChangeProcessors 32 // thread. Given that, we use a factory to instantiate GenericChangeProcessors
32 // so that tests can choose to use a fake processor (i.e instead of injection). 33 // so that tests can choose to use a fake processor (i.e instead of injection).
33 // |sync_factory| is used to create AttachmentServicefor GenericChangeProcessor. 34 // |sync_factory| is used to create AttachmentServicefor GenericChangeProcessor.
34 // It is not retained after CreateGenericChangeProcessor exits. 35 // It is not retained after CreateGenericChangeProcessor exits.
35 class GenericChangeProcessorFactory { 36 class GenericChangeProcessorFactory {
36 public: 37 public:
37 GenericChangeProcessorFactory(); 38 GenericChangeProcessorFactory();
38 virtual ~GenericChangeProcessorFactory(); 39 virtual ~GenericChangeProcessorFactory();
39 virtual scoped_ptr<GenericChangeProcessor> CreateGenericChangeProcessor( 40 virtual std::unique_ptr<GenericChangeProcessor> CreateGenericChangeProcessor(
40 syncer::ModelType type, 41 syncer::ModelType type,
41 syncer::UserShare* user_share, 42 syncer::UserShare* user_share,
42 DataTypeErrorHandler* error_handler, 43 DataTypeErrorHandler* error_handler,
43 const base::WeakPtr<syncer::SyncableService>& local_service, 44 const base::WeakPtr<syncer::SyncableService>& local_service,
44 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, 45 const base::WeakPtr<syncer::SyncMergeResult>& merge_result,
45 SyncClient* sync_client); 46 SyncClient* sync_client);
46 47
47 private: 48 private:
48 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessorFactory); 49 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessorFactory);
49 }; 50 };
50 51
51 } // namespace sync_driver 52 } // namespace sync_driver
52 53
53 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_ 54 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_
OLDNEW
« no previous file with comments | « components/sync_driver/generic_change_processor.cc ('k') | components/sync_driver/generic_change_processor_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698