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