Index: chrome/browser/sync/glue/generic_change_processor.h |
diff --git a/chrome/browser/sync/glue/generic_change_processor.h b/chrome/browser/sync/glue/generic_change_processor.h |
index 1afe628c87340e2c320d1df0b6e9c0bb0edd5979..b43f00e16cd7412a83f1d36f5160fa5fcef425b2 100644 |
--- a/chrome/browser/sync/glue/generic_change_processor.h |
+++ b/chrome/browser/sync/glue/generic_change_processor.h |
@@ -9,6 +9,7 @@ |
#include <vector> |
#include "base/compiler_specific.h" |
+#include "base/threading/non_thread_safe.h" |
#include "chrome/browser/sync/api/sync_change_processor.h" |
#include "chrome/browser/sync/glue/change_processor.h" |
@@ -26,13 +27,18 @@ namespace browser_sync { |
// handles all interaction with the sync api, both translating pushes from the |
// local service into transactions and receiving changes from the sync model, |
// which then get converted into SyncChange's and sent to the local service. |
+// |
+// As a rule, the GenericChangeProcessor is not thread safe, and should only |
+// be used on the same thread in which it was created. |
class GenericChangeProcessor : public ChangeProcessor, |
- public SyncChangeProcessor { |
+ public SyncChangeProcessor, |
+ public base::NonThreadSafe { |
public: |
- GenericChangeProcessor(SyncableService* local_service, |
- UnrecoverableErrorHandler* error_handler, |
+ // Create a change processor and connect it to the syncer. |
+ GenericChangeProcessor(UnrecoverableErrorHandler* error_handler, |
+ SyncableService* local_service, |
sync_api::UserShare* user_share); |
- virtual ~GenericChangeProcessor(); |
+ virtual ~GenericChangeProcessor() OVERRIDE; |
// ChangeProcessor interface. |
// Build and store a list of all changes into |syncer_changes_|. |
@@ -53,15 +59,24 @@ class GenericChangeProcessor : public ChangeProcessor, |
SyncDataList* current_sync_data); |
// Generic versions of AssociatorInterface methods. Called by |
- // SyncableServiceAdapter. |
- bool SyncModelHasUserCreatedNodes(syncable::ModelType type, |
- bool* has_nodes); |
- bool CryptoReadyIfNecessary(syncable::ModelType type); |
+ // SyncableServiceAdapter or the DataTypeController. |
+ virtual bool SyncModelHasUserCreatedNodes(syncable::ModelType type, |
+ bool* has_nodes); |
+ virtual bool CryptoReadyIfNecessary(syncable::ModelType type); |
+ |
protected: |
+ // Create an uninitialized change processor. |
+ explicit GenericChangeProcessor(UnrecoverableErrorHandler* error_handler); |
+ |
+ virtual void set_local_service(SyncableService* local_service); |
+ virtual SyncableService* local_service() const; |
+ virtual void set_share_handle(sync_api::UserShare* user_share); |
+ |
// ChangeProcessor interface. |
- virtual void StartImpl(Profile* profile) OVERRIDE; // Not implemented. |
- virtual void StopImpl() OVERRIDE; // Not implemented. |
- virtual sync_api::UserShare* share_handle() OVERRIDE; |
+ virtual void StartImpl(Profile* profile) OVERRIDE; // Does nothing. |
+ virtual void StopImpl() OVERRIDE; // Does nothing. |
+ virtual sync_api::UserShare* share_handle() const OVERRIDE; |
+ |
private: |
// The SyncableService this change processor will forward changes on to. |
SyncableService* local_service_; |
@@ -77,7 +92,9 @@ class GenericChangeProcessor : public ChangeProcessor, |
// listening to changes (the local_service_ will be interacting with us |
// when it starts up). As such we can't wait until Start(_) has been called, |
// and have to keep a local pointer to the user_share. |
- sync_api::UserShare* user_share_; |
+ sync_api::UserShare* share_handle_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); |
}; |
} // namespace browser_sync |