diff options
author | maxbogue <maxbogue@chromium.org> | 2015-09-01 13:47:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-01 20:47:48 +0000 |
commit | d9fcd084489bbb53d8f59926d74ba3e46d7482d8 (patch) | |
tree | 73b4301006bd73dc0eb671de8aa7ad39f69e677e | |
parent | ae8040a4b7db5ef6a8820d4694695943ec4d572e (diff) | |
download | chromium_src-d9fcd084489bbb53d8f59926d74ba3e46d7482d8.zip chromium_src-d9fcd084489bbb53d8f59926d74ba3e46d7482d8.tar.gz chromium_src-d9fcd084489bbb53d8f59926d74ba3e46d7482d8.tar.bz2 |
[Sync] Rename ModelTypeSyncProxyImpl to ModelTypeProcessorImpl.
BUG=522308
Review URL: https://codereview.chromium.org/1310663006
Cr-Commit-Position: refs/heads/master@{#346728}
26 files changed, 161 insertions, 161 deletions
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 27a0ea3..1fd4b36 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -459,9 +459,9 @@ void ProfileSyncService::RegisterNonBlockingType(syncer::ModelType type) { void ProfileSyncService::InitializeNonBlockingType( syncer::ModelType type, const scoped_refptr<base::SequencedTaskRunner>& task_runner, - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& type_sync_proxy) { + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& type_processor) { non_blocking_data_type_manager_.InitializeType( - type, task_runner, type_sync_proxy); + type, task_runner, type_processor); } bool ProfileSyncService::IsDataTypeControllerRunning( diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index b57387a..3a24ff1 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -350,7 +350,7 @@ class ProfileSyncService : public sync_driver::SyncService, void InitializeNonBlockingType( syncer::ModelType type, const scoped_refptr<base::SequencedTaskRunner>& task_runner, - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& proxy); + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& type_processor); // Returns the SyncedWindowDelegatesGetter from the embedded sessions manager. virtual browser_sync::SyncedWindowDelegatesGetter* diff --git a/components/sync_driver/non_blocking_data_type_controller.cc b/components/sync_driver/non_blocking_data_type_controller.cc index a8ca5c0..9b20d31 100644 --- a/components/sync_driver/non_blocking_data_type_controller.cc +++ b/components/sync_driver/non_blocking_data_type_controller.cc @@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" -#include "sync/engine/model_type_sync_proxy_impl.h" +#include "sync/engine/model_type_processor_impl.h" namespace sync_driver_v2 { @@ -21,10 +21,10 @@ NonBlockingDataTypeController::~NonBlockingDataTypeController() {} void NonBlockingDataTypeController::InitializeType( const scoped_refptr<base::SequencedTaskRunner>& task_runner, - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& type_sync_proxy) { + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& type_processor) { DCHECK(!IsSyncProxyConnected()); task_runner_ = task_runner; - type_sync_proxy_ = type_sync_proxy; + type_processor_ = type_processor; DCHECK(IsSyncProxyConnected()); UpdateState(); @@ -86,7 +86,7 @@ void NonBlockingDataTypeController::SendEnableSignal() { task_runner_->PostTask( FROM_HERE, - base::Bind(&syncer_v2::ModelTypeSyncProxyImpl::Enable, type_sync_proxy_, + base::Bind(&syncer_v2::ModelTypeProcessorImpl::Enable, type_processor_, base::Passed(sync_context_proxy_->Clone()))); current_state_ = ENABLED; } @@ -95,8 +95,8 @@ void NonBlockingDataTypeController::SendDisableSignal() { DCHECK_EQ(DISABLED, GetDesiredState()); DVLOG(1) << "Disabling non-blocking sync type " << ModelTypeToString(type_); task_runner_->PostTask(FROM_HERE, - base::Bind(&syncer_v2::ModelTypeSyncProxyImpl::Disable, - type_sync_proxy_)); + base::Bind(&syncer_v2::ModelTypeProcessorImpl::Disable, + type_processor_)); current_state_ = DISABLED; } @@ -105,8 +105,8 @@ void NonBlockingDataTypeController::SendDisconnectSignal() { DVLOG(1) << "Disconnecting non-blocking sync type " << ModelTypeToString(type_); task_runner_->PostTask( - FROM_HERE, base::Bind(&syncer_v2::ModelTypeSyncProxyImpl::Disconnect, - type_sync_proxy_)); + FROM_HERE, base::Bind(&syncer_v2::ModelTypeProcessorImpl::Disconnect, + type_processor_)); current_state_ = DISCONNECTED; } diff --git a/components/sync_driver/non_blocking_data_type_controller.h b/components/sync_driver/non_blocking_data_type_controller.h index d3fa9de..cddf2af 100644 --- a/components/sync_driver/non_blocking_data_type_controller.h +++ b/components/sync_driver/non_blocking_data_type_controller.h @@ -63,7 +63,7 @@ class NonBlockingDataTypeController { // will only ever deal with a single type proxy. void InitializeType( const scoped_refptr<base::SequencedTaskRunner>& task_runner, - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& type_sync_proxy); + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& type_processor); // Initialize the connection to the SyncContextProxy. // @@ -87,19 +87,19 @@ class NonBlockingDataTypeController { // Figures out which signals need to be sent then send then sends them. void UpdateState(); - // Sends an enable signal to the ModelTypeSyncProxyImpl. + // Sends an enable signal to the ModelTypeProcessorImpl. void SendEnableSignal(); - // Sends a disable signal to the ModelTypeSyncProxyImpl. + // Sends a disable signal to the ModelTypeProcessorImpl. void SendDisableSignal(); - // Sends a disconnect signal to the ModelTypeSyncProxyImpl. + // Sends a disconnect signal to the ModelTypeProcessorImpl. void SendDisconnectSignal(); // Returns true if this type should be synced. bool IsPreferred() const; - // Returns true if this object has access to the ModelTypeSyncProxyImpl. + // Returns true if this object has access to the ModelTypeProcessorImpl. bool IsSyncProxyConnected() const; // Returns true if this object has access to the SyncContextProxy. @@ -123,9 +123,9 @@ class NonBlockingDataTypeController { // Whether or not the user wants to sync this type. bool is_preferred_; - // The ModelTypeSyncProxyImpl and its associated thread. May be NULL. + // The ModelTypeProcessorImpl and its associated thread. May be NULL. scoped_refptr<base::SequencedTaskRunner> task_runner_; - base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl> type_sync_proxy_; + base::WeakPtr<syncer_v2::ModelTypeProcessorImpl> type_processor_; // The SyncContextProxy that connects to the current sync backend. May be // NULL. diff --git a/components/sync_driver/non_blocking_data_type_controller_unittest.cc b/components/sync_driver/non_blocking_data_type_controller_unittest.cc index 9c2e170..02871ac 100644 --- a/components/sync_driver/non_blocking_data_type_controller_unittest.cc +++ b/components/sync_driver/non_blocking_data_type_controller_unittest.cc @@ -12,7 +12,7 @@ #include "base/test/test_simple_task_runner.h" #include "components/sync_driver/non_blocking_data_type_controller.h" #include "sync/engine/commit_queue.h" -#include "sync/engine/model_type_sync_proxy_impl.h" +#include "sync/engine/model_type_processor_impl.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/sync_context_proxy.h" #include "testing/gtest/include/gtest/gtest.h" @@ -47,11 +47,11 @@ class MockSyncContext { void Connect( syncer::ModelType type, const scoped_refptr<base::SingleThreadTaskRunner>& model_task_runner, - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& type_proxy) { + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& type_proxy) { enabled_types_.Put(type); model_task_runner->PostTask( FROM_HERE, - base::Bind(&syncer_v2::ModelTypeSyncProxyImpl::OnConnect, type_proxy, + base::Bind(&syncer_v2::ModelTypeProcessorImpl::OnConnect, type_proxy, base::Passed(scoped_ptr<syncer_v2::CommitQueue>( new NullCommitQueue()) .Pass()))); @@ -83,7 +83,7 @@ class MockSyncContextProxy : public syncer_v2::SyncContextProxy { syncer::ModelType type, const syncer_v2::DataTypeState& data_type_state, const syncer_v2::UpdateResponseDataList& saved_pending_updates, - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& type_proxy) + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& type_proxy) override { // Normally we'd use ThreadTaskRunnerHandle::Get() as the TaskRunner // argument @@ -182,7 +182,7 @@ class NonBlockingDataTypeControllerTest : public testing::Test { } protected: - syncer_v2::ModelTypeSyncProxyImpl type_sync_proxy_; + syncer_v2::ModelTypeProcessorImpl type_sync_proxy_; scoped_refptr<base::TestSimpleTaskRunner> model_thread_; scoped_refptr<base::TestSimpleTaskRunner> sync_thread_; diff --git a/components/sync_driver/non_blocking_data_type_manager.cc b/components/sync_driver/non_blocking_data_type_manager.cc index 5f64292..ac21b3d 100644 --- a/components/sync_driver/non_blocking_data_type_manager.cc +++ b/components/sync_driver/non_blocking_data_type_manager.cc @@ -6,7 +6,7 @@ #include "base/sequenced_task_runner.h" #include "components/sync_driver/non_blocking_data_type_controller.h" -#include "sync/engine/model_type_sync_proxy_impl.h" +#include "sync/engine/model_type_processor_impl.h" namespace sync_driver_v2 { @@ -29,11 +29,11 @@ void NonBlockingDataTypeManager::RegisterType( void NonBlockingDataTypeManager::InitializeType( syncer::ModelType type, const scoped_refptr<base::SequencedTaskRunner>& task_runner, - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& proxy_impl) { + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& type_processor) { NonBlockingDataTypeControllerMap::const_iterator it = non_blocking_data_type_controllers_.find(type); DCHECK(it != non_blocking_data_type_controllers_.end()); - it->second->InitializeType(task_runner, proxy_impl); + it->second->InitializeType(task_runner, type_processor); } void NonBlockingDataTypeManager::ConnectSyncBackend( diff --git a/components/sync_driver/non_blocking_data_type_manager.h b/components/sync_driver/non_blocking_data_type_manager.h index 844bdcc..f93fa00 100644 --- a/components/sync_driver/non_blocking_data_type_manager.h +++ b/components/sync_driver/non_blocking_data_type_manager.h @@ -16,7 +16,7 @@ class SequencedTaskRunner; } // namespace base namespace syncer_v2 { -class ModelTypeSyncProxyImpl; +class ModelTypeProcessorImpl; class SyncContextProxy; } // namespace syncer_v2 @@ -40,12 +40,12 @@ class NonBlockingDataTypeManager { // The |preferred| flag indicates whether or not this type should be synced. void RegisterType(syncer::ModelType type, bool preferred); - // Connects the ModelTypeSyncProxyImpl and associated model type + // Connects the ModelTypeProcessorImpl and associated model type // thread to its NonBlockingDataTypeController on the UI thread. void InitializeType( syncer::ModelType type, const scoped_refptr<base::SequencedTaskRunner>& task_runner, - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& type_sync_proxy); + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& type_processor); // Connects the sync backend, as represented by a SyncContextProxy, to the // NonBlockingDataTypeController on the UI thread. diff --git a/sync/BUILD.gn b/sync/BUILD.gn index 7ed323b..110f7c5 100644 --- a/sync/BUILD.gn +++ b/sync/BUILD.gn @@ -84,8 +84,8 @@ source_set("sync_core") { "engine/model_type_entity.h", "engine/model_type_processor.cc", "engine/model_type_processor.h", - "engine/model_type_sync_proxy_impl.cc", - "engine/model_type_sync_proxy_impl.h", + "engine/model_type_processor_impl.cc", + "engine/model_type_processor_impl.h", "engine/model_type_sync_worker_impl.cc", "engine/model_type_sync_worker_impl.h", "engine/net/server_connection_manager.cc", @@ -606,7 +606,7 @@ test("sync_unit_tests") { "engine/entity_tracker_unittest.cc", "engine/get_updates_processor_unittest.cc", "engine/model_type_entity_unittest.cc", - "engine/model_type_sync_proxy_impl_unittest.cc", + "engine/model_type_processor_impl_unittest.cc", "engine/model_type_sync_worker_impl_unittest.cc", "engine/sync_scheduler_unittest.cc", "engine/syncer_proto_util_unittest.cc", diff --git a/sync/engine/model_type_entity_unittest.cc b/sync/engine/model_type_entity_unittest.cc index 7a0438b..5f3e666 100644 --- a/sync/engine/model_type_entity_unittest.cc +++ b/sync/engine/model_type_entity_unittest.cc @@ -17,12 +17,12 @@ namespace syncer_v2 { // Some simple sanity tests for the ModelTypeEntity. // // A lot of the more complicated sync logic is implemented in the -// ModelTypeSyncProxyImpl that owns the ModelTypeEntity. We can't unit test it +// ModelTypeProcessorImpl that owns the ModelTypeEntity. We can't unit test it // here. // // Instead, we focus on simple tests to make sure that variables are getting // properly intialized and flags properly set. Anything more complicated would -// be a redundant and incomplete version of the ModelTypeSyncProxyImpl tests. +// be a redundant and incomplete version of the ModelTypeProcessorImpl tests. class ModelTypeEntityTest : public ::testing::Test { public: ModelTypeEntityTest() diff --git a/sync/engine/model_type_sync_proxy_impl.cc b/sync/engine/model_type_processor_impl.cc index 422da78..3afd428 100644 --- a/sync/engine/model_type_sync_proxy_impl.cc +++ b/sync/engine/model_type_processor_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "sync/engine/model_type_sync_proxy_impl.h" +#include "sync/engine/model_type_processor_impl.h" #include "base/bind.h" #include "base/location.h" @@ -13,32 +13,32 @@ namespace syncer_v2 { -ModelTypeSyncProxyImpl::ModelTypeSyncProxyImpl(syncer::ModelType type) +ModelTypeProcessorImpl::ModelTypeProcessorImpl(syncer::ModelType type) : type_(type), is_preferred_(false), is_connected_(false), weak_ptr_factory_for_ui_(this), weak_ptr_factory_for_sync_(this) {} -ModelTypeSyncProxyImpl::~ModelTypeSyncProxyImpl() { +ModelTypeProcessorImpl::~ModelTypeProcessorImpl() { } -bool ModelTypeSyncProxyImpl::IsPreferred() const { +bool ModelTypeProcessorImpl::IsPreferred() const { DCHECK(CalledOnValidThread()); return is_preferred_; } -bool ModelTypeSyncProxyImpl::IsConnected() const { +bool ModelTypeProcessorImpl::IsConnected() const { DCHECK(CalledOnValidThread()); return is_connected_; } -syncer::ModelType ModelTypeSyncProxyImpl::GetModelType() const { +syncer::ModelType ModelTypeProcessorImpl::GetModelType() const { DCHECK(CalledOnValidThread()); return type_; } -void ModelTypeSyncProxyImpl::Enable( +void ModelTypeProcessorImpl::Enable( scoped_ptr<SyncContextProxy> sync_context_proxy) { DCHECK(CalledOnValidThread()); DVLOG(1) << "Asked to enable " << ModelTypeToString(type_); @@ -58,7 +58,7 @@ void ModelTypeSyncProxyImpl::Enable( weak_ptr_factory_for_sync_.GetWeakPtr()); } -void ModelTypeSyncProxyImpl::Disable() { +void ModelTypeProcessorImpl::Disable() { DCHECK(CalledOnValidThread()); is_preferred_ = false; Disconnect(); @@ -66,7 +66,7 @@ void ModelTypeSyncProxyImpl::Disable() { ClearSyncState(); } -void ModelTypeSyncProxyImpl::Disconnect() { +void ModelTypeProcessorImpl::Disconnect() { DCHECK(CalledOnValidThread()); DVLOG(1) << "Asked to disconnect " << ModelTypeToString(type_); is_connected_ = false; @@ -82,12 +82,12 @@ void ModelTypeSyncProxyImpl::Disconnect() { ClearTransientSyncState(); } -base::WeakPtr<ModelTypeSyncProxyImpl> ModelTypeSyncProxyImpl::AsWeakPtrForUI() { +base::WeakPtr<ModelTypeProcessorImpl> ModelTypeProcessorImpl::AsWeakPtrForUI() { DCHECK(CalledOnValidThread()); return weak_ptr_factory_for_ui_.GetWeakPtr(); } -void ModelTypeSyncProxyImpl::OnConnect(scoped_ptr<CommitQueue> worker) { +void ModelTypeProcessorImpl::OnConnect(scoped_ptr<CommitQueue> worker) { DCHECK(CalledOnValidThread()); DVLOG(1) << "Successfully connected " << ModelTypeToString(type_); @@ -97,7 +97,7 @@ void ModelTypeSyncProxyImpl::OnConnect(scoped_ptr<CommitQueue> worker) { FlushPendingCommitRequests(); } -void ModelTypeSyncProxyImpl::Put(const std::string& client_tag, +void ModelTypeProcessorImpl::Put(const std::string& client_tag, const sync_pb::EntitySpecifics& specifics) { DCHECK_EQ(type_, syncer::GetModelTypeFromSpecifics(specifics)); @@ -117,7 +117,7 @@ void ModelTypeSyncProxyImpl::Put(const std::string& client_tag, FlushPendingCommitRequests(); } -void ModelTypeSyncProxyImpl::Delete(const std::string& client_tag) { +void ModelTypeProcessorImpl::Delete(const std::string& client_tag) { const std::string client_tag_hash( syncer::syncable::GenerateSyncableHash(type_, client_tag)); @@ -135,7 +135,7 @@ void ModelTypeSyncProxyImpl::Delete(const std::string& client_tag) { FlushPendingCommitRequests(); } -void ModelTypeSyncProxyImpl::FlushPendingCommitRequests() { +void ModelTypeProcessorImpl::FlushPendingCommitRequests() { CommitRequestDataList commit_requests; // Don't bother sending anything if there's no one to send to. @@ -161,7 +161,7 @@ void ModelTypeSyncProxyImpl::FlushPendingCommitRequests() { worker_->EnqueueForCommit(commit_requests); } -void ModelTypeSyncProxyImpl::OnCommitCompleted( +void ModelTypeProcessorImpl::OnCommitCompleted( const DataTypeState& type_state, const CommitResponseDataList& response_list) { data_type_state_ = type_state; @@ -185,7 +185,7 @@ void ModelTypeSyncProxyImpl::OnCommitCompleted( } } -void ModelTypeSyncProxyImpl::OnUpdateReceived( +void ModelTypeProcessorImpl::OnUpdateReceived( const DataTypeState& data_type_state, const UpdateResponseDataList& response_list, const UpdateResponseDataList& pending_updates) { @@ -275,7 +275,7 @@ void ModelTypeSyncProxyImpl::OnUpdateReceived( // TODO: Persist the new data on disk. } -UpdateResponseDataList ModelTypeSyncProxyImpl::GetPendingUpdates() { +UpdateResponseDataList ModelTypeProcessorImpl::GetPendingUpdates() { UpdateResponseDataList pending_updates_list; for (UpdateMap::const_iterator it = pending_updates_map_.begin(); it != pending_updates_map_.end(); @@ -285,14 +285,14 @@ UpdateResponseDataList ModelTypeSyncProxyImpl::GetPendingUpdates() { return pending_updates_list; } -void ModelTypeSyncProxyImpl::ClearTransientSyncState() { +void ModelTypeProcessorImpl::ClearTransientSyncState() { for (EntityMap::const_iterator it = entities_.begin(); it != entities_.end(); ++it) { it->second->ClearTransientSyncState(); } } -void ModelTypeSyncProxyImpl::ClearSyncState() { +void ModelTypeProcessorImpl::ClearSyncState() { for (EntityMap::const_iterator it = entities_.begin(); it != entities_.end(); ++it) { it->second->ClearSyncState(); diff --git a/sync/engine/model_type_sync_proxy_impl.h b/sync/engine/model_type_processor_impl.h index 110297c..aa11c33 100644 --- a/sync/engine/model_type_sync_proxy_impl.h +++ b/sync/engine/model_type_processor_impl.h @@ -22,10 +22,10 @@ class SyncContextProxy; // A sync component embedded on the synced type's thread that helps to handle // communication between sync and model type threads. // TODO(gangwu): 526617 Derive this class from ModelTypeProcessor -class SYNC_EXPORT_PRIVATE ModelTypeSyncProxyImpl : base::NonThreadSafe { +class SYNC_EXPORT_PRIVATE ModelTypeProcessorImpl : base::NonThreadSafe { public: - ModelTypeSyncProxyImpl(syncer::ModelType type); - virtual ~ModelTypeSyncProxyImpl(); + ModelTypeProcessorImpl(syncer::ModelType type); + virtual ~ModelTypeProcessorImpl(); // Returns true if this object believes that sync is preferred for this type. // @@ -87,7 +87,7 @@ class SYNC_EXPORT_PRIVATE ModelTypeSyncProxyImpl : base::NonThreadSafe { // Returns the long-lived WeakPtr that is intended to be registered with the // ProfileSyncService. - base::WeakPtr<ModelTypeSyncProxyImpl> AsWeakPtrForUI(); + base::WeakPtr<ModelTypeProcessorImpl> AsWeakPtrForUI(); private: typedef base::ScopedPtrMap<std::string, scoped_ptr<ModelTypeEntity>> @@ -145,8 +145,8 @@ class SYNC_EXPORT_PRIVATE ModelTypeSyncProxyImpl : base::NonThreadSafe { // thread, we want to make sure that no tasks generated as part of the // now-obsolete connection to affect us. But we also want the WeakPtr we // sent to the UI thread to remain valid. - base::WeakPtrFactory<ModelTypeSyncProxyImpl> weak_ptr_factory_for_ui_; - base::WeakPtrFactory<ModelTypeSyncProxyImpl> weak_ptr_factory_for_sync_; + base::WeakPtrFactory<ModelTypeProcessorImpl> weak_ptr_factory_for_ui_; + base::WeakPtrFactory<ModelTypeProcessorImpl> weak_ptr_factory_for_sync_; }; } // namespace syncer diff --git a/sync/engine/model_type_sync_proxy_impl_unittest.cc b/sync/engine/model_type_processor_impl_unittest.cc index fad53fe..2c019a7 100644 --- a/sync/engine/model_type_sync_proxy_impl_unittest.cc +++ b/sync/engine/model_type_processor_impl_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "sync/engine/model_type_sync_proxy_impl.h" +#include "sync/engine/model_type_processor_impl.h" #include "sync/engine/commit_queue.h" #include "sync/internal_api/public/base/model_type.h" @@ -18,9 +18,9 @@ namespace syncer_v2 { static const syncer::ModelType kModelType = syncer::PREFERENCES; -// Tests the sync engine parts of ModelTypeSyncProxyImpl. +// Tests the sync engine parts of ModelTypeProcessorImpl. // -// The ModelTypeSyncProxyImpl contains a non-trivial amount of code dedicated +// The ModelTypeProcessorImpl contains a non-trivial amount of code dedicated // to turning the sync engine on and off again. That code is fairly well // tested in the NonBlockingDataTypeController unit tests and it doesn't need // to be re-tested here. @@ -39,10 +39,10 @@ static const syncer::ModelType kModelType = syncer::PREFERENCES; // - Writes to permanent storage. (TODO) // - Callbacks into the model. (TODO) // - Requests to the sync thread. Tested with MockCommitQueue. -class ModelTypeSyncProxyImplTest : public ::testing::Test { +class ModelTypeProcessorImplTest : public ::testing::Test { public: - ModelTypeSyncProxyImplTest(); - ~ModelTypeSyncProxyImplTest() override; + ModelTypeProcessorImplTest(); + ~ModelTypeProcessorImplTest() override; // Initialize with no local state. The type sync proxy will be unable to // commit until it receives notification that initial sync has completed. @@ -51,10 +51,10 @@ class ModelTypeSyncProxyImplTest : public ::testing::Test { // Initialize to a "ready-to-commit" state. void InitializeToReadyState(); - // Disconnect the CommitQueue from our ModelTypeSyncProxyImpl. + // Disconnect the CommitQueue from our ModelTypeProcessorImpl. void Disconnect(); - // Disable sync for this ModelTypeSyncProxyImpl. Should cause sync state to + // Disable sync for this ModelTypeProcessorImpl. Should cause sync state to // be discarded. void Disable(); @@ -126,26 +126,26 @@ class ModelTypeSyncProxyImplTest : public ::testing::Test { MockCommitQueue* mock_queue_; scoped_ptr<InjectableSyncContextProxy> injectable_sync_context_proxy_; - scoped_ptr<ModelTypeSyncProxyImpl> type_sync_proxy_; + scoped_ptr<ModelTypeProcessorImpl> type_sync_proxy_; DataTypeState data_type_state_; }; -ModelTypeSyncProxyImplTest::ModelTypeSyncProxyImplTest() +ModelTypeProcessorImplTest::ModelTypeProcessorImplTest() : mock_queue_(new MockCommitQueue()), injectable_sync_context_proxy_( new InjectableSyncContextProxy(mock_queue_)), - type_sync_proxy_(new ModelTypeSyncProxyImpl(kModelType)) { + type_sync_proxy_(new ModelTypeProcessorImpl(kModelType)) { } -ModelTypeSyncProxyImplTest::~ModelTypeSyncProxyImplTest() { +ModelTypeProcessorImplTest::~ModelTypeProcessorImplTest() { } -void ModelTypeSyncProxyImplTest::FirstTimeInitialize() { +void ModelTypeProcessorImplTest::FirstTimeInitialize() { type_sync_proxy_->Enable(injectable_sync_context_proxy_->Clone()); } -void ModelTypeSyncProxyImplTest::InitializeToReadyState() { +void ModelTypeProcessorImplTest::InitializeToReadyState() { // TODO(rlarocque): This should be updated to inject on-disk state. // At the time this code was written, there was no support for on-disk // state so this was the only way to inject a data_type_state into @@ -154,19 +154,19 @@ void ModelTypeSyncProxyImplTest::InitializeToReadyState() { OnInitialSyncDone(); } -void ModelTypeSyncProxyImplTest::Disconnect() { +void ModelTypeProcessorImplTest::Disconnect() { type_sync_proxy_->Disconnect(); injectable_sync_context_proxy_.reset(); mock_queue_ = NULL; } -void ModelTypeSyncProxyImplTest::Disable() { +void ModelTypeProcessorImplTest::Disable() { type_sync_proxy_->Disable(); injectable_sync_context_proxy_.reset(); mock_queue_ = NULL; } -void ModelTypeSyncProxyImplTest::ReEnable() { +void ModelTypeProcessorImplTest::ReEnable() { DCHECK(!type_sync_proxy_->IsConnected()); // Prepare a new MockCommitQueue instance, just as we would @@ -179,17 +179,17 @@ void ModelTypeSyncProxyImplTest::ReEnable() { type_sync_proxy_->Enable(injectable_sync_context_proxy_->Clone()); } -void ModelTypeSyncProxyImplTest::WriteItem(const std::string& tag, +void ModelTypeProcessorImplTest::WriteItem(const std::string& tag, const std::string& value) { const std::string tag_hash = GenerateTagHash(tag); type_sync_proxy_->Put(tag, GenerateSpecifics(tag, value)); } -void ModelTypeSyncProxyImplTest::DeleteItem(const std::string& tag) { +void ModelTypeProcessorImplTest::DeleteItem(const std::string& tag) { type_sync_proxy_->Delete(tag); } -void ModelTypeSyncProxyImplTest::OnInitialSyncDone() { +void ModelTypeProcessorImplTest::OnInitialSyncDone() { data_type_state_.initial_sync_done = true; UpdateResponseDataList empty_update_list; @@ -197,7 +197,7 @@ void ModelTypeSyncProxyImplTest::OnInitialSyncDone() { data_type_state_, empty_update_list, empty_update_list); } -void ModelTypeSyncProxyImplTest::UpdateFromServer(int64 version_offset, +void ModelTypeProcessorImplTest::UpdateFromServer(int64 version_offset, const std::string& tag, const std::string& value) { const std::string tag_hash = GenerateTagHash(tag); @@ -210,7 +210,7 @@ void ModelTypeSyncProxyImplTest::UpdateFromServer(int64 version_offset, UpdateResponseDataList()); } -void ModelTypeSyncProxyImplTest::PendingUpdateFromServer( +void ModelTypeProcessorImplTest::PendingUpdateFromServer( int64 version_offset, const std::string& tag, const std::string& value, @@ -226,7 +226,7 @@ void ModelTypeSyncProxyImplTest::PendingUpdateFromServer( list); } -void ModelTypeSyncProxyImplTest::TombstoneFromServer(int64 version_offset, +void ModelTypeProcessorImplTest::TombstoneFromServer(int64 version_offset, const std::string& tag) { // Overwrite the existing server version if this is the new highest version. std::string tag_hash = GenerateTagHash(tag); @@ -240,7 +240,7 @@ void ModelTypeSyncProxyImplTest::TombstoneFromServer(int64 version_offset, UpdateResponseDataList()); } -bool ModelTypeSyncProxyImplTest::HasPendingUpdate( +bool ModelTypeProcessorImplTest::HasPendingUpdate( const std::string& tag) const { const std::string client_tag_hash = GenerateTagHash(tag); const UpdateResponseDataList list = type_sync_proxy_->GetPendingUpdates(); @@ -252,7 +252,7 @@ bool ModelTypeSyncProxyImplTest::HasPendingUpdate( return false; } -UpdateResponseData ModelTypeSyncProxyImplTest::GetPendingUpdate( +UpdateResponseData ModelTypeProcessorImplTest::GetPendingUpdate( const std::string& tag) const { DCHECK(HasPendingUpdate(tag)); const std::string client_tag_hash = GenerateTagHash(tag); @@ -266,35 +266,35 @@ UpdateResponseData ModelTypeSyncProxyImplTest::GetPendingUpdate( return UpdateResponseData(); } -size_t ModelTypeSyncProxyImplTest::GetNumPendingUpdates() const { +size_t ModelTypeProcessorImplTest::GetNumPendingUpdates() const { return type_sync_proxy_->GetPendingUpdates().size(); } -void ModelTypeSyncProxyImplTest::SuccessfulCommitResponse( +void ModelTypeProcessorImplTest::SuccessfulCommitResponse( const CommitRequestData& request_data) { CommitResponseDataList list; list.push_back(mock_queue_->SuccessfulCommitResponse(request_data)); type_sync_proxy_->OnCommitCompleted(data_type_state_, list); } -void ModelTypeSyncProxyImplTest::UpdateDesiredEncryptionKey( +void ModelTypeProcessorImplTest::UpdateDesiredEncryptionKey( const std::string& key_name) { data_type_state_.encryption_key_name = key_name; type_sync_proxy_->OnUpdateReceived(data_type_state_, UpdateResponseDataList(), UpdateResponseDataList()); } -void ModelTypeSyncProxyImplTest::SetServerEncryptionKey( +void ModelTypeProcessorImplTest::SetServerEncryptionKey( const std::string& key_name) { mock_queue_->SetServerEncryptionKey(key_name); } -std::string ModelTypeSyncProxyImplTest::GenerateTagHash( +std::string ModelTypeProcessorImplTest::GenerateTagHash( const std::string& tag) { return syncer::syncable::GenerateSyncableHash(kModelType, tag); } -sync_pb::EntitySpecifics ModelTypeSyncProxyImplTest::GenerateSpecifics( +sync_pb::EntitySpecifics ModelTypeProcessorImplTest::GenerateSpecifics( const std::string& tag, const std::string& value) { sync_pb::EntitySpecifics specifics; @@ -305,7 +305,7 @@ sync_pb::EntitySpecifics ModelTypeSyncProxyImplTest::GenerateSpecifics( // These tests never decrypt anything, so we can get away with faking the // encryption for now. -sync_pb::EntitySpecifics ModelTypeSyncProxyImplTest::GenerateEncryptedSpecifics( +sync_pb::EntitySpecifics ModelTypeProcessorImplTest::GenerateEncryptedSpecifics( const std::string& tag, const std::string& value, const std::string& key_name) { @@ -316,22 +316,22 @@ sync_pb::EntitySpecifics ModelTypeSyncProxyImplTest::GenerateEncryptedSpecifics( return specifics; } -size_t ModelTypeSyncProxyImplTest::GetNumCommitRequestLists() { +size_t ModelTypeProcessorImplTest::GetNumCommitRequestLists() { return mock_queue_->GetNumCommitRequestLists(); } -CommitRequestDataList ModelTypeSyncProxyImplTest::GetNthCommitRequestList( +CommitRequestDataList ModelTypeProcessorImplTest::GetNthCommitRequestList( size_t n) { return mock_queue_->GetNthCommitRequestList(n); } -bool ModelTypeSyncProxyImplTest::HasCommitRequestForTag( +bool ModelTypeProcessorImplTest::HasCommitRequestForTag( const std::string& tag) { const std::string tag_hash = GenerateTagHash(tag); return mock_queue_->HasCommitRequestForTagHash(tag_hash); } -CommitRequestData ModelTypeSyncProxyImplTest::GetLatestCommitRequestForTag( +CommitRequestData ModelTypeProcessorImplTest::GetLatestCommitRequestForTag( const std::string& tag) { const std::string tag_hash = GenerateTagHash(tag); return mock_queue_->GetLatestCommitRequestForTagHash(tag_hash); @@ -339,7 +339,7 @@ CommitRequestData ModelTypeSyncProxyImplTest::GetLatestCommitRequestForTag( // Creates a new item locally. // Thoroughly tests the data generated by a local item creation. -TEST_F(ModelTypeSyncProxyImplTest, CreateLocalItem) { +TEST_F(ModelTypeProcessorImplTest, CreateLocalItem) { InitializeToReadyState(); EXPECT_EQ(0U, GetNumCommitRequestLists()); @@ -362,7 +362,7 @@ TEST_F(ModelTypeSyncProxyImplTest, CreateLocalItem) { // Creates a new local item then modifies it. // Thoroughly tests data generated by modification of server-unknown item. -TEST_F(ModelTypeSyncProxyImplTest, CreateAndModifyLocalItem) { +TEST_F(ModelTypeProcessorImplTest, CreateAndModifyLocalItem) { InitializeToReadyState(); EXPECT_EQ(0U, GetNumCommitRequestLists()); @@ -394,7 +394,7 @@ TEST_F(ModelTypeSyncProxyImplTest, CreateAndModifyLocalItem) { // Deletes an item we've never seen before. // Should have no effect and not crash. -TEST_F(ModelTypeSyncProxyImplTest, DeleteUnknown) { +TEST_F(ModelTypeProcessorImplTest, DeleteUnknown) { InitializeToReadyState(); DeleteItem("tag1"); @@ -406,7 +406,7 @@ TEST_F(ModelTypeSyncProxyImplTest, DeleteUnknown) { // In this test, no commit responses are received, so the deleted item is // server-unknown as far as the model thread is concerned. That behavior // is race-dependent; other tests are used to test other races. -TEST_F(ModelTypeSyncProxyImplTest, DeleteServerUnknown) { +TEST_F(ModelTypeProcessorImplTest, DeleteServerUnknown) { InitializeToReadyState(); WriteItem("tag1", "value1"); @@ -431,7 +431,7 @@ TEST_F(ModelTypeSyncProxyImplTest, DeleteServerUnknown) { // The item is created locally then enqueued for commit. The sync thread // successfully commits it, but, before the commit response is picked up // by the model thread, the item is deleted by the model thread. -TEST_F(ModelTypeSyncProxyImplTest, DeleteServerUnknown_RacyCommitResponse) { +TEST_F(ModelTypeProcessorImplTest, DeleteServerUnknown_RacyCommitResponse) { InitializeToReadyState(); WriteItem("tag1", "value1"); @@ -455,7 +455,7 @@ TEST_F(ModelTypeSyncProxyImplTest, DeleteServerUnknown_RacyCommitResponse) { // Creates two different sync items. // Verifies that the second has no effect on the first. -TEST_F(ModelTypeSyncProxyImplTest, TwoIndependentItems) { +TEST_F(ModelTypeProcessorImplTest, TwoIndependentItems) { InitializeToReadyState(); EXPECT_EQ(0U, GetNumCommitRequestLists()); @@ -477,7 +477,7 @@ TEST_F(ModelTypeSyncProxyImplTest, TwoIndependentItems) { // Starts the type sync proxy with no local state. // Verify that it waits until initial sync is complete before requesting // commits. -TEST_F(ModelTypeSyncProxyImplTest, NoCommitsUntilInitialSyncDone) { +TEST_F(ModelTypeProcessorImplTest, NoCommitsUntilInitialSyncDone) { FirstTimeInitialize(); WriteItem("tag1", "value1"); @@ -492,7 +492,7 @@ TEST_F(ModelTypeSyncProxyImplTest, NoCommitsUntilInitialSyncDone) { // // Creates items in various states of commit and verifies they re-attempt to // commit on reconnect. -TEST_F(ModelTypeSyncProxyImplTest, Disconnect) { +TEST_F(ModelTypeProcessorImplTest, Disconnect) { InitializeToReadyState(); // The first item is fully committed. @@ -528,7 +528,7 @@ TEST_F(ModelTypeSyncProxyImplTest, Disconnect) { // // Creates items in various states of commit and verifies they re-attempt to // commit on re-enable. -TEST_F(ModelTypeSyncProxyImplTest, Disable) { +TEST_F(ModelTypeProcessorImplTest, Disable) { InitializeToReadyState(); // The first item is fully committed. @@ -563,7 +563,7 @@ TEST_F(ModelTypeSyncProxyImplTest, Disable) { } // Test receipt of pending updates. -TEST_F(ModelTypeSyncProxyImplTest, ReceivePendingUpdates) { +TEST_F(ModelTypeProcessorImplTest, ReceivePendingUpdates) { InitializeToReadyState(); EXPECT_FALSE(HasPendingUpdate("tag1")); @@ -594,7 +594,7 @@ TEST_F(ModelTypeSyncProxyImplTest, ReceivePendingUpdates) { } // Test that Disable clears pending update state. -TEST_F(ModelTypeSyncProxyImplTest, DisableWithPendingUpdates) { +TEST_F(ModelTypeProcessorImplTest, DisableWithPendingUpdates) { InitializeToReadyState(); PendingUpdateFromServer(5, "tag1", "value1", "key1"); @@ -609,7 +609,7 @@ TEST_F(ModelTypeSyncProxyImplTest, DisableWithPendingUpdates) { } // Test that Disconnect does not clear pending update state. -TEST_F(ModelTypeSyncProxyImplTest, DisconnectWithPendingUpdates) { +TEST_F(ModelTypeProcessorImplTest, DisconnectWithPendingUpdates) { InitializeToReadyState(); PendingUpdateFromServer(5, "tag1", "value1", "key1"); @@ -624,7 +624,7 @@ TEST_F(ModelTypeSyncProxyImplTest, DisconnectWithPendingUpdates) { } // Test re-encrypt everything when desired encryption key changes. -TEST_F(ModelTypeSyncProxyImplTest, ReEncryptCommitsWithNewKey) { +TEST_F(ModelTypeProcessorImplTest, ReEncryptCommitsWithNewKey) { InitializeToReadyState(); // Commit an item. @@ -656,7 +656,7 @@ TEST_F(ModelTypeSyncProxyImplTest, ReEncryptCommitsWithNewKey) { } // Test receipt of updates with new and old keys. -TEST_F(ModelTypeSyncProxyImplTest, ReEncryptUpdatesWithNewKey) { +TEST_F(ModelTypeProcessorImplTest, ReEncryptUpdatesWithNewKey) { InitializeToReadyState(); // Receive an unencrpted update. diff --git a/sync/internal_api/public/sync_context.h b/sync/internal_api/public/sync_context.h index 1e77f56..3eaa5be 100644 --- a/sync/internal_api/public/sync_context.h +++ b/sync/internal_api/public/sync_context.h @@ -13,7 +13,7 @@ #include "sync/internal_api/public/non_blocking_sync_common.h" namespace syncer_v2 { -class ModelTypeSyncProxyImpl; +class ModelTypeProcessorImpl; // An interface of the core parts of sync. // @@ -36,7 +36,7 @@ class SYNC_EXPORT_PRIVATE SyncContext { const DataTypeState& data_type_state, const UpdateResponseDataList& saved_pending_updates, const scoped_refptr<base::SequencedTaskRunner>& datatype_task_runner, - const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) = 0; + const base::WeakPtr<ModelTypeProcessorImpl>& type_sync_proxy) = 0; // Disconnects the syncer from the model and stops syncing the type. // diff --git a/sync/internal_api/public/sync_context_proxy.h b/sync/internal_api/public/sync_context_proxy.h index 1a0fec1..5293ef7 100644 --- a/sync/internal_api/public/sync_context_proxy.h +++ b/sync/internal_api/public/sync_context_proxy.h @@ -10,7 +10,7 @@ #include "sync/internal_api/public/non_blocking_sync_common.h" namespace syncer_v2 { -class ModelTypeSyncProxyImpl; +class ModelTypeProcessorImpl; // Interface for the datatype integration logic from non-sync threads. // @@ -27,7 +27,7 @@ class SYNC_EXPORT_PRIVATE SyncContextProxy { syncer::ModelType type, const DataTypeState& data_type_state, const UpdateResponseDataList& saved_pending_updates, - const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) = 0; + const base::WeakPtr<ModelTypeProcessorImpl>& type_sync_proxy) = 0; // Tells the syncer that we're no longer interested in syncing this type. // diff --git a/sync/internal_api/public/test/null_sync_context_proxy.h b/sync/internal_api/public/test/null_sync_context_proxy.h index cc45738..9c40f22 100644 --- a/sync/internal_api/public/test/null_sync_context_proxy.h +++ b/sync/internal_api/public/test/null_sync_context_proxy.h @@ -10,7 +10,7 @@ #include "sync/internal_api/public/sync_context_proxy.h" namespace syncer_v2 { -class ModelTypeSyncProxyImpl; +class ModelTypeProcessorImpl; // A non-functional implementation of SyncContextProxy. // @@ -24,7 +24,7 @@ class NullSyncContextProxy : public SyncContextProxy { syncer::ModelType type, const DataTypeState& data_type_state, const UpdateResponseDataList& saved_pending_updates, - const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) override; + const base::WeakPtr<ModelTypeProcessorImpl>& type_sync_proxy) override; void Disconnect(syncer::ModelType type) override; scoped_ptr<SyncContextProxy> Clone() const override; }; diff --git a/sync/internal_api/sync_context_proxy_impl.cc b/sync/internal_api/sync_context_proxy_impl.cc index 87bfe29..41bcd3f 100644 --- a/sync/internal_api/sync_context_proxy_impl.cc +++ b/sync/internal_api/sync_context_proxy_impl.cc @@ -26,7 +26,7 @@ void SyncContextProxyImpl::ConnectTypeToSync( syncer::ModelType type, const DataTypeState& data_type_state, const UpdateResponseDataList& saved_pending_updates, - const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) { + const base::WeakPtr<ModelTypeProcessorImpl>& type_sync_proxy) { VLOG(1) << "ConnectTypeToSync: " << ModelTypeToString(type); sync_task_runner_->PostTask(FROM_HERE, base::Bind(&SyncContext::ConnectSyncTypeToWorker, diff --git a/sync/internal_api/sync_context_proxy_impl.h b/sync/internal_api/sync_context_proxy_impl.h index 979b3f3..88a5b40 100644 --- a/sync/internal_api/sync_context_proxy_impl.h +++ b/sync/internal_api/sync_context_proxy_impl.h @@ -13,7 +13,7 @@ #include "sync/internal_api/public/sync_context_proxy.h" namespace syncer_v2 { -class ModelTypeSyncProxyImpl; +class ModelTypeProcessorImpl; class SyncContext; struct DataTypeState; @@ -40,7 +40,7 @@ class SYNC_EXPORT_PRIVATE SyncContextProxyImpl : public SyncContextProxy { syncer::ModelType type, const DataTypeState& data_type_state, const UpdateResponseDataList& pending_updates, - const base::WeakPtr<ModelTypeSyncProxyImpl>& sync_proxy_impl) override; + const base::WeakPtr<ModelTypeProcessorImpl>& sync_proxy_impl) override; // Disables syncing for the given type on the sync thread. void Disconnect(syncer::ModelType type) override; diff --git a/sync/internal_api/sync_context_proxy_impl_unittest.cc b/sync/internal_api/sync_context_proxy_impl_unittest.cc index 1bb8f19..00fe80c 100644 --- a/sync/internal_api/sync_context_proxy_impl_unittest.cc +++ b/sync/internal_api/sync_context_proxy_impl_unittest.cc @@ -6,7 +6,7 @@ #include "base/run_loop.h" #include "base/sequenced_task_runner.h" #include "base/thread_task_runner_handle.h" -#include "sync/engine/model_type_sync_proxy_impl.h" +#include "sync/engine/model_type_processor_impl.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/sync_context.h" #include "sync/internal_api/sync_context_proxy_impl.h" @@ -58,7 +58,7 @@ class SyncContextProxyImplTest : public ::testing::Test { // Try to connect a type to a SyncContext that has already shut down. TEST_F(SyncContextProxyImplTest, FailToConnect1) { - ModelTypeSyncProxyImpl themes_sync_proxy(syncer::THEMES); + ModelTypeProcessorImpl themes_sync_proxy(syncer::THEMES); DisableSync(); themes_sync_proxy.Enable(GetProxy()); @@ -69,7 +69,7 @@ TEST_F(SyncContextProxyImplTest, FailToConnect1) { // Try to connect a type to a SyncContext as it shuts down. TEST_F(SyncContextProxyImplTest, FailToConnect2) { - ModelTypeSyncProxyImpl themes_sync_proxy(syncer::THEMES); + ModelTypeProcessorImpl themes_sync_proxy(syncer::THEMES); themes_sync_proxy.Enable(GetProxy()); DisableSync(); @@ -80,8 +80,8 @@ TEST_F(SyncContextProxyImplTest, FailToConnect2) { // Tests the case where the type's sync proxy shuts down first. TEST_F(SyncContextProxyImplTest, TypeDisconnectsFirst) { - scoped_ptr<ModelTypeSyncProxyImpl> themes_sync_proxy( - new ModelTypeSyncProxyImpl(syncer::THEMES)); + scoped_ptr<ModelTypeProcessorImpl> themes_sync_proxy( + new ModelTypeProcessorImpl(syncer::THEMES)); themes_sync_proxy->Enable(GetProxy()); base::RunLoop run_loop_; @@ -93,8 +93,8 @@ TEST_F(SyncContextProxyImplTest, TypeDisconnectsFirst) { // Tests the case where the sync thread shuts down first. TEST_F(SyncContextProxyImplTest, SyncDisconnectsFirst) { - scoped_ptr<ModelTypeSyncProxyImpl> themes_sync_proxy( - new ModelTypeSyncProxyImpl(syncer::THEMES)); + scoped_ptr<ModelTypeProcessorImpl> themes_sync_proxy( + new ModelTypeProcessorImpl(syncer::THEMES)); themes_sync_proxy->Enable(GetProxy()); base::RunLoop run_loop_; diff --git a/sync/internal_api/test/null_sync_context_proxy.cc b/sync/internal_api/test/null_sync_context_proxy.cc index cdd740f..7d967ec 100644 --- a/sync/internal_api/test/null_sync_context_proxy.cc +++ b/sync/internal_api/test/null_sync_context_proxy.cc @@ -16,7 +16,7 @@ void NullSyncContextProxy::ConnectTypeToSync( syncer::ModelType type, const DataTypeState& data_type_state, const UpdateResponseDataList& saved_pending_updates, - const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) { + const base::WeakPtr<ModelTypeProcessorImpl>& type_sync_proxy) { NOTREACHED() << "NullSyncContextProxy is not meant to be used"; } diff --git a/sync/sessions/model_type_registry.cc b/sync/sessions/model_type_registry.cc index 426288e..c2ed554 100644 --- a/sync/sessions/model_type_registry.cc +++ b/sync/sessions/model_type_registry.cc @@ -11,7 +11,7 @@ #include "sync/engine/directory_commit_contributor.h" #include "sync/engine/directory_update_handler.h" #include "sync/engine/model_type_processor.h" -#include "sync/engine/model_type_sync_proxy_impl.h" +#include "sync/engine/model_type_processor_impl.h" #include "sync/engine/model_type_sync_worker_impl.h" #include "sync/internal_api/public/non_blocking_sync_common.h" #include "sync/sessions/directory_type_debug_info_emitter.h" @@ -24,7 +24,7 @@ namespace { class ModelTypeSyncProxyWrapper : public syncer_v2::ModelTypeProcessor { public: ModelTypeSyncProxyWrapper( - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& proxy, + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& processor, const scoped_refptr<base::SequencedTaskRunner>& processor_task_runner); ~ModelTypeSyncProxyWrapper() override; @@ -37,14 +37,14 @@ class ModelTypeSyncProxyWrapper : public syncer_v2::ModelTypeProcessor { const syncer_v2::UpdateResponseDataList& pending_updates) override; private: - base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl> processor_; + base::WeakPtr<syncer_v2::ModelTypeProcessorImpl> processor_; scoped_refptr<base::SequencedTaskRunner> processor_task_runner_; }; ModelTypeSyncProxyWrapper::ModelTypeSyncProxyWrapper( - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& proxy, + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& processor, const scoped_refptr<base::SequencedTaskRunner>& processor_task_runner) - : processor_(proxy), processor_task_runner_(processor_task_runner) {} + : processor_(processor), processor_task_runner_(processor_task_runner) {} ModelTypeSyncProxyWrapper::~ModelTypeSyncProxyWrapper() { } @@ -54,7 +54,7 @@ void ModelTypeSyncProxyWrapper::OnCommitCompleted( const syncer_v2::CommitResponseDataList& response_list) { processor_task_runner_->PostTask( FROM_HERE, - base::Bind(&syncer_v2::ModelTypeSyncProxyImpl::OnCommitCompleted, + base::Bind(&syncer_v2::ModelTypeProcessorImpl::OnCommitCompleted, processor_, type_state, response_list)); } @@ -64,7 +64,7 @@ void ModelTypeSyncProxyWrapper::OnUpdateReceived( const syncer_v2::UpdateResponseDataList& pending_updates) { processor_task_runner_->PostTask( FROM_HERE, - base::Bind(&syncer_v2::ModelTypeSyncProxyImpl::OnUpdateReceived, + base::Bind(&syncer_v2::ModelTypeProcessorImpl::OnUpdateReceived, processor_, type_state, response_list, pending_updates)); } @@ -186,12 +186,12 @@ void ModelTypeRegistry::ConnectSyncTypeToWorker( const syncer_v2::DataTypeState& data_type_state, const syncer_v2::UpdateResponseDataList& saved_pending_updates, const scoped_refptr<base::SequencedTaskRunner>& type_task_runner, - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& proxy_impl) { + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& processor_impl) { DVLOG(1) << "Enabling an off-thread sync type: " << ModelTypeToString(type); - // Initialize Worker -> Proxy communication channel. - scoped_ptr<syncer_v2::ModelTypeProcessor> proxy( - new ModelTypeSyncProxyWrapper(proxy_impl, type_task_runner)); + // Initialize Worker -> Processor communication channel. + scoped_ptr<syncer_v2::ModelTypeProcessor> processor( + new ModelTypeSyncProxyWrapper(processor_impl, type_task_runner)); scoped_ptr<Cryptographer> cryptographer_copy; if (encrypted_types_.Has(type)) cryptographer_copy.reset(new Cryptographer(*cryptographer_)); @@ -199,16 +199,16 @@ void ModelTypeRegistry::ConnectSyncTypeToWorker( scoped_ptr<syncer_v2::ModelTypeSyncWorkerImpl> worker( new syncer_v2::ModelTypeSyncWorkerImpl( type, data_type_state, saved_pending_updates, - cryptographer_copy.Pass(), nudge_handler_, proxy.Pass())); + cryptographer_copy.Pass(), nudge_handler_, processor.Pass())); - // Initialize Proxy -> Worker communication channel. + // Initialize Processor -> Worker communication channel. scoped_ptr<syncer_v2::CommitQueue> wrapped_worker( new ModelTypeSyncWorkerWrapper(worker->AsWeakPtr(), scoped_refptr<base::SequencedTaskRunner>( base::ThreadTaskRunnerHandle::Get()))); type_task_runner->PostTask( - FROM_HERE, base::Bind(&syncer_v2::ModelTypeSyncProxyImpl::OnConnect, - proxy_impl, base::Passed(&wrapped_worker))); + FROM_HERE, base::Bind(&syncer_v2::ModelTypeProcessorImpl::OnConnect, + processor_impl, base::Passed(&wrapped_worker))); DCHECK(update_handler_map_.find(type) == update_handler_map_.end()); DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end()); diff --git a/sync/sessions/model_type_registry.h b/sync/sessions/model_type_registry.h index 3e04b79..868b3c2 100644 --- a/sync/sessions/model_type_registry.h +++ b/sync/sessions/model_type_registry.h @@ -23,7 +23,7 @@ namespace syncer_v2 { struct DataTypeState; class ModelTypeSyncWorkerImpl; -class ModelTypeSyncProxyImpl; +class ModelTypeProcessorImpl; } namespace syncer { @@ -66,7 +66,7 @@ class SYNC_EXPORT_PRIVATE ModelTypeRegistry const syncer_v2::DataTypeState& data_type_state, const syncer_v2::UpdateResponseDataList& saved_pending_updates, const scoped_refptr<base::SequencedTaskRunner>& type_task_runner, - const base::WeakPtr<syncer_v2::ModelTypeSyncProxyImpl>& proxy) override; + const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& proxy) override; // Disables the syncing of an off-thread type. // diff --git a/sync/sessions/model_type_registry_unittest.cc b/sync/sessions/model_type_registry_unittest.cc index a831e03..648a6a8 100644 --- a/sync/sessions/model_type_registry_unittest.cc +++ b/sync/sessions/model_type_registry_unittest.cc @@ -7,7 +7,7 @@ #include "base/deferred_sequenced_task_runner.h" #include "base/message_loop/message_loop.h" #include "base/thread_task_runner_handle.h" -#include "sync/engine/model_type_sync_proxy_impl.h" +#include "sync/engine/model_type_processor_impl.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/sessions/model_type_registry.h" #include "sync/test/engine/fake_model_worker.h" @@ -17,7 +17,7 @@ namespace syncer { -using syncer_v2::ModelTypeSyncProxyImpl; +using syncer_v2::ModelTypeProcessorImpl; class ModelTypeRegistryTest : public ::testing::Test { public: @@ -145,8 +145,8 @@ TEST_F(ModelTypeRegistryTest, SetEnabledDirectoryTypes_OffAndOn) { } TEST_F(ModelTypeRegistryTest, NonBlockingTypes) { - ModelTypeSyncProxyImpl themes_sync_proxy(syncer::THEMES); - ModelTypeSyncProxyImpl sessions_sync_proxy(syncer::SESSIONS); + ModelTypeProcessorImpl themes_sync_proxy(syncer::THEMES); + ModelTypeProcessorImpl sessions_sync_proxy(syncer::SESSIONS); scoped_refptr<base::DeferredSequencedTaskRunner> task_runner = new base::DeferredSequencedTaskRunner( base::ThreadTaskRunnerHandle::Get()); @@ -176,8 +176,8 @@ TEST_F(ModelTypeRegistryTest, NonBlockingTypes) { } TEST_F(ModelTypeRegistryTest, NonBlockingTypesWithDirectoryTypes) { - ModelTypeSyncProxyImpl themes_sync_proxy(syncer::THEMES); - ModelTypeSyncProxyImpl sessions_sync_proxy(syncer::SESSIONS); + ModelTypeProcessorImpl themes_sync_proxy(syncer::THEMES); + ModelTypeProcessorImpl sessions_sync_proxy(syncer::SESSIONS); scoped_refptr<base::DeferredSequencedTaskRunner> task_runner = new base::DeferredSequencedTaskRunner( base::ThreadTaskRunnerHandle::Get()); @@ -224,10 +224,10 @@ TEST_F(ModelTypeRegistryTest, NonBlockingTypesWithDirectoryTypes) { } TEST_F(ModelTypeRegistryTest, DeletionOrdering) { - scoped_ptr<ModelTypeSyncProxyImpl> themes_sync_proxy( - new ModelTypeSyncProxyImpl(syncer::THEMES)); - scoped_ptr<ModelTypeSyncProxyImpl> sessions_sync_proxy( - new ModelTypeSyncProxyImpl(syncer::SESSIONS)); + scoped_ptr<ModelTypeProcessorImpl> themes_sync_proxy( + new ModelTypeProcessorImpl(syncer::THEMES)); + scoped_ptr<ModelTypeProcessorImpl> sessions_sync_proxy( + new ModelTypeProcessorImpl(syncer::SESSIONS)); scoped_refptr<base::DeferredSequencedTaskRunner> task_runner = new base::DeferredSequencedTaskRunner( base::ThreadTaskRunnerHandle::Get()); diff --git a/sync/sync.gyp b/sync/sync.gyp index 41b5a3c..1e21d77 100644 --- a/sync/sync.gyp +++ b/sync/sync.gyp @@ -135,8 +135,8 @@ 'engine/model_type_entity.h', 'engine/model_type_processor.cc', 'engine/model_type_processor.h', - 'engine/model_type_sync_proxy_impl.cc', - 'engine/model_type_sync_proxy_impl.h', + 'engine/model_type_processor_impl.cc', + 'engine/model_type_processor_impl.h', 'engine/model_type_sync_worker_impl.cc', 'engine/model_type_sync_worker_impl.h', 'engine/net/server_connection_manager.cc', diff --git a/sync/sync_tests.gypi b/sync/sync_tests.gypi index faa3a65..e2ca783 100644 --- a/sync/sync_tests.gypi +++ b/sync/sync_tests.gypi @@ -278,7 +278,7 @@ 'engine/entity_tracker_unittest.cc', 'engine/get_updates_processor_unittest.cc', 'engine/model_type_entity_unittest.cc', - 'engine/model_type_sync_proxy_impl_unittest.cc', + 'engine/model_type_processor_impl_unittest.cc', 'engine/model_type_sync_worker_impl_unittest.cc', 'engine/sync_scheduler_unittest.cc', 'engine/syncer_proto_util_unittest.cc', diff --git a/sync/test/engine/injectable_sync_context_proxy.cc b/sync/test/engine/injectable_sync_context_proxy.cc index 86ad689..e3094e2 100644 --- a/sync/test/engine/injectable_sync_context_proxy.cc +++ b/sync/test/engine/injectable_sync_context_proxy.cc @@ -5,7 +5,7 @@ #include "sync/test/engine/injectable_sync_context_proxy.h" #include "sync/engine/commit_queue.h" -#include "sync/engine/model_type_sync_proxy_impl.h" +#include "sync/engine/model_type_processor_impl.h" namespace syncer_v2 { @@ -21,7 +21,7 @@ void InjectableSyncContextProxy::ConnectTypeToSync( syncer::ModelType type, const DataTypeState& data_type_state, const UpdateResponseDataList& response_list, - const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) { + const base::WeakPtr<ModelTypeProcessorImpl>& type_sync_proxy) { // This class is allowed to participate in only one connection. DCHECK(!is_worker_connected_); is_worker_connected_ = true; diff --git a/sync/test/engine/injectable_sync_context_proxy.h b/sync/test/engine/injectable_sync_context_proxy.h index ca8bc02..4f19d9c 100644 --- a/sync/test/engine/injectable_sync_context_proxy.h +++ b/sync/test/engine/injectable_sync_context_proxy.h @@ -11,11 +11,11 @@ namespace syncer_v2 { -class ModelTypeSyncProxyImpl; +class ModelTypeProcessorImpl; class CommitQueue; // A SyncContextProxy implementation that, when a connection request is made, -// initalizes a connection to a previously injected ModelTypeSyncProxyImpl. +// initalizes a connection to a previously injected ModelTypeProcessorImpl. class InjectableSyncContextProxy : public SyncContextProxy { public: explicit InjectableSyncContextProxy(CommitQueue* queue); @@ -25,7 +25,7 @@ class InjectableSyncContextProxy : public SyncContextProxy { syncer::ModelType type, const DataTypeState& data_type_state, const UpdateResponseDataList& pending_updates, - const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) override; + const base::WeakPtr<ModelTypeProcessorImpl>& type_sync_proxy) override; void Disconnect(syncer::ModelType type) override; scoped_ptr<SyncContextProxy> Clone() const override; |