Chromium Code Reviews| Index: sync/api/model_type_service.h |
| diff --git a/sync/api/model_type_service.h b/sync/api/model_type_service.h |
| index bba4211ffe47af84dfff1f733272dad5d594dcca..3b13fb4ed7f946075166f45d46f8ae593b8cee9c 100644 |
| --- a/sync/api/model_type_service.h |
| +++ b/sync/api/model_type_service.h |
| @@ -15,11 +15,13 @@ |
| #include "sync/api/model_type_change_processor.h" |
| #include "sync/api/sync_error.h" |
| #include "sync/base/sync_export.h" |
| +#include "sync/internal_api/public/activation_context.h" |
| namespace syncer_v2 { |
| class DataBatch; |
| class MetadataChangeList; |
| +class SharedModelTypeProcessor; |
| // Interface implemented by model types to receive updates from sync via the |
| // SharedModelTypeProcessor. Provides a way for sync to update the data and |
| @@ -29,8 +31,14 @@ class SYNC_EXPORT ModelTypeService { |
| typedef base::Callback<void(syncer::SyncError, scoped_ptr<DataBatch>)> |
| DataCallback; |
| typedef std::vector<std::string> ClientTagList; |
| + typedef base::Callback<scoped_ptr<ModelTypeChangeProcessor>( |
| + syncer::ModelType, |
|
skym
2016/03/22 15:56:26
Can you curry the model type before it gets to the
|
| + ModelTypeService* service)> |
| + SharedProcessorFactory; |
|
skym
2016/03/22 15:56:26
I like that you named this callback XxFactory.
Gang Wu
2016/03/22 17:47:51
Done.
|
| + typedef base::Callback<void(syncer::SyncError, scoped_ptr<ActivationContext>)> |
| + StartCallback; |
| - ModelTypeService(); |
| + ModelTypeService(const SharedProcessorFactory& shared_processor_factory); |
| virtual ~ModelTypeService(); |
| @@ -78,17 +86,23 @@ class SYNC_EXPORT ModelTypeService { |
| // it to the processor. |
| virtual void OnChangeProcessorSet() = 0; |
| - // TODO(skym): See crbug/547087, do we need all these accessors? |
| - ModelTypeChangeProcessor* change_processor() const; |
| + // Model type for this service. |
| + virtual syncer::ModelType type() const = 0; |
|
skym
2016/03/22 15:56:26
I'm not convinced you need this.
|
| - void set_change_processor( |
| - scoped_ptr<ModelTypeChangeProcessor> change_processor); |
| + // TODO(skym): See crbug/547087, do we need all these accessors? |
| + ModelTypeChangeProcessor* change_processor(); |
|
skym
2016/03/22 15:56:26
Why remove const?
Gang Wu
2016/03/22 17:47:51
Done.
|
| void clear_change_processor(); |
| + void OnSyncStarting(StartCallback callback); |
|
skym
2016/03/22 15:56:26
Typically we pass around callbacks as const refs.
Gang Wu
2016/03/22 17:47:51
Done.
|
| + |
| + protected: |
| + ModelTypeChangeProcessor* create_change_processor(); |
| + |
| private: |
| - // Recieves ownership in set_change_processor(...). |
| scoped_ptr<ModelTypeChangeProcessor> change_processor_; |
| + |
| + SharedProcessorFactory shared_processor_factory_; |
| }; |
| } // namespace syncer_v2 |