OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_ | |
6 #define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/weak_ptr.h" | |
12 #include "components/sync/base/model_type.h" | |
13 | |
14 namespace syncer { | |
15 class AttachmentService; | |
16 class DataTypeErrorHandler; | |
17 class SyncableService; | |
18 class SyncMergeResult; | |
19 struct UserShare; | |
20 } | |
21 | |
22 namespace sync_driver { | |
23 | |
24 class GenericChangeProcessor; | |
25 class SyncClient; | |
26 | |
27 // Because GenericChangeProcessors are created and used only from the model | |
28 // thread, their lifetime is strictly shorter than other components like | |
29 // DataTypeController, which live before / after communication with model | |
30 // threads begins and ends. | |
31 // The GCP is created "on the fly" at just the right time, on just the right | |
32 // thread. Given that, we use a factory to instantiate GenericChangeProcessors | |
33 // so that tests can choose to use a fake processor (i.e instead of injection). | |
34 // |sync_factory| is used to create AttachmentServicefor GenericChangeProcessor. | |
35 // It is not retained after CreateGenericChangeProcessor exits. | |
36 class GenericChangeProcessorFactory { | |
37 public: | |
38 GenericChangeProcessorFactory(); | |
39 virtual ~GenericChangeProcessorFactory(); | |
40 virtual std::unique_ptr<GenericChangeProcessor> CreateGenericChangeProcessor( | |
41 syncer::ModelType type, | |
42 syncer::UserShare* user_share, | |
43 syncer::DataTypeErrorHandler* error_handler, | |
44 const base::WeakPtr<syncer::SyncableService>& local_service, | |
45 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, | |
46 SyncClient* sync_client); | |
47 | |
48 private: | |
49 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessorFactory); | |
50 }; | |
51 | |
52 } // namespace sync_driver | |
53 | |
54 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_ | |
OLD | NEW |