summaryrefslogtreecommitdiffstats
path: root/components/sync_driver
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 05:52:32 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-25 05:52:32 +0000
commit973a446349b8b98f8ebb35da2ae204ee71047d0c (patch)
tree1893a2d9fef2d0023ec9a561d77911e7634f3cdb /components/sync_driver
parent633a10a8162d96014ecb1ddcd01e1bb1e584d6c1 (diff)
downloadchromium_src-973a446349b8b98f8ebb35da2ae204ee71047d0c.zip
chromium_src-973a446349b8b98f8ebb35da2ae204ee71047d0c.tar.gz
chromium_src-973a446349b8b98f8ebb35da2ae204ee71047d0c.tar.bz2
sync: Mass rename of non-blocking sync classes
Renames many of the classes involved in non-blocking sync: - Renames SyncCore, SyncCoreProxy to SyncContext and SyncContextProxy. - Renames NonBlockingTypeProcessor and NonBlockingTypeProcessorInterface to ModelTypeSyncProxyImpl and ModelTypeSyncProxy, respectively. - Renames NonBlockingTypeProcessorCore and NonBlockingTypeProcessorCoreInterface to ModelTypeSyncWorkerImpl and ModelTypeSyncWorker, respectively. - Renames ModelThreadSyncEntity to ModelTypeEntity. - Renames SyncThreadSyncEntity to EntityTracker. Renames any Mock, Test, Wrapper, or Impl classes associated with the above, too. This is only the first part of the planned refactoring. The second part, which involves some changes to the inheritance hierarchy, will be implemented in a future CL. BUG=351005 Review URL: https://codereview.chromium.org/351523003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279618 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/sync_driver')
-rw-r--r--components/sync_driver/non_blocking_data_type_controller.cc59
-rw-r--r--components/sync_driver/non_blocking_data_type_controller.h87
-rw-r--r--components/sync_driver/non_blocking_data_type_controller_unittest.cc284
-rw-r--r--components/sync_driver/non_blocking_data_type_manager.cc18
-rw-r--r--components/sync_driver/non_blocking_data_type_manager.h14
5 files changed, 233 insertions, 229 deletions
diff --git a/components/sync_driver/non_blocking_data_type_controller.cc b/components/sync_driver/non_blocking_data_type_controller.cc
index 55af708..21b1dab 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/non_blocking_type_processor.h"
+#include "sync/engine/model_type_sync_proxy_impl.h"
namespace browser_sync {
@@ -19,30 +19,30 @@ NonBlockingDataTypeController::NonBlockingDataTypeController(
NonBlockingDataTypeController::~NonBlockingDataTypeController() {}
-void NonBlockingDataTypeController::InitializeProcessor(
- scoped_refptr<base::SequencedTaskRunner> task_runner,
- base::WeakPtr<syncer::NonBlockingTypeProcessor> processor) {
- DCHECK(!IsTypeProcessorConnected());
+void NonBlockingDataTypeController::InitializeType(
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& type_sync_proxy) {
+ DCHECK(!IsSyncProxyConnected());
task_runner_ = task_runner;
- processor_ = processor;
- DCHECK(IsTypeProcessorConnected());
+ type_sync_proxy_ = type_sync_proxy;
+ DCHECK(IsSyncProxyConnected());
UpdateState();
}
-void NonBlockingDataTypeController::InitializeSyncCoreProxy(
- scoped_ptr<syncer::SyncCoreProxy> proxy) {
+void NonBlockingDataTypeController::InitializeSyncContext(
+ scoped_ptr<syncer::SyncContextProxy> sync_context_proxy) {
DCHECK(!IsSyncBackendConnected());
- proxy_ = proxy.Pass();
+ sync_context_proxy_ = sync_context_proxy.Pass();
UpdateState();
}
-void NonBlockingDataTypeController::ClearSyncCoreProxy() {
- // Never had a sync core proxy to begin with. No change.
- if (!proxy_)
+void NonBlockingDataTypeController::ClearSyncContext() {
+ // Never had a sync context proxy to begin with. No change.
+ if (!sync_context_proxy_)
return;
- proxy_.reset();
+ sync_context_proxy_.reset();
UpdateState();
}
@@ -59,12 +59,12 @@ void NonBlockingDataTypeController::UpdateState() {
return;
}
- // Return immediately if the processor is not ready yet.
- if (!IsTypeProcessorConnected()) {
+ // Return immediately if the sync context proxy is not ready yet.
+ if (!IsSyncProxyConnected()) {
return;
}
- // Send the appropriate state transition request to the processor.
+ // Send the appropriate state transition request to the type sync proxy.
switch (GetDesiredState()) {
case ENABLED:
SendEnableSignal();
@@ -84,10 +84,11 @@ void NonBlockingDataTypeController::SendEnableSignal() {
DCHECK_EQ(ENABLED, GetDesiredState());
DVLOG(1) << "Enabling non-blocking sync type " << ModelTypeToString(type_);
- task_runner_->PostTask(FROM_HERE,
- base::Bind(&syncer::NonBlockingTypeProcessor::Enable,
- processor_,
- base::Passed(proxy_->Clone())));
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&syncer::ModelTypeSyncProxyImpl::Enable,
+ type_sync_proxy_,
+ base::Passed(sync_context_proxy_->Clone())));
current_state_ = ENABLED;
}
@@ -96,7 +97,7 @@ void NonBlockingDataTypeController::SendDisableSignal() {
DVLOG(1) << "Disabling non-blocking sync type " << ModelTypeToString(type_);
task_runner_->PostTask(
FROM_HERE,
- base::Bind(&syncer::NonBlockingTypeProcessor::Disable, processor_));
+ base::Bind(&syncer::ModelTypeSyncProxyImpl::Disable, type_sync_proxy_));
current_state_ = DISABLED;
}
@@ -104,9 +105,9 @@ void NonBlockingDataTypeController::SendDisconnectSignal() {
DCHECK_EQ(DISCONNECTED, GetDesiredState());
DVLOG(1) << "Disconnecting non-blocking sync type "
<< ModelTypeToString(type_);
- task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&syncer::NonBlockingTypeProcessor::Disconnect, processor_));
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&syncer::ModelTypeSyncProxyImpl::Disconnect,
+ type_sync_proxy_));
current_state_ = DISCONNECTED;
}
@@ -114,19 +115,19 @@ bool NonBlockingDataTypeController::IsPreferred() const {
return is_preferred_;
}
-bool NonBlockingDataTypeController::IsTypeProcessorConnected() const {
+bool NonBlockingDataTypeController::IsSyncProxyConnected() const {
return task_runner_ != NULL;
}
bool NonBlockingDataTypeController::IsSyncBackendConnected() const {
- return proxy_;
+ return sync_context_proxy_;
}
-NonBlockingDataTypeController::TypeProcessorState
+NonBlockingDataTypeController::TypeState
NonBlockingDataTypeController::GetDesiredState() const {
if (!IsPreferred()) {
return DISABLED;
- } else if (!IsSyncBackendConnected() || !IsTypeProcessorConnected()) {
+ } else if (!IsSyncBackendConnected() || !IsSyncProxyConnected()) {
return DISCONNECTED;
} else {
return ENABLED;
diff --git a/components/sync_driver/non_blocking_data_type_controller.h b/components/sync_driver/non_blocking_data_type_controller.h
index 4a1c66c..080e821 100644
--- a/components/sync_driver/non_blocking_data_type_controller.h
+++ b/components/sync_driver/non_blocking_data_type_controller.h
@@ -9,10 +9,10 @@
#include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner.h"
#include "sync/internal_api/public/base/model_type.h"
-#include "sync/internal_api/public/sync_core_proxy.h"
+#include "sync/internal_api/public/sync_context_proxy.h"
namespace syncer {
-class NonBlockingTypeProcessor;
+class ModelTypeSyncProxy;
}
namespace browser_sync {
@@ -21,32 +21,33 @@ namespace browser_sync {
// components.
//
// There are three main parts to this controller:
-// - The SyncCoreProxy, represening the sync thread.
-// - The NonBlockingTypeProcessor, representing the model type thread.
+// - The SyncContextProxy, represening the sync thread.
+// - The ModelTypeSyncProxy, representing the model type thread.
// - The user-set state for this type (prefs), which lives on the UI thread.
//
-// The NonBlockingSyncTypeProcessor can exist in three different states. Those
+// The ModelTypeSyncProxy can exist in three different states. Those
// states are:
// - Enabled: Changes are being synced.
// - Disconnected: Changes would be synced, but there is no connection between
// the sync thread and the model thread.
-// - Disabled: Syncing is intentionally disabled. The processor may clear any
+// - Disabled: Syncing is intentionally disabled. The type proxy may clear any
// of its local state associated with sync when this happens, since
// this is expected to last a while.
//
-// This controller is responsible for transitioning the processor into and out
+// This controller is responsible for transitioning the type proxy into and out
// of these states. It does this by posting tasks to the model type thread.
//
-// The processor is enabled when the user has indicated a desire to sync this
-// type, and the NonBlockingTypeProcessor and SyncCoreProxy are available.
+// The type proxy is enabled when the user has indicated a desire to sync this
+// type, and the ModelTypeSyncProxy and SyncContextProxy are available.
//
-// The processor is disconnected during initialization, or when either the
-// NonBlockingDataTypeController or SyncCoreProxy have not yet registered. It
-// can also be disconnected later on if the sync backend becomes unavailable.
+// The type proxy is disconnected during initialization, or when either the
+// NonBlockingDataTypeController or SyncContextProxy have not yet registered.
+// It can also be disconnected later on if the sync backend becomes
+// unavailable.
//
-// The processor is disabled if the user has disabled sync for this type. The
-// signal indicating this state will be sent to the processor when the pref is
-// first changed, or when the processor first connects to the controller.
+// The type proxy is disabled if the user has disabled sync for this type. The
+// signal indicating this state will be sent to the type proxy when the pref is
+// first changed, or when the type proxy first connects to the controller.
//
// This class is structured using some state machine patterns. It's a bit
// awkward at times, but this seems to be the clearest way to express the
@@ -56,21 +57,22 @@ class NonBlockingDataTypeController {
NonBlockingDataTypeController(syncer::ModelType type, bool is_preferred);
~NonBlockingDataTypeController();
- // Connects the NonBlockingTypeProcessor to this controller.
+ // Connects the ModelTypeSyncProxy to this controller.
//
// There is no "undo" for this operation. The NonBlockingDataTypeController
- // will only ever deal with a single processor.
- void InitializeProcessor(
- scoped_refptr<base::SequencedTaskRunner> task_runner,
- base::WeakPtr<syncer::NonBlockingTypeProcessor> processor);
+ // will only ever deal with a single type proxy.
+ void InitializeType(
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& type_sync_proxy);
- // Initialize the connection to the SyncCoreProxy.
+ // Initialize the connection to the SyncContextProxy.
//
- // This process may be reversed with ClearSyncCoreProxy().
- void InitializeSyncCoreProxy(scoped_ptr<syncer::SyncCoreProxy> proxy);
+ // This process may be reversed with ClearSyncContextProxy().
+ void InitializeSyncContext(
+ scoped_ptr<syncer::SyncContextProxy> sync_context_proxy);
- // Disconnect from the current SyncCoreProxy.
- void ClearSyncCoreProxy();
+ // Disconnect from the current SyncContextProxy.
+ void ClearSyncContext();
// Sets the current preferred state.
//
@@ -80,53 +82,54 @@ class NonBlockingDataTypeController {
void SetIsPreferred(bool is_preferred);
private:
- enum TypeProcessorState { ENABLED, DISABLED, DISCONNECTED };
+ enum TypeState { ENABLED, DISABLED, DISCONNECTED };
// Figures out which signals need to be sent then send then sends them.
void UpdateState();
- // Sends an enable signal to the NonBlockingTypeProcessor.
+ // Sends an enable signal to the ModelTypeSyncProxyImpl.
void SendEnableSignal();
- // Sends a disable signal to the NonBlockingTypeProcessor.
+ // Sends a disable signal to the ModelTypeSyncProxyImpl.
void SendDisableSignal();
- // Sends a disconnect signal to the NonBlockingTypeProcessor.
+ // Sends a disconnect signal to the ModelTypeSyncProxyImpl.
void SendDisconnectSignal();
// Returns true if this type should be synced.
bool IsPreferred() const;
- // Returns true if this object has access to the NonBlockingTypeProcessor.
- bool IsTypeProcessorConnected() const;
+ // Returns true if this object has access to the ModelTypeSyncProxyImpl.
+ bool IsSyncProxyConnected() const;
- // Returns true if this object has access to the SyncCoreProxy.
+ // Returns true if this object has access to the SyncContextProxy.
bool IsSyncBackendConnected() const;
- // Returns the state that the processor *should* be in.
- TypeProcessorState GetDesiredState() const;
+ // Returns the state that the type sync proxy should be in.
+ TypeState GetDesiredState() const;
// The ModelType we're controlling. Kept mainly for debugging.
const syncer::ModelType type_;
- // Returns the state that the processor is actually in, from this class'
- // point of view.
+ // Returns the state that the type sync proxy is actually in, from this
+ // class' point of view.
//
// This state is inferred based on the most recently sent signals, and is
- // intended to represent the state the processor will be in by the time any
+ // intended to represent the state the sync proxy will be in by the time any
// tasks we post to it now will be run. Due to threading / queueing effects,
// this may or may not be the actual state at this point in time.
- TypeProcessorState current_state_;
+ TypeState current_state_;
// Whether or not the user wants to sync this type.
bool is_preferred_;
- // The NonBlockingTypeProcessor and its associated thread. May be NULL.
+ // The ModelTypeSyncProxyImpl and its associated thread. May be NULL.
scoped_refptr<base::SequencedTaskRunner> task_runner_;
- base::WeakPtr<syncer::NonBlockingTypeProcessor> processor_;
+ base::WeakPtr<syncer::ModelTypeSyncProxyImpl> type_sync_proxy_;
- // The SyncCoreProxy that connects to the current sync backend. May be NULL.
- scoped_ptr<syncer::SyncCoreProxy> proxy_;
+ // The SyncContextProxy that connects to the current sync backend. May be
+ // NULL.
+ scoped_ptr<syncer::SyncContextProxy> sync_context_proxy_;
DISALLOW_COPY_AND_ASSIGN(NonBlockingDataTypeController);
};
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 2c9076c..e01715d 100644
--- a/components/sync_driver/non_blocking_data_type_controller_unittest.cc
+++ b/components/sync_driver/non_blocking_data_type_controller_unittest.cc
@@ -11,54 +11,52 @@
#include "base/sequenced_task_runner.h"
#include "base/test/test_simple_task_runner.h"
#include "components/sync_driver/non_blocking_data_type_controller.h"
-#include "sync/engine/non_blocking_type_processor.h"
-#include "sync/engine/non_blocking_type_processor_core_interface.h"
+#include "sync/engine/model_type_sync_proxy_impl.h"
+#include "sync/engine/model_type_sync_worker.h"
#include "sync/internal_api/public/base/model_type.h"
-#include "sync/internal_api/public/sync_core_proxy.h"
+#include "sync/internal_api/public/sync_context_proxy.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace syncer {
-class NonBlockingTypeProcessorCore;
+class ModelTypeSyncWorker;
namespace {
-// A useless instance of NonBlockingTypeProcessorCore.
-class NullNonBlockingTypeProcessorCore
- : public NonBlockingTypeProcessorCoreInterface {
+// A useless instance of ModelTypeSyncWorker.
+class NullModelTypeSyncWorker : public ModelTypeSyncWorker {
public:
- NullNonBlockingTypeProcessorCore();
- virtual ~NullNonBlockingTypeProcessorCore();
+ NullModelTypeSyncWorker();
+ virtual ~NullModelTypeSyncWorker();
virtual void RequestCommits(const CommitRequestDataList& list) OVERRIDE;
};
-NullNonBlockingTypeProcessorCore::NullNonBlockingTypeProcessorCore() {
+NullModelTypeSyncWorker::NullModelTypeSyncWorker() {
}
-NullNonBlockingTypeProcessorCore::~NullNonBlockingTypeProcessorCore() {
+NullModelTypeSyncWorker::~NullModelTypeSyncWorker() {
}
-void NullNonBlockingTypeProcessorCore::RequestCommits(
+void NullModelTypeSyncWorker::RequestCommits(
const CommitRequestDataList& list) {
NOTREACHED() << "Not implemented.";
}
// A class that pretends to be the sync backend.
-class MockSyncCore {
+class MockSyncContext {
public:
void Connect(
syncer::ModelType type,
const scoped_refptr<base::SingleThreadTaskRunner>& model_task_runner,
- const base::WeakPtr<syncer::NonBlockingTypeProcessor>& type_processor) {
+ const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& type_proxy) {
enabled_types_.Put(type);
model_task_runner->PostTask(
FROM_HERE,
- base::Bind(
- &syncer::NonBlockingTypeProcessor::OnConnect,
- type_processor,
- base::Passed(scoped_ptr<NonBlockingTypeProcessorCoreInterface>(
- new NullNonBlockingTypeProcessorCore()).Pass())));
+ base::Bind(&syncer::ModelTypeSyncProxyImpl::OnConnect,
+ type_proxy,
+ base::Passed(scoped_ptr<ModelTypeSyncWorker>(
+ new NullModelTypeSyncWorker()).Pass())));
}
void Disconnect(syncer::ModelType type) {
@@ -71,47 +69,48 @@ class MockSyncCore {
syncer::ModelTypeSet enabled_types_;
};
-// A proxy to the MockSyncCore that implements SyncCoreProxy.
-class MockSyncCoreProxy : public syncer::SyncCoreProxy {
+// A proxy to the MockSyncContext that implements SyncContextProxy.
+class MockSyncContextProxy : public syncer::SyncContextProxy {
public:
- MockSyncCoreProxy(
- MockSyncCore* sync_core,
+ MockSyncContextProxy(
+ MockSyncContext* sync_context,
const scoped_refptr<base::TestSimpleTaskRunner>& model_task_runner,
const scoped_refptr<base::TestSimpleTaskRunner>& sync_task_runner)
- : mock_sync_core_(sync_core),
+ : mock_sync_context_(sync_context),
model_task_runner_(model_task_runner),
sync_task_runner_(sync_task_runner) {}
- virtual ~MockSyncCoreProxy() {}
+ virtual ~MockSyncContextProxy() {}
- virtual void ConnectTypeToCore(
+ virtual void ConnectTypeToSync(
syncer::ModelType type,
const DataTypeState& data_type_state,
- base::WeakPtr<syncer::NonBlockingTypeProcessor> type_processor) OVERRIDE {
+ const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& type_proxy)
+ OVERRIDE {
// Normally we'd use MessageLoopProxy::current() as the TaskRunner argument
// to Connect(). That won't work here in this test, so we use the
// model_task_runner_ that was injected for this purpose instead.
sync_task_runner_->PostTask(FROM_HERE,
- base::Bind(&MockSyncCore::Connect,
- base::Unretained(mock_sync_core_),
+ base::Bind(&MockSyncContext::Connect,
+ base::Unretained(mock_sync_context_),
type,
model_task_runner_,
- type_processor));
+ type_proxy));
}
virtual void Disconnect(syncer::ModelType type) OVERRIDE {
sync_task_runner_->PostTask(FROM_HERE,
- base::Bind(&MockSyncCore::Disconnect,
- base::Unretained(mock_sync_core_),
+ base::Bind(&MockSyncContext::Disconnect,
+ base::Unretained(mock_sync_context_),
type));
}
- virtual scoped_ptr<SyncCoreProxy> Clone() const OVERRIDE {
- return scoped_ptr<SyncCoreProxy>(new MockSyncCoreProxy(
- mock_sync_core_, model_task_runner_, sync_task_runner_));
+ virtual scoped_ptr<SyncContextProxy> Clone() const OVERRIDE {
+ return scoped_ptr<SyncContextProxy>(new MockSyncContextProxy(
+ mock_sync_context_, model_task_runner_, sync_task_runner_));
}
private:
- MockSyncCore* mock_sync_core_;
+ MockSyncContext* mock_sync_context_;
scoped_refptr<base::TestSimpleTaskRunner> model_task_runner_;
scoped_refptr<base::TestSimpleTaskRunner> sync_task_runner_;
};
@@ -121,34 +120,35 @@ class MockSyncCoreProxy : public syncer::SyncCoreProxy {
class NonBlockingDataTypeControllerTest : public testing::Test {
public:
NonBlockingDataTypeControllerTest()
- : processor_(syncer::DICTIONARY),
+ : type_sync_proxy_(syncer::DICTIONARY),
model_thread_(new base::TestSimpleTaskRunner()),
sync_thread_(new base::TestSimpleTaskRunner()),
controller_(syncer::DICTIONARY, true),
- mock_core_proxy_(&mock_sync_core_, model_thread_, sync_thread_),
+ mock_context_proxy_(&mock_sync_context_, model_thread_, sync_thread_),
auto_run_tasks_(true) {}
virtual ~NonBlockingDataTypeControllerTest() {}
- // Connects the processor to the NonBlockingDataTypeController.
- void InitProcessor() {
- controller_.InitializeProcessor(model_thread_, processor_.AsWeakPtrForUI());
+ // Connects the sync type proxy to the NonBlockingDataTypeController.
+ void InitTypeSyncProxy() {
+ controller_.InitializeType(model_thread_,
+ type_sync_proxy_.AsWeakPtrForUI());
if (auto_run_tasks_) {
RunAllTasks();
}
}
// Connects the sync backend to the NonBlockingDataTypeController.
- void InitSync() {
- controller_.InitializeSyncCoreProxy(mock_core_proxy_.Clone());
+ void InitSyncBackend() {
+ controller_.InitializeSyncContext(mock_context_proxy_.Clone());
if (auto_run_tasks_) {
RunAllTasks();
}
}
// Disconnects the sync backend from the NonBlockingDataTypeController.
- void UninitializeSync() {
- controller_.ClearSyncCoreProxy();
+ void UninitializeSyncBackend() {
+ controller_.ClearSyncContext();
if (auto_run_tasks_) {
RunAllTasks();
}
@@ -169,7 +169,7 @@ class NonBlockingDataTypeControllerTest : public testing::Test {
RunQueuedModelThreadTasks();
}
- // The processor pretends to run tasks on a different thread.
+ // The sync type proxy pretends to run tasks on a different thread.
// This function runs any posted tasks.
void RunQueuedModelThreadTasks() { model_thread_->RunUntilIdle(); }
@@ -182,14 +182,14 @@ class NonBlockingDataTypeControllerTest : public testing::Test {
}
protected:
- syncer::NonBlockingTypeProcessor processor_;
+ syncer::ModelTypeSyncProxyImpl type_sync_proxy_;
scoped_refptr<base::TestSimpleTaskRunner> model_thread_;
scoped_refptr<base::TestSimpleTaskRunner> sync_thread_;
browser_sync::NonBlockingDataTypeController controller_;
- MockSyncCore mock_sync_core_;
- MockSyncCoreProxy mock_core_proxy_;
+ MockSyncContext mock_sync_context_;
+ MockSyncContextProxy mock_context_proxy_;
bool auto_run_tasks_;
};
@@ -197,144 +197,144 @@ class NonBlockingDataTypeControllerTest : public testing::Test {
// Initialization when the user has disabled syncing for this type.
TEST_F(NonBlockingDataTypeControllerTest, UserDisabled) {
SetIsPreferred(false);
- InitProcessor();
- InitSync();
+ InitTypeSyncProxy();
+ InitSyncBackend();
- EXPECT_FALSE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
- UninitializeSync();
+ UninitializeSyncBackend();
- EXPECT_FALSE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
}
-// Init the sync backend then the type processor.
+// Init the sync backend then the type sync proxy.
TEST_F(NonBlockingDataTypeControllerTest, Enabled_SyncFirst) {
SetIsPreferred(true);
- InitSync();
- EXPECT_FALSE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ InitSyncBackend();
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
- InitProcessor();
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_TRUE(processor_.IsConnected());
+ InitTypeSyncProxy();
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
- UninitializeSync();
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ UninitializeSyncBackend();
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
}
-// Init the type processor then the sync backend.
+// Init the type sync proxy then the sync backend.
TEST_F(NonBlockingDataTypeControllerTest, Enabled_ProcessorFirst) {
SetIsPreferred(true);
- InitProcessor();
- EXPECT_FALSE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ InitTypeSyncProxy();
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
- InitSync();
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_TRUE(processor_.IsConnected());
+ InitSyncBackend();
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
- UninitializeSync();
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ UninitializeSyncBackend();
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
}
// Initialize sync then disable it with a pref change.
TEST_F(NonBlockingDataTypeControllerTest, PreferThenNot) {
SetIsPreferred(true);
- InitProcessor();
- InitSync();
+ InitTypeSyncProxy();
+ InitSyncBackend();
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_TRUE(processor_.IsConnected());
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
SetIsPreferred(false);
- EXPECT_FALSE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
}
-// Connect type processor and sync backend, then toggle prefs repeatedly.
+// Connect type sync proxy and sync backend, then toggle prefs repeatedly.
TEST_F(NonBlockingDataTypeControllerTest, RepeatedTogglePreference) {
SetIsPreferred(false);
- InitProcessor();
- InitSync();
- EXPECT_FALSE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ InitTypeSyncProxy();
+ InitSyncBackend();
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
SetIsPreferred(true);
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_TRUE(processor_.IsConnected());
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
SetIsPreferred(false);
- EXPECT_FALSE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
SetIsPreferred(true);
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_TRUE(processor_.IsConnected());
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
SetIsPreferred(false);
- EXPECT_FALSE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
}
// Test sync backend getting restarted while processor is connected.
TEST_F(NonBlockingDataTypeControllerTest, RestartSyncBackend) {
SetIsPreferred(true);
- InitProcessor();
- InitSync();
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_TRUE(processor_.IsConnected());
+ InitTypeSyncProxy();
+ InitSyncBackend();
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
// Shutting down sync backend should disconnect but not disable the type.
- UninitializeSync();
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ UninitializeSyncBackend();
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
// Brining the backend back should reconnect the type.
- InitSync();
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_TRUE(processor_.IsConnected());
+ InitSyncBackend();
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
}
// Test sync backend being restarted before processor connects.
TEST_F(NonBlockingDataTypeControllerTest, RestartSyncBackendEarly) {
SetIsPreferred(true);
- // Toggle sync off and on before the type processor is available.
- InitSync();
- EXPECT_FALSE(processor_.IsConnected());
- UninitializeSync();
- EXPECT_FALSE(processor_.IsConnected());
- InitSync();
- EXPECT_FALSE(processor_.IsConnected());
+ // Toggle sync off and on before the type sync proxy is available.
+ InitSyncBackend();
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
+ UninitializeSyncBackend();
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
+ InitSyncBackend();
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
// Introduce the processor.
- InitProcessor();
- EXPECT_TRUE(processor_.IsConnected());
+ InitTypeSyncProxy();
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
}
// Test pref toggling before the sync backend has connected.
TEST_F(NonBlockingDataTypeControllerTest, TogglePreferenceWithoutBackend) {
SetIsPreferred(true);
- InitProcessor();
+ InitTypeSyncProxy();
// This should emit a disable signal.
SetIsPreferred(false);
- EXPECT_FALSE(processor_.IsConnected());
- EXPECT_FALSE(processor_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
// This won't enable us, since we don't have a sync backend.
SetIsPreferred(true);
- EXPECT_FALSE(processor_.IsConnected());
- EXPECT_FALSE(processor_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
// Only now do we start sending enable signals.
- InitSync();
- EXPECT_TRUE(processor_.IsConnected());
- EXPECT_TRUE(processor_.IsPreferred());
+ InitSyncBackend();
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
}
// Turns off auto-task-running to test the effects of delaying a connection
@@ -347,24 +347,24 @@ TEST_F(NonBlockingDataTypeControllerTest, DelayedConnect) {
SetAutoRunTasks(false);
SetIsPreferred(true);
- InitProcessor();
- InitSync();
+ InitTypeSyncProxy();
+ InitSyncBackend();
// Allow the model to emit the request.
RunQueuedModelThreadTasks();
// That should result in a request to connect, but it won't be
// executed right away.
- EXPECT_FALSE(processor_.IsConnected());
- EXPECT_TRUE(processor_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
// Let the sync thread process the request and the model thread handle its
// response.
RunQueuedSyncThreadTasks();
RunQueuedModelThreadTasks();
- EXPECT_TRUE(processor_.IsConnected());
- EXPECT_TRUE(processor_.IsPreferred());
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
}
// Send Disable signal while a connection request is in progress.
@@ -372,16 +372,16 @@ TEST_F(NonBlockingDataTypeControllerTest, DisableRacesWithOnConnect) {
SetAutoRunTasks(false);
SetIsPreferred(true);
- InitProcessor();
- InitSync();
+ InitTypeSyncProxy();
+ InitSyncBackend();
// Allow the model to emit the request.
RunQueuedModelThreadTasks();
// That should result in a request to connect, but it won't be
// executed right away.
- EXPECT_FALSE(processor_.IsConnected());
- EXPECT_TRUE(processor_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
// Send and execute a disable signal before the OnConnect callback returns.
SetIsPreferred(false);
@@ -396,8 +396,8 @@ TEST_F(NonBlockingDataTypeControllerTest, DisableRacesWithOnConnect) {
// from the UI thread earlier. We need to make sure that doesn't happen.
RunQueuedModelThreadTasks();
- EXPECT_FALSE(processor_.IsPreferred());
- EXPECT_FALSE(processor_.IsConnected());
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
}
// Send a request to enable, then disable, then re-enable the data type.
@@ -408,23 +408,23 @@ TEST_F(NonBlockingDataTypeControllerTest, EnableDisableEnableRace) {
SetAutoRunTasks(false);
SetIsPreferred(true);
- InitProcessor();
- InitSync();
+ InitTypeSyncProxy();
+ InitSyncBackend();
RunQueuedModelThreadTasks();
// That was the first enable.
- EXPECT_FALSE(processor_.IsConnected());
- EXPECT_TRUE(processor_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsConnected());
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
// Now disable.
SetIsPreferred(false);
RunQueuedModelThreadTasks();
- EXPECT_FALSE(processor_.IsPreferred());
+ EXPECT_FALSE(type_sync_proxy_.IsPreferred());
// And re-enable.
SetIsPreferred(true);
RunQueuedModelThreadTasks();
- EXPECT_TRUE(processor_.IsPreferred());
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
// The sync thread has three messages related to those enables and
// disables sittin in its queue. Let's allow it to process them.
@@ -432,8 +432,8 @@ TEST_F(NonBlockingDataTypeControllerTest, EnableDisableEnableRace) {
// Let the model thread process any messages from the sync thread.
RunQueuedModelThreadTasks();
- EXPECT_TRUE(processor_.IsPreferred());
- EXPECT_TRUE(processor_.IsConnected());
+ EXPECT_TRUE(type_sync_proxy_.IsPreferred());
+ EXPECT_TRUE(type_sync_proxy_.IsConnected());
}
} // namespace syncer
diff --git a/components/sync_driver/non_blocking_data_type_manager.cc b/components/sync_driver/non_blocking_data_type_manager.cc
index 19ed50e..348d0a6 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/non_blocking_type_processor.h"
+#include "sync/engine/model_type_sync_proxy_impl.h"
namespace browser_sync {
@@ -29,22 +29,22 @@ void NonBlockingDataTypeManager::RegisterType(
enabled)));
}
-void NonBlockingDataTypeManager::InitializeTypeProcessor(
- syncer::ModelType type,
- const scoped_refptr<base::SequencedTaskRunner>& task_runner,
- const base::WeakPtr<syncer::NonBlockingTypeProcessor>& processor) {
+void NonBlockingDataTypeManager::InitializeType(
+ syncer::ModelType type,
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& proxy_impl) {
NonBlockingDataTypeControllerMap::iterator it =
non_blocking_data_type_controllers_.find(type);
DCHECK(it != non_blocking_data_type_controllers_.end());
- it->second->InitializeProcessor(task_runner, processor);
+ it->second->InitializeType(task_runner, proxy_impl);
}
void NonBlockingDataTypeManager::ConnectSyncBackend(
- scoped_ptr<syncer::SyncCoreProxy> proxy) {
+ scoped_ptr<syncer::SyncContextProxy> proxy) {
for (NonBlockingDataTypeControllerMap::iterator it =
non_blocking_data_type_controllers_.begin();
it != non_blocking_data_type_controllers_.end(); ++it) {
- it->second->InitializeSyncCoreProxy(proxy->Clone());
+ it->second->InitializeSyncContext(proxy->Clone());
}
}
@@ -52,7 +52,7 @@ void NonBlockingDataTypeManager::DisconnectSyncBackend() {
for (NonBlockingDataTypeControllerMap::iterator it =
non_blocking_data_type_controllers_.begin();
it != non_blocking_data_type_controllers_.end(); ++it) {
- it->second->ClearSyncCoreProxy();
+ it->second->ClearSyncContext();
}
}
diff --git a/components/sync_driver/non_blocking_data_type_manager.h b/components/sync_driver/non_blocking_data_type_manager.h
index 49e85b3..19b4731 100644
--- a/components/sync_driver/non_blocking_data_type_manager.h
+++ b/components/sync_driver/non_blocking_data_type_manager.h
@@ -18,8 +18,8 @@ class SequencedTaskRunner;
} // namespace base
namespace syncer {
-class NonBlockingTypeProcessor;
-class SyncCoreProxy;
+class ModelTypeSyncProxyImpl;
+class SyncContextProxy;
} //namespace syncer
namespace browser_sync {
@@ -42,16 +42,16 @@ class NonBlockingDataTypeManager {
// The |preferred| flag indicates whether or not this type should be synced.
void RegisterType(syncer::ModelType type, bool preferred);
- // Connects the NonBlockingTypeProcessor and associated model type
+ // Connects the ModelTypeSyncProxyImpl and associated model type
// thread to its NonBlockingDataTypeController on the UI thread.
- void InitializeTypeProcessor(
+ void InitializeType(
syncer::ModelType type,
const scoped_refptr<base::SequencedTaskRunner>& task_runner,
- const base::WeakPtr<syncer::NonBlockingTypeProcessor>& processor);
+ const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& type_sync_proxy);
- // Connects the sync backend, as represented by a SyncCoreProxy, to the
+ // Connects the sync backend, as represented by a SyncContextProxy, to the
// NonBlockingDataTypeController on the UI thread.
- void ConnectSyncBackend(scoped_ptr<syncer::SyncCoreProxy> proxy);
+ void ConnectSyncBackend(scoped_ptr<syncer::SyncContextProxy> proxy);
// Disconnects the sync backend from the UI thread. Should be called
// early on during shutdown, but the whole procedure is asynchronous so