| 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 11 matching lines...) Expand all Loading... |
| 22 namespace syncer { | 22 namespace syncer { |
| 23 class SyncData; | 23 class SyncData; |
| 24 class SyncableService; | 24 class SyncableService; |
| 25 class WriteNode; | 25 class WriteNode; |
| 26 class WriteTransaction; | 26 class WriteTransaction; |
| 27 | 27 |
| 28 typedef std::vector<syncer::SyncData> SyncDataList; | 28 typedef std::vector<syncer::SyncData> SyncDataList; |
| 29 } // namespace syncer | 29 } // namespace syncer |
| 30 | 30 |
| 31 namespace sync_driver { | 31 namespace sync_driver { |
| 32 |
| 32 class SyncApiComponentFactory; | 33 class SyncApiComponentFactory; |
| 34 class SyncClient; |
| 33 | 35 |
| 34 // Datatype agnostic change processor. One instance of GenericChangeProcessor | 36 // Datatype agnostic change processor. One instance of GenericChangeProcessor |
| 35 // is created for each datatype and lives on the datatype's thread. It then | 37 // is created for each datatype and lives on the datatype's thread. It then |
| 36 // handles all interaction with the sync api, both translating pushes from the | 38 // handles all interaction with the sync api, both translating pushes from the |
| 37 // local service into transactions and receiving changes from the sync model, | 39 // local service into transactions and receiving changes from the sync model, |
| 38 // which then get converted into SyncChange's and sent to the local service. | 40 // which then get converted into SyncChange's and sent to the local service. |
| 39 // | 41 // |
| 40 // As a rule, the GenericChangeProcessor is not thread safe, and should only | 42 // As a rule, the GenericChangeProcessor is not thread safe, and should only |
| 41 // be used on the same thread in which it was created. | 43 // be used on the same thread in which it was created. |
| 42 class GenericChangeProcessor : public ChangeProcessor, | 44 class GenericChangeProcessor : public ChangeProcessor, |
| 43 public syncer::SyncChangeProcessor, | 45 public syncer::SyncChangeProcessor, |
| 44 public syncer::AttachmentService::Delegate, | 46 public syncer::AttachmentService::Delegate, |
| 45 public base::NonThreadSafe { | 47 public base::NonThreadSafe { |
| 46 public: | 48 public: |
| 47 // Create a change processor for |type| and connect it to the syncer. | 49 // Create a change processor for |type| and connect it to the syncer. |
| 48 // |attachment_store| can be NULL which means that datatype will not use sync | 50 // |attachment_store| can be NULL which means that datatype will not use sync |
| 49 // attachments. | 51 // attachments. |
| 50 GenericChangeProcessor( | 52 GenericChangeProcessor( |
| 51 syncer::ModelType type, | 53 syncer::ModelType type, |
| 52 DataTypeErrorHandler* error_handler, | 54 DataTypeErrorHandler* error_handler, |
| 53 const base::WeakPtr<syncer::SyncableService>& local_service, | 55 const base::WeakPtr<syncer::SyncableService>& local_service, |
| 54 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, | 56 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, |
| 55 syncer::UserShare* user_share, | 57 syncer::UserShare* user_share, |
| 56 SyncApiComponentFactory* sync_factory, | 58 SyncClient* sync_client, |
| 57 scoped_ptr<syncer::AttachmentStoreForSync> attachment_store); | 59 scoped_ptr<syncer::AttachmentStoreForSync> attachment_store); |
| 58 ~GenericChangeProcessor() override; | 60 ~GenericChangeProcessor() override; |
| 59 | 61 |
| 60 // ChangeProcessor interface. | 62 // ChangeProcessor interface. |
| 61 // Build and store a list of all changes into |syncer_changes_|. | 63 // Build and store a list of all changes into |syncer_changes_|. |
| 62 void ApplyChangesFromSyncModel( | 64 void ApplyChangesFromSyncModel( |
| 63 const syncer::BaseTransaction* trans, | 65 const syncer::BaseTransaction* trans, |
| 64 int64 version, | 66 int64 version, |
| 65 const syncer::ImmutableChangeRecordList& changes) override; | 67 const syncer::ImmutableChangeRecordList& changes) override; |
| 66 // Passes |syncer_changes_|, built in ApplyChangesFromSyncModel, onto | 68 // Passes |syncer_changes_|, built in ApplyChangesFromSyncModel, onto |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 attachment_service_weak_ptr_factory_; | 169 attachment_service_weak_ptr_factory_; |
| 168 syncer::AttachmentServiceProxy attachment_service_proxy_; | 170 syncer::AttachmentServiceProxy attachment_service_proxy_; |
| 169 base::WeakPtrFactory<GenericChangeProcessor> weak_ptr_factory_; | 171 base::WeakPtrFactory<GenericChangeProcessor> weak_ptr_factory_; |
| 170 | 172 |
| 171 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); | 173 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); |
| 172 }; | 174 }; |
| 173 | 175 |
| 174 } // namespace sync_driver | 176 } // namespace sync_driver |
| 175 | 177 |
| 176 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ | 178 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ |
| OLD | NEW |