[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / sync / internal_api / sync_context_proxy_impl.cc
blob9e8db1cf1d1f4130ebf089f7f7496d759179903e
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_context_proxy_impl.h"
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "sync/engine/non_blocking_sync_common.h"
12 #include "sync/internal_api/public/sync_context.h"
14 namespace syncer {
16 SyncContextProxyImpl::SyncContextProxyImpl(
17 const scoped_refptr<base::SequencedTaskRunner>& sync_task_runner,
18 const base::WeakPtr<SyncContext>& sync_context)
19 : sync_task_runner_(sync_task_runner), sync_context_(sync_context) {
22 SyncContextProxyImpl::~SyncContextProxyImpl() {
25 void SyncContextProxyImpl::ConnectTypeToSync(
26 ModelType type,
27 const DataTypeState& data_type_state,
28 const base::WeakPtr<ModelTypeSyncProxyImpl>& type_sync_proxy) {
29 VLOG(1) << "ConnectTypeToSync: " << ModelTypeToString(type);
30 sync_task_runner_->PostTask(FROM_HERE,
31 base::Bind(&SyncContext::ConnectSyncTypeToWorker,
32 sync_context_,
33 type,
34 data_type_state,
35 base::ThreadTaskRunnerHandle::Get(),
36 type_sync_proxy));
39 void SyncContextProxyImpl::Disconnect(ModelType type) {
40 sync_task_runner_->PostTask(
41 FROM_HERE,
42 base::Bind(&SyncContext::DisconnectSyncWorker, sync_context_, type));
45 scoped_ptr<SyncContextProxy> SyncContextProxyImpl::Clone() const {
46 return scoped_ptr<SyncContextProxy>(
47 new SyncContextProxyImpl(sync_task_runner_, sync_context_));
50 } // namespace syncer