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