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

Side by Side Diff: sync/internal_api/sync_core.cc

Issue 272323002: sync: Implement disabling of non blocking types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/internal_api/sync_core.h" 5 #include "sync/internal_api/sync_core.h"
6 6
7 #include "sync/engine/non_blocking_type_processor_core.h" 7 #include "sync/engine/non_blocking_type_processor_core.h"
8 #include "sync/sessions/model_type_registry.h" 8 #include "sync/sessions/model_type_registry.h"
9 9
10 namespace syncer { 10 namespace syncer {
11 11
12 SyncCore::SyncCore(ModelTypeRegistry* model_type_registry) 12 SyncCore::SyncCore(ModelTypeRegistry* model_type_registry)
13 : model_type_registry_(model_type_registry), weak_ptr_factory_(this) {} 13 : model_type_registry_(model_type_registry), weak_ptr_factory_(this) {}
14 14
15 SyncCore::~SyncCore() {} 15 SyncCore::~SyncCore() {}
16 16
17 void SyncCore::ConnectSyncTypeToCore( 17 void SyncCore::ConnectSyncTypeToCore(
18 ModelType type, 18 ModelType type,
19 scoped_refptr<base::SequencedTaskRunner> task_runner, 19 scoped_refptr<base::SequencedTaskRunner> task_runner,
20 base::WeakPtr<NonBlockingTypeProcessor> processor) { 20 base::WeakPtr<NonBlockingTypeProcessor> processor) {
21 21
22 // Initialize the processor's sync-thread sibling and the 22 // Initialize the processor's sync-thread sibling and the
23 // processor <-> processor_core (ie. model thread <-> sync thread) 23 // processor <-> processor_core (ie. model thread <-> sync thread)
24 // communication channel. 24 // communication channel.
25 model_type_registry_->InitializeNonBlockingType(type, task_runner, processor); 25 model_type_registry_->InitializeNonBlockingType(type, task_runner, processor);
26 } 26 }
27 27
28 void SyncCore::Disconnect(ModelType type) {
29 model_type_registry_->RemoveNonBlockingType(type);
30 }
31
28 base::WeakPtr<SyncCore> SyncCore::AsWeakPtr() { 32 base::WeakPtr<SyncCore> SyncCore::AsWeakPtr() {
29 return weak_ptr_factory_.GetWeakPtr(); 33 return weak_ptr_factory_.GetWeakPtr();
30 } 34 }
31 35
32 } // namespace syncer 36 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698