Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(732)

Unified Diff: components/sync/driver/generic_change_processor.h

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync/driver/generic_change_processor.h
diff --git a/components/sync/driver/generic_change_processor.h b/components/sync/driver/generic_change_processor.h
index 736693e60dd68703fb4ba8a400bc96fc31aa1dd2..18ba548ce4b0637a6d7bbcfe15009a67998063da 100644
--- a/components/sync/driver/generic_change_processor.h
+++ b/components/sync/driver/generic_change_processor.h
@@ -24,19 +24,22 @@
#include "components/sync/driver/change_processor.h"
namespace syncer {
-
-class SyncApiComponentFactory;
-class SyncClient;
class SyncData;
class SyncableService;
class WriteNode;
class WriteTransaction;
+typedef std::vector<syncer::SyncData> SyncDataList;
+
namespace syncable {
class Entry;
} // namespace syncable
+} // namespace syncer
-typedef std::vector<SyncData> SyncDataList;
+namespace sync_driver {
+
+class SyncApiComponentFactory;
+class SyncClient;
// Datatype agnostic change processor. One instance of GenericChangeProcessor
// is created for each datatype and lives on the datatype's thread. It then
@@ -47,50 +50,53 @@ typedef std::vector<SyncData> SyncDataList;
// 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 AttachmentService::Delegate,
+ public syncer::SyncChangeProcessor,
+ public syncer::AttachmentService::Delegate,
public base::NonThreadSafe {
public:
// Create a change processor for |type| and connect it to the syncer.
// |attachment_store| can be NULL which means that datatype will not use sync
// attachments.
GenericChangeProcessor(
- ModelType type,
- std::unique_ptr<DataTypeErrorHandler> error_handler,
- const base::WeakPtr<SyncableService>& local_service,
- const base::WeakPtr<SyncMergeResult>& merge_result,
- UserShare* user_share,
+ syncer::ModelType type,
+ std::unique_ptr<syncer::DataTypeErrorHandler> error_handler,
+ const base::WeakPtr<syncer::SyncableService>& local_service,
+ const base::WeakPtr<syncer::SyncMergeResult>& merge_result,
+ syncer::UserShare* user_share,
SyncClient* sync_client,
- std::unique_ptr<AttachmentStoreForSync> attachment_store);
+ std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store);
~GenericChangeProcessor() override;
// ChangeProcessor interface.
// Build and store a list of all changes into |syncer_changes_|.
void ApplyChangesFromSyncModel(
- const BaseTransaction* trans,
+ const syncer::BaseTransaction* trans,
int64_t version,
- const ImmutableChangeRecordList& changes) override;
+ const syncer::ImmutableChangeRecordList& changes) override;
// Passes |syncer_changes_|, built in ApplyChangesFromSyncModel, onto
// |local_service_| by way of its ProcessSyncChanges method.
void CommitChangesFromSyncModel() override;
- // SyncChangeProcessor implementation.
- SyncError ProcessSyncChanges(const tracked_objects::Location& from_here,
- const SyncChangeList& change_list) override;
- SyncDataList GetAllSyncData(ModelType type) const override;
- SyncError UpdateDataTypeContext(
- ModelType type,
- SyncChangeProcessor::ContextRefreshStatus refresh_status,
+ // syncer::SyncChangeProcessor implementation.
+ syncer::SyncError ProcessSyncChanges(
+ const tracked_objects::Location& from_here,
+ const syncer::SyncChangeList& change_list) override;
+ syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override;
+ syncer::SyncError UpdateDataTypeContext(
+ syncer::ModelType type,
+ syncer::SyncChangeProcessor::ContextRefreshStatus refresh_status,
const std::string& context) override;
- void AddLocalChangeObserver(LocalChangeObserver* observer) override;
- void RemoveLocalChangeObserver(LocalChangeObserver* observer) override;
+ void AddLocalChangeObserver(syncer::LocalChangeObserver* observer) override;
+ void RemoveLocalChangeObserver(
+ syncer::LocalChangeObserver* observer) override;
- // AttachmentService::Delegate implementation.
- void OnAttachmentUploaded(const AttachmentId& attachment_id) override;
+ // syncer::AttachmentService::Delegate implementation.
+ void OnAttachmentUploaded(const syncer::AttachmentId& attachment_id) override;
// Similar to above, but returns a SyncError for use by direct clients
// of GenericChangeProcessor that may need more error visibility.
- virtual SyncError GetAllSyncDataReturnError(SyncDataList* data) const;
+ virtual syncer::SyncError GetAllSyncDataReturnError(
+ syncer::SyncDataList* data) const;
// If a datatype context associated with this GenericChangeProcessor's type
// exists, fills |context| and returns true. Otheriwse, if there has not been
@@ -101,43 +107,44 @@ class GenericChangeProcessor : public ChangeProcessor,
virtual int GetSyncCount();
// Generic versions of AssociatorInterface methods. Called by
- // SyncableServiceAdapter or the DataTypeController.
+ // syncer::SyncableServiceAdapter or the DataTypeController.
virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes);
virtual bool CryptoReadyIfNecessary();
// Gets AttachmentService proxy for datatype.
- std::unique_ptr<AttachmentService> GetAttachmentService() const;
+ std::unique_ptr<syncer::AttachmentService> GetAttachmentService() const;
protected:
// ChangeProcessor interface.
void StartImpl() override; // Does nothing.
- UserShare* share_handle() const override;
+ syncer::UserShare* share_handle() const override;
private:
- SyncError AttemptDelete(const SyncChange& change,
- ModelType type,
- const std::string& type_str,
- WriteNode* node,
- DataTypeErrorHandler* error_handler);
+ syncer::SyncError AttemptDelete(const syncer::SyncChange& change,
+ syncer::ModelType type,
+ const std::string& type_str,
+ syncer::WriteNode* node,
+ syncer::DataTypeErrorHandler* error_handler);
// Logically part of ProcessSyncChanges.
//
// |new_attachments| is an output parameter containing newly added attachments
// that need to be stored. This method will append to it.
- SyncError HandleActionAdd(const SyncChange& change,
- const std::string& type_str,
- const WriteTransaction& trans,
- WriteNode* sync_node,
- AttachmentIdSet* new_attachments);
+ syncer::SyncError HandleActionAdd(const syncer::SyncChange& change,
+ const std::string& type_str,
+ const syncer::WriteTransaction& trans,
+ syncer::WriteNode* sync_node,
+ syncer::AttachmentIdSet* new_attachments);
// Logically part of ProcessSyncChanges.
//
// |new_attachments| is an output parameter containing newly added attachments
// that need to be stored. This method will append to it.
- SyncError HandleActionUpdate(const SyncChange& change,
- const std::string& type_str,
- const WriteTransaction& trans,
- WriteNode* sync_node,
- AttachmentIdSet* new_attachments);
+ syncer::SyncError HandleActionUpdate(
+ const syncer::SyncChange& change,
+ const std::string& type_str,
+ const syncer::WriteTransaction& trans,
+ syncer::WriteNode* sync_node,
+ syncer::AttachmentIdSet* new_attachments);
// Begin uploading attachments that have not yet been uploaded to the sync
// server.
@@ -145,51 +152,51 @@ class GenericChangeProcessor : public ChangeProcessor,
// Notify every registered local change observer that |change| is about to be
// applied to |current_entry|.
- void NotifyLocalChangeObservers(const syncable::Entry* current_entry,
- const SyncChange& change);
+ void NotifyLocalChangeObservers(const syncer::syncable::Entry* current_entry,
+ const syncer::SyncChange& change);
- const ModelType type_;
+ const syncer::ModelType type_;
// The SyncableService this change processor will forward changes on to.
- const base::WeakPtr<SyncableService> local_service_;
+ const base::WeakPtr<syncer::SyncableService> local_service_;
// A SyncMergeResult used to track the changes made during association. The
// owner will invalidate the weak pointer when association is complete. While
// the pointer is valid though, we increment it with any changes received
// via ProcessSyncChanges.
- const base::WeakPtr<SyncMergeResult> merge_result_;
+ const base::WeakPtr<syncer::SyncMergeResult> merge_result_;
// The current list of changes received from the syncer. We buffer because
// we must ensure no syncapi transaction is held when we pass it on to
// |local_service_|.
// Set in ApplyChangesFromSyncModel, consumed in CommitChangesFromSyncModel.
- SyncChangeList syncer_changes_;
+ syncer::SyncChangeList syncer_changes_;
// Our handle to the sync model. Unlike normal ChangeProcessors, we need to
// be able to access the sync model before the change processor begins
// 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.
- UserShare* const share_handle_;
+ syncer::UserShare* const share_handle_;
// AttachmentService for datatype. Can be NULL if datatype doesn't use
// attachments.
- std::unique_ptr<AttachmentService> attachment_service_;
+ std::unique_ptr<syncer::AttachmentService> attachment_service_;
// List of observers that want to be notified of local changes being written.
- base::ObserverList<LocalChangeObserver> local_change_observers_;
+ base::ObserverList<syncer::LocalChangeObserver> local_change_observers_;
// Must be destroyed before attachment_service_ to ensure WeakPtrs are
// invalidated before attachment_service_ is destroyed.
// Can be NULL if attachment_service_ is NULL;
- std::unique_ptr<base::WeakPtrFactory<AttachmentService>>
+ std::unique_ptr<base::WeakPtrFactory<syncer::AttachmentService>>
attachment_service_weak_ptr_factory_;
- AttachmentServiceProxy attachment_service_proxy_;
+ syncer::AttachmentServiceProxy attachment_service_proxy_;
base::WeakPtrFactory<GenericChangeProcessor> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor);
};
-} // namespace syncer
+} // namespace sync_driver
#endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_
« no previous file with comments | « components/sync/driver/frontend_data_type_controller_unittest.cc ('k') | components/sync/driver/generic_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698