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

Unified Diff: components/sync/engine_impl/model_type_registry.cc

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/engine_impl/model_type_registry.cc
diff --git a/components/sync/engine_impl/model_type_registry.cc b/components/sync/engine_impl/model_type_registry.cc
index e6b3fba780e3445e5d011d852c4a2debc2f5c16c..3e986ecf098ba64ec6529d9ad63ceb6ade18da92 100644
--- a/components/sync/engine_impl/model_type_registry.cc
+++ b/components/sync/engine_impl/model_type_registry.cc
@@ -25,31 +25,29 @@ namespace syncer {
namespace {
-class CommitQueueProxy : public syncer_v2::CommitQueue {
+class CommitQueueProxy : public CommitQueue {
public:
- CommitQueueProxy(const base::WeakPtr<syncer_v2::ModelTypeWorker>& worker,
+ CommitQueueProxy(const base::WeakPtr<ModelTypeWorker>& worker,
const scoped_refptr<base::SequencedTaskRunner>& sync_thread);
~CommitQueueProxy() override;
- void EnqueueForCommit(const syncer_v2::CommitRequestDataList& list) override;
+ void EnqueueForCommit(const CommitRequestDataList& list) override;
private:
- base::WeakPtr<syncer_v2::ModelTypeWorker> worker_;
+ base::WeakPtr<ModelTypeWorker> worker_;
scoped_refptr<base::SequencedTaskRunner> sync_thread_;
};
CommitQueueProxy::CommitQueueProxy(
- const base::WeakPtr<syncer_v2::ModelTypeWorker>& worker,
+ const base::WeakPtr<ModelTypeWorker>& worker,
const scoped_refptr<base::SequencedTaskRunner>& sync_thread)
: worker_(worker), sync_thread_(sync_thread) {}
CommitQueueProxy::~CommitQueueProxy() {}
-void CommitQueueProxy::EnqueueForCommit(
- const syncer_v2::CommitRequestDataList& list) {
+void CommitQueueProxy::EnqueueForCommit(const CommitRequestDataList& list) {
sync_thread_->PostTask(
- FROM_HERE,
- base::Bind(&syncer_v2::ModelTypeWorker::EnqueueForCommit, worker_, list));
+ FROM_HERE, base::Bind(&ModelTypeWorker::EnqueueForCommit, worker_, list));
}
} // namespace
@@ -140,27 +138,23 @@ void ModelTypeRegistry::SetEnabledDirectoryTypes(
void ModelTypeRegistry::ConnectType(
ModelType type,
- std::unique_ptr<syncer_v2::ActivationContext> activation_context) {
+ std::unique_ptr<ActivationContext> activation_context) {
DVLOG(1) << "Enabling an off-thread sync type: " << ModelTypeToString(type);
// Initialize Worker -> Processor communication channel.
- syncer_v2::ModelTypeProcessor* type_processor =
- activation_context->type_processor.get();
+ ModelTypeProcessor* type_processor = activation_context->type_processor.get();
std::unique_ptr<Cryptographer> cryptographer_copy;
if (encrypted_types_.Has(type))
cryptographer_copy.reset(new Cryptographer(*cryptographer_));
- std::unique_ptr<syncer_v2::ModelTypeWorker> worker(
- new syncer_v2::ModelTypeWorker(
- type, activation_context->data_type_state,
- std::move(cryptographer_copy), nudge_handler_,
- std::move(activation_context->type_processor)));
+ std::unique_ptr<ModelTypeWorker> worker(new ModelTypeWorker(
+ type, activation_context->data_type_state, std::move(cryptographer_copy),
+ nudge_handler_, std::move(activation_context->type_processor)));
// Initialize Processor -> Worker communication channel.
- std::unique_ptr<syncer_v2::CommitQueue> commit_queue_proxy(
- new CommitQueueProxy(worker->AsWeakPtr(),
- scoped_refptr<base::SequencedTaskRunner>(
+ std::unique_ptr<CommitQueue> commit_queue_proxy(new CommitQueueProxy(
+ worker->AsWeakPtr(), scoped_refptr<base::SequencedTaskRunner>(
base::ThreadTaskRunnerHandle::Get())));
type_processor->ConnectSync(std::move(commit_queue_proxy));
@@ -190,8 +184,7 @@ void ModelTypeRegistry::DisconnectType(ModelType type) {
DCHECK_EQ(1U, committers_erased);
// Remove from the ScopedVector, deleting the worker in the process.
- for (ScopedVector<syncer_v2::ModelTypeWorker>::iterator it =
- model_type_workers_.begin();
+ for (ScopedVector<ModelTypeWorker>::iterator it = model_type_workers_.begin();
it != model_type_workers_.end(); ++it) {
if ((*it)->GetModelType() == type) {
model_type_workers_.erase(it);
@@ -234,18 +227,18 @@ ModelTypeRegistry::directory_type_debug_info_emitter_map() {
}
void ModelTypeRegistry::RegisterDirectoryTypeDebugInfoObserver(
- syncer::TypeDebugInfoObserver* observer) {
+ TypeDebugInfoObserver* observer) {
if (!type_debug_info_observers_.HasObserver(observer))
type_debug_info_observers_.AddObserver(observer);
}
void ModelTypeRegistry::UnregisterDirectoryTypeDebugInfoObserver(
- syncer::TypeDebugInfoObserver* observer) {
+ TypeDebugInfoObserver* observer) {
type_debug_info_observers_.RemoveObserver(observer);
}
bool ModelTypeRegistry::HasDirectoryTypeDebugInfoObserver(
- const syncer::TypeDebugInfoObserver* observer) const {
+ const TypeDebugInfoObserver* observer) const {
return type_debug_info_observers_.HasObserver(observer);
}
@@ -259,7 +252,7 @@ void ModelTypeRegistry::RequestEmitDebugInfo() {
}
}
-base::WeakPtr<syncer_v2::ModelTypeConnector> ModelTypeRegistry::AsWeakPtr() {
+base::WeakPtr<ModelTypeConnector> ModelTypeRegistry::AsWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
@@ -298,8 +291,7 @@ ModelTypeSet ModelTypeRegistry::GetEnabledDirectoryTypes() const {
}
void ModelTypeRegistry::OnEncryptionStateChanged() {
- for (ScopedVector<syncer_v2::ModelTypeWorker>::iterator it =
- model_type_workers_.begin();
+ for (ScopedVector<ModelTypeWorker>::iterator it = model_type_workers_.begin();
it != model_type_workers_.end(); ++it) {
if (encrypted_types_.Has((*it)->GetModelType())) {
(*it)->UpdateCryptographer(
@@ -310,7 +302,7 @@ void ModelTypeRegistry::OnEncryptionStateChanged() {
ModelTypeSet ModelTypeRegistry::GetEnabledNonBlockingTypes() const {
ModelTypeSet enabled_non_blocking_types;
- for (ScopedVector<syncer_v2::ModelTypeWorker>::const_iterator it =
+ for (ScopedVector<ModelTypeWorker>::const_iterator it =
model_type_workers_.begin();
it != model_type_workers_.end(); ++it) {
enabled_non_blocking_types.Put((*it)->GetModelType());
« no previous file with comments | « components/sync/engine_impl/model_type_registry.h ('k') | components/sync/engine_impl/model_type_registry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698