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

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: const ref some smart pointers 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
« no previous file with comments | « sync/internal_api/sync_context.h ('k') | sync/internal_api/sync_context_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a1e87e28bb98818ee872c89cef1fd0bf1db5971a
--- /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,
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ const 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
« no previous file with comments | « sync/internal_api/sync_context.h ('k') | sync/internal_api/sync_context_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698