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

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

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. 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 18ba548ce4b0637a6d7bbcfe15009a67998063da..736693e60dd68703fb4ba8a400bc96fc31aa1dd2 100644
--- a/components/sync/driver/generic_change_processor.h
+++ b/components/sync/driver/generic_change_processor.h
@@ -24,22 +24,19 @@
#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
-namespace sync_driver {
-
-class SyncApiComponentFactory;
-class SyncClient;
+typedef std::vector<SyncData> SyncDataList;
// Datatype agnostic change processor. One instance of GenericChangeProcessor
// is created for each datatype and lives on the datatype's thread. It then
@@ -50,53 +47,50 @@ class SyncClient;
// 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 syncer::SyncChangeProcessor,
- public syncer::AttachmentService::Delegate,
+ public SyncChangeProcessor,
+ public 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(
- 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,
+ ModelType type,
+ std::unique_ptr<DataTypeErrorHandler> error_handler,
+ const base::WeakPtr<SyncableService>& local_service,
+ const base::WeakPtr<SyncMergeResult>& merge_result,
+ UserShare* user_share,
SyncClient* sync_client,
- std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store);
+ std::unique_ptr<AttachmentStoreForSync> attachment_store);
~GenericChangeProcessor() override;
// ChangeProcessor interface.
// Build and store a list of all changes into |syncer_changes_|.
void ApplyChangesFromSyncModel(
- const syncer::BaseTransaction* trans,
+ const BaseTransaction* trans,
int64_t version,
- const syncer::ImmutableChangeRecordList& changes) override;
+ const ImmutableChangeRecordList& changes) override;
// Passes |syncer_changes_|, built in ApplyChangesFromSyncModel, onto
// |local_service_| by way of its ProcessSyncChanges method.
void CommitChangesFromSyncModel() override;
- // 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,
+ // 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,
const std::string& context) override;
- void AddLocalChangeObserver(syncer::LocalChangeObserver* observer) override;
- void RemoveLocalChangeObserver(
- syncer::LocalChangeObserver* observer) override;
+ void AddLocalChangeObserver(LocalChangeObserver* observer) override;
+ void RemoveLocalChangeObserver(LocalChangeObserver* observer) override;
- // syncer::AttachmentService::Delegate implementation.
- void OnAttachmentUploaded(const syncer::AttachmentId& attachment_id) override;
+ // AttachmentService::Delegate implementation.
+ void OnAttachmentUploaded(const 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 syncer::SyncError GetAllSyncDataReturnError(
- syncer::SyncDataList* data) const;
+ virtual SyncError GetAllSyncDataReturnError(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
@@ -107,44 +101,43 @@ class GenericChangeProcessor : public ChangeProcessor,
virtual int GetSyncCount();
// Generic versions of AssociatorInterface methods. Called by
- // syncer::SyncableServiceAdapter or the DataTypeController.
+ // SyncableServiceAdapter or the DataTypeController.
virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes);
virtual bool CryptoReadyIfNecessary();
// Gets AttachmentService proxy for datatype.
- std::unique_ptr<syncer::AttachmentService> GetAttachmentService() const;
+ std::unique_ptr<AttachmentService> GetAttachmentService() const;
protected:
// ChangeProcessor interface.
void StartImpl() override; // Does nothing.
- syncer::UserShare* share_handle() const override;
+ UserShare* share_handle() const override;
private:
- syncer::SyncError AttemptDelete(const syncer::SyncChange& change,
- syncer::ModelType type,
- const std::string& type_str,
- syncer::WriteNode* node,
- syncer::DataTypeErrorHandler* error_handler);
+ SyncError AttemptDelete(const SyncChange& change,
+ ModelType type,
+ const std::string& type_str,
+ WriteNode* node,
+ 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.
- syncer::SyncError HandleActionAdd(const syncer::SyncChange& change,
- const std::string& type_str,
- const syncer::WriteTransaction& trans,
- syncer::WriteNode* sync_node,
- syncer::AttachmentIdSet* new_attachments);
+ SyncError HandleActionAdd(const SyncChange& change,
+ const std::string& type_str,
+ const WriteTransaction& trans,
+ WriteNode* sync_node,
+ 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.
- syncer::SyncError HandleActionUpdate(
- const syncer::SyncChange& change,
- const std::string& type_str,
- const syncer::WriteTransaction& trans,
- syncer::WriteNode* sync_node,
- syncer::AttachmentIdSet* new_attachments);
+ SyncError HandleActionUpdate(const SyncChange& change,
+ const std::string& type_str,
+ const WriteTransaction& trans,
+ WriteNode* sync_node,
+ AttachmentIdSet* new_attachments);
// Begin uploading attachments that have not yet been uploaded to the sync
// server.
@@ -152,51 +145,51 @@ class GenericChangeProcessor : public ChangeProcessor,
// Notify every registered local change observer that |change| is about to be
// applied to |current_entry|.
- void NotifyLocalChangeObservers(const syncer::syncable::Entry* current_entry,
- const syncer::SyncChange& change);
+ void NotifyLocalChangeObservers(const syncable::Entry* current_entry,
+ const SyncChange& change);
- const syncer::ModelType type_;
+ const ModelType type_;
// The SyncableService this change processor will forward changes on to.
- const base::WeakPtr<syncer::SyncableService> local_service_;
+ const base::WeakPtr<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<syncer::SyncMergeResult> merge_result_;
+ const base::WeakPtr<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.
- syncer::SyncChangeList syncer_changes_;
+ 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.
- syncer::UserShare* const share_handle_;
+ UserShare* const share_handle_;
// AttachmentService for datatype. Can be NULL if datatype doesn't use
// attachments.
- std::unique_ptr<syncer::AttachmentService> attachment_service_;
+ std::unique_ptr<AttachmentService> attachment_service_;
// List of observers that want to be notified of local changes being written.
- base::ObserverList<syncer::LocalChangeObserver> local_change_observers_;
+ base::ObserverList<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<syncer::AttachmentService>>
+ std::unique_ptr<base::WeakPtrFactory<AttachmentService>>
attachment_service_weak_ptr_factory_;
- syncer::AttachmentServiceProxy attachment_service_proxy_;
+ AttachmentServiceProxy attachment_service_proxy_;
base::WeakPtrFactory<GenericChangeProcessor> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor);
};
-} // namespace sync_driver
+} // namespace syncer
#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