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 #ifndef SYNC_INTERNAL_API_PUBLIC_SYNC_CORE_H_
6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_CORE_H_
8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/sequenced_task_runner.h"
11 #include "sync/base/sync_export.h"
12 #include "sync/internal_api/public/base/model_type.h"
16 class ModelTypeRegistry
;
17 class NonBlockingTypeProcessor
;
19 // An interface of the core parts of sync.
21 // In theory, this is the component that provides off-thread sync types with
22 // functionality to schedule and execute communication with the sync server. In
23 // practice, this class delegates most of the responsibilty of implemeting this
24 // functionality to other classes, and most of the interface is exposed not
25 // directly here but instead through a per-ModelType class that this class helps
27 class SYNC_EXPORT_PRIVATE SyncCore
{
29 explicit SyncCore(ModelTypeRegistry
* model_type_registry
);
32 // Initializes the connection between the sync core and its delegate on the
33 // sync client's thread.
34 void ConnectSyncTypeToCore(
35 syncer::ModelType type
,
36 scoped_refptr
<base::SequencedTaskRunner
> datatype_task_runner
,
37 base::WeakPtr
<NonBlockingTypeProcessor
> sync_client
);
39 base::WeakPtr
<SyncCore
> AsWeakPtr();
42 ModelTypeRegistry
* model_type_registry_
;
43 base::WeakPtrFactory
<SyncCore
> weak_ptr_factory_
;
45 DISALLOW_COPY_AND_ASSIGN(SyncCore
);
50 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_CORE_H_