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

Unified Diff: sync/internal_api/sync_context.cc

Issue 351523003: sync: Mass rename of non-blocking sync classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some comments Created 6 years, 6 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: sync/internal_api/sync_context.cc
diff --git a/sync/internal_api/sync_context.cc b/sync/internal_api/sync_context.cc
new file mode 100644
index 0000000000000000000000000000000000000000..804dc874efc377fbda00c9aae52700ca605ab187
--- /dev/null
+++ b/sync/internal_api/sync_context.cc
@@ -0,0 +1,39 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sync/internal_api/sync_context.h"
+
+#include "sync/engine/model_type_sync_worker_impl.h"
+#include "sync/sessions/model_type_registry.h"
+
+namespace syncer {
+
+SyncContext::SyncContext(ModelTypeRegistry* model_type_registry)
+ : model_type_registry_(model_type_registry), weak_ptr_factory_(this) {
+}
+
+SyncContext::~SyncContext() {
+}
+
+void SyncContext::ConnectSyncTypeToWorker(
+ ModelType type,
+ const DataTypeState& data_type_state,
+ scoped_refptr<base::SequencedTaskRunner> task_runner,
+ base::WeakPtr<ModelTypeSyncProxyImpl> type_sync_proxy) {
+ // Initialize the type sync proxy's sync-thread sibling and the
+ // ModelTypeSyncProxy <-> ModelTypeSyncWorker
+ // (ie. model thread <-> sync thread) communication channel.
+ model_type_registry_->InitializeNonBlockingType(
+ type, data_type_state, task_runner, type_sync_proxy);
+}
+
+void SyncContext::Disconnect(ModelType type) {
+ model_type_registry_->RemoveNonBlockingType(type);
+}
+
+base::WeakPtr<SyncContext> SyncContext::AsWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+}
+
+} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698