| 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_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ | 6 #define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Datatype agnostic change processor. One instance of GenericChangeProcessor | 32 // Datatype agnostic change processor. One instance of GenericChangeProcessor |
| 33 // is created for each datatype and lives on the datatype's thread. It then | 33 // is created for each datatype and lives on the datatype's thread. It then |
| 34 // handles all interaction with the sync api, both translating pushes from the | 34 // handles all interaction with the sync api, both translating pushes from the |
| 35 // local service into transactions and receiving changes from the sync model, | 35 // local service into transactions and receiving changes from the sync model, |
| 36 // which then get converted into SyncChange's and sent to the local service. | 36 // which then get converted into SyncChange's and sent to the local service. |
| 37 // | 37 // |
| 38 // As a rule, the GenericChangeProcessor is not thread safe, and should only | 38 // As a rule, the GenericChangeProcessor is not thread safe, and should only |
| 39 // be used on the same thread in which it was created. | 39 // be used on the same thread in which it was created. |
| 40 class GenericChangeProcessor : public ChangeProcessor, | 40 class GenericChangeProcessor : public ChangeProcessor, |
| 41 public syncer::SyncChangeProcessor, | 41 public syncer::SyncChangeProcessor, |
| 42 public syncer::AttachmentService::Delegate, |
| 42 public base::NonThreadSafe { | 43 public base::NonThreadSafe { |
| 43 public: | 44 public: |
| 44 // Create a change processor and connect it to the syncer. | 45 // Create a change processor and connect it to the syncer. |
| 45 GenericChangeProcessor( | 46 GenericChangeProcessor( |
| 46 DataTypeErrorHandler* error_handler, | 47 DataTypeErrorHandler* error_handler, |
| 47 const base::WeakPtr<syncer::SyncableService>& local_service, | 48 const base::WeakPtr<syncer::SyncableService>& local_service, |
| 48 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, | 49 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, |
| 49 syncer::UserShare* user_share, | 50 syncer::UserShare* user_share, |
| 50 scoped_ptr<syncer::AttachmentService> attachment_service); | 51 scoped_ptr<syncer::AttachmentService> attachment_service); |
| 51 virtual ~GenericChangeProcessor(); | 52 virtual ~GenericChangeProcessor(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 64 virtual syncer::SyncError ProcessSyncChanges( | 65 virtual syncer::SyncError ProcessSyncChanges( |
| 65 const tracked_objects::Location& from_here, | 66 const tracked_objects::Location& from_here, |
| 66 const syncer::SyncChangeList& change_list) OVERRIDE; | 67 const syncer::SyncChangeList& change_list) OVERRIDE; |
| 67 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) | 68 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) |
| 68 const OVERRIDE; | 69 const OVERRIDE; |
| 69 virtual syncer::SyncError UpdateDataTypeContext( | 70 virtual syncer::SyncError UpdateDataTypeContext( |
| 70 syncer::ModelType type, | 71 syncer::ModelType type, |
| 71 syncer::SyncChangeProcessor::ContextRefreshStatus refresh_status, | 72 syncer::SyncChangeProcessor::ContextRefreshStatus refresh_status, |
| 72 const std::string& context) OVERRIDE; | 73 const std::string& context) OVERRIDE; |
| 73 | 74 |
| 75 // syncer::AttachmentService::Delegate implementation. |
| 76 virtual void OnAttachmentUploaded( |
| 77 const syncer::AttachmentId& attachment_id) OVERRIDE; |
| 78 |
| 74 // Similar to above, but returns a SyncError for use by direct clients | 79 // Similar to above, but returns a SyncError for use by direct clients |
| 75 // of GenericChangeProcessor that may need more error visibility. | 80 // of GenericChangeProcessor that may need more error visibility. |
| 76 virtual syncer::SyncError GetAllSyncDataReturnError( | 81 virtual syncer::SyncError GetAllSyncDataReturnError( |
| 77 syncer::ModelType type, | 82 syncer::ModelType type, |
| 78 syncer::SyncDataList* data) const; | 83 syncer::SyncDataList* data) const; |
| 79 | 84 |
| 80 // If a datatype context associated with |type| exists, fills |context| and | 85 // If a datatype context associated with |type| exists, fills |context| and |
| 81 // returns true. Otheriwse, if there has not been a context set, returns | 86 // returns true. Otheriwse, if there has not been a context set, returns |
| 82 // false. | 87 // false. |
| 83 virtual bool GetDataTypeContext(syncer::ModelType type, | 88 virtual bool GetDataTypeContext(syncer::ModelType type, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 base::WeakPtrFactory<syncer::AttachmentService> | 153 base::WeakPtrFactory<syncer::AttachmentService> |
| 149 attachment_service_weak_ptr_factory_; | 154 attachment_service_weak_ptr_factory_; |
| 150 syncer::AttachmentServiceProxy attachment_service_proxy_; | 155 syncer::AttachmentServiceProxy attachment_service_proxy_; |
| 151 | 156 |
| 152 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); | 157 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); |
| 153 }; | 158 }; |
| 154 | 159 |
| 155 } // namespace browser_sync | 160 } // namespace browser_sync |
| 156 | 161 |
| 157 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ | 162 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ |
| OLD | NEW |