OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ | 6 #define COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_H_ |
7 | 7 |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "components/sync_driver/data_type_error_handler.h" | 13 #include "components/sync_driver/data_type_error_handler.h" |
14 #include "sync/api/sync_change_processor.h" | 14 #include "sync/api/sync_change_processor.h" |
15 #include "sync/api/sync_data.h" | 15 #include "sync/api/sync_data.h" |
16 #include "sync/api/sync_error.h" | 16 #include "sync/api/sync_error.h" |
17 #include "sync/api/sync_error_factory.h" | 17 #include "sync/api/sync_error_factory.h" |
18 #include "sync/api/sync_merge_result.h" | 18 #include "sync/api/sync_merge_result.h" |
19 #include "sync/internal_api/public/engine/model_safe_worker.h" | 19 #include "sync/internal_api/public/engine/model_safe_worker.h" |
20 | 20 |
21 class ProfileSyncService; | |
22 | |
23 namespace syncer { | 21 namespace syncer { |
24 class SyncableService; | 22 class SyncableService; |
25 struct UserShare; | 23 struct UserShare; |
26 } // namespace syncer | 24 } // namespace syncer |
27 | 25 |
28 namespace browser_sync { | 26 namespace browser_sync { |
29 | 27 |
30 class ChangeProcessor; | 28 class ChangeProcessor; |
31 class GenericChangeProcessor; | 29 class GenericChangeProcessor; |
32 class GenericChangeProcessorFactory; | 30 class GenericChangeProcessorFactory; |
(...skipping 27 matching lines...) Expand all Loading... |
60 // create and store a new GenericChangeProcessor and return a weak pointer to | 58 // create and store a new GenericChangeProcessor and return a weak pointer to |
61 // the syncer::SyncableService associated with |type|. | 59 // the syncer::SyncableService associated with |type|. |
62 // Note: If this SharedChangeProcessor has been disconnected, or the | 60 // Note: If this SharedChangeProcessor has been disconnected, or the |
63 // syncer::SyncableService was not alive, will return a null weak pointer. | 61 // syncer::SyncableService was not alive, will return a null weak pointer. |
64 virtual base::WeakPtr<syncer::SyncableService> Connect( | 62 virtual base::WeakPtr<syncer::SyncableService> Connect( |
65 browser_sync::SyncApiComponentFactory* sync_factory, | 63 browser_sync::SyncApiComponentFactory* sync_factory, |
66 GenericChangeProcessorFactory* processor_factory, | 64 GenericChangeProcessorFactory* processor_factory, |
67 syncer::UserShare* user_share, | 65 syncer::UserShare* user_share, |
68 DataTypeErrorHandler* error_handler, | 66 DataTypeErrorHandler* error_handler, |
69 syncer::ModelType type, | 67 syncer::ModelType type, |
70 const base::WeakPtr<syncer::SyncMergeResult>& merge_result); | 68 const base::WeakPtr<syncer::SyncMergeResult>& merge_result); |
71 | 69 |
72 // Disconnects from the generic change processor. May be called from any | 70 // Disconnects from the generic change processor. May be called from any |
73 // thread. After this, all attempts to interact with the change processor by | 71 // thread. After this, all attempts to interact with the change processor by |
74 // |local_service_| are dropped and return errors. The syncer will be safe to | 72 // |local_service_| are dropped and return errors. The syncer will be safe to |
75 // shut down from the point of view of this datatype. | 73 // shut down from the point of view of this datatype. |
76 // Note: Once disconnected, you cannot reconnect without creating a new | 74 // Note: Once disconnected, you cannot reconnect without creating a new |
77 // SharedChangeProcessor. | 75 // SharedChangeProcessor. |
78 // Returns: true if we were previously succesfully connected, false if we were | 76 // Returns: true if we were previously succesfully connected, false if we were |
79 // already disconnected. | 77 // already disconnected. |
80 virtual bool Disconnect(); | 78 virtual bool Disconnect(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // Used only on |backend_loop_|. | 132 // Used only on |backend_loop_|. |
135 GenericChangeProcessor* generic_change_processor_; | 133 GenericChangeProcessor* generic_change_processor_; |
136 | 134 |
137 DataTypeErrorHandler* error_handler_; | 135 DataTypeErrorHandler* error_handler_; |
138 | 136 |
139 DISALLOW_COPY_AND_ASSIGN(SharedChangeProcessor); | 137 DISALLOW_COPY_AND_ASSIGN(SharedChangeProcessor); |
140 }; | 138 }; |
141 | 139 |
142 } // namespace browser_sync | 140 } // namespace browser_sync |
143 | 141 |
144 #endif // CHROME_BROWSER_SYNC_GLUE_SHARED_CHANGE_PROCESSOR_H_ | 142 #endif // COMPONENTS_SYNC_DRIVER_SHARED_CHANGE_PROCESSOR_H_ |
OLD | NEW |