1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "sync/internal_api/sync_core.h"
7 #include "sync/engine/non_blocking_type_processor_core.h"
8 #include "sync/sessions/model_type_registry.h"
12 SyncCore::SyncCore(ModelTypeRegistry
* model_type_registry
)
13 : model_type_registry_(model_type_registry
), weak_ptr_factory_(this) {}
15 SyncCore::~SyncCore() {}
17 void SyncCore::ConnectSyncTypeToCore(
19 scoped_refptr
<base::SequencedTaskRunner
> task_runner
,
20 base::WeakPtr
<NonBlockingTypeProcessor
> processor
) {
22 // Initialize the processor's sync-thread sibling and the
23 // processor <-> processor_core (ie. model thread <-> sync thread)
24 // communication channel.
25 model_type_registry_
->InitializeNonBlockingType(type
, task_runner
, processor
);
28 base::WeakPtr
<SyncCore
> SyncCore::AsWeakPtr() {
29 return weak_ptr_factory_
.GetWeakPtr();