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" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "components/sync_driver/change_processor.h" | 13 #include "components/sync_driver/change_processor.h" |
14 #include "components/sync_driver/data_type_controller.h" | 14 #include "components/sync_driver/data_type_controller.h" |
15 #include "components/sync_driver/data_type_error_handler.h" | 15 #include "components/sync_driver/data_type_error_handler.h" |
16 #include "sync/api/attachments/attachment_store.h" | |
16 #include "sync/api/sync_change_processor.h" | 17 #include "sync/api/sync_change_processor.h" |
17 #include "sync/api/sync_merge_result.h" | 18 #include "sync/api/sync_merge_result.h" |
18 #include "sync/internal_api/public/attachments/attachment_service.h" | 19 #include "sync/internal_api/public/attachments/attachment_service.h" |
19 #include "sync/internal_api/public/attachments/attachment_service_proxy.h" | 20 #include "sync/internal_api/public/attachments/attachment_service_proxy.h" |
20 | 21 |
21 namespace syncer { | 22 namespace syncer { |
22 class SyncData; | 23 class SyncData; |
23 class SyncableService; | 24 class SyncableService; |
24 class WriteNode; | 25 class WriteNode; |
25 class WriteTransaction; | 26 class WriteTransaction; |
(...skipping 16 matching lines...) Expand all Loading... | |
42 public syncer::SyncChangeProcessor, | 43 public syncer::SyncChangeProcessor, |
43 public syncer::AttachmentService::Delegate, | 44 public syncer::AttachmentService::Delegate, |
44 public base::NonThreadSafe { | 45 public base::NonThreadSafe { |
45 public: | 46 public: |
46 // Create a change processor and connect it to the syncer. | 47 // Create a change processor and connect it to the syncer. |
47 GenericChangeProcessor( | 48 GenericChangeProcessor( |
48 DataTypeErrorHandler* error_handler, | 49 DataTypeErrorHandler* error_handler, |
49 const base::WeakPtr<syncer::SyncableService>& local_service, | 50 const base::WeakPtr<syncer::SyncableService>& local_service, |
50 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, | 51 const base::WeakPtr<syncer::SyncMergeResult>& merge_result, |
51 syncer::UserShare* user_share, | 52 syncer::UserShare* user_share, |
52 SyncApiComponentFactory* sync_factory); | 53 SyncApiComponentFactory* sync_factory, |
54 const scoped_refptr<syncer::AttachmentStore>& attachment_store); | |
maniscalco
2014/09/08 21:56:35
nit: Document that attachment_store can be null.
pavely
2014/09/09 23:52:30
Done.
| |
53 virtual ~GenericChangeProcessor(); | 55 virtual ~GenericChangeProcessor(); |
54 | 56 |
55 // ChangeProcessor interface. | 57 // ChangeProcessor interface. |
56 // Build and store a list of all changes into |syncer_changes_|. | 58 // Build and store a list of all changes into |syncer_changes_|. |
57 virtual void ApplyChangesFromSyncModel( | 59 virtual void ApplyChangesFromSyncModel( |
58 const syncer::BaseTransaction* trans, | 60 const syncer::BaseTransaction* trans, |
59 int64 version, | 61 int64 version, |
60 const syncer::ImmutableChangeRecordList& changes) OVERRIDE; | 62 const syncer::ImmutableChangeRecordList& changes) OVERRIDE; |
61 // Passes |syncer_changes_|, built in ApplyChangesFromSyncModel, onto | 63 // Passes |syncer_changes_|, built in ApplyChangesFromSyncModel, onto |
62 // |local_service_| by way of its ProcessSyncChanges method. | 64 // |local_service_| by way of its ProcessSyncChanges method. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 // Set in ApplyChangesFromSyncModel, consumed in CommitChangesFromSyncModel. | 143 // Set in ApplyChangesFromSyncModel, consumed in CommitChangesFromSyncModel. |
142 syncer::SyncChangeList syncer_changes_; | 144 syncer::SyncChangeList syncer_changes_; |
143 | 145 |
144 // Our handle to the sync model. Unlike normal ChangeProcessors, we need to | 146 // Our handle to the sync model. Unlike normal ChangeProcessors, we need to |
145 // be able to access the sync model before the change processor begins | 147 // be able to access the sync model before the change processor begins |
146 // listening to changes (the local_service_ will be interacting with us | 148 // listening to changes (the local_service_ will be interacting with us |
147 // when it starts up). As such we can't wait until Start(_) has been called, | 149 // when it starts up). As such we can't wait until Start(_) has been called, |
148 // and have to keep a local pointer to the user_share. | 150 // and have to keep a local pointer to the user_share. |
149 syncer::UserShare* const share_handle_; | 151 syncer::UserShare* const share_handle_; |
150 | 152 |
151 scoped_ptr<syncer::AttachmentService> attachment_service_; | 153 scoped_ptr<syncer::AttachmentService> attachment_service_; |
maniscalco
2014/09/08 21:56:35
Can you note that attaachment_service_ may be null
pavely
2014/09/09 23:52:30
Done.
| |
152 // Must be destroyed before attachment_service_ to ensure WeakPtrs are | 154 // Must be destroyed before attachment_service_ to ensure WeakPtrs are |
153 // invalidated before attachment_service_ is destroyed. | 155 // invalidated before attachment_service_ is destroyed. |
154 base::WeakPtrFactory<syncer::AttachmentService> | 156 scoped_ptr<base::WeakPtrFactory<syncer::AttachmentService> > |
maniscalco
2014/09/08 21:56:35
It's probably worth noting that attachment_service
pavely
2014/09/09 23:52:30
Done.
| |
155 attachment_service_weak_ptr_factory_; | 157 attachment_service_weak_ptr_factory_; |
156 syncer::AttachmentServiceProxy attachment_service_proxy_; | 158 scoped_ptr<syncer::AttachmentServiceProxy> attachment_service_proxy_; |
157 | 159 |
158 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); | 160 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); |
159 }; | 161 }; |
160 | 162 |
161 } // namespace sync_driver | 163 } // namespace sync_driver |
162 | 164 |
163 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ | 165 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ |
OLD | NEW |