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