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

Side by Side Diff: sync/sessions/model_type_registry.cc

Issue 217183003: Add non-blocking sync code to ProfileSyncService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments Created 6 years, 8 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
« no previous file with comments | « sync/internal_api/test/fake_sync_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/sessions/model_type_registry.h" 5 #include "sync/sessions/model_type_registry.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "sync/engine/directory_commit_contributor.h" 9 #include "sync/engine/directory_commit_contributor.h"
10 #include "sync/engine/directory_update_handler.h" 10 #include "sync/engine/directory_update_handler.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 DVLOG(1) << "Enabling an off-thread sync type: " << ModelTypeToString(type); 83 DVLOG(1) << "Enabling an off-thread sync type: " << ModelTypeToString(type);
84 84
85 // Initialize CoreProcessor -> Processor communication channel. 85 // Initialize CoreProcessor -> Processor communication channel.
86 scoped_ptr<NonBlockingTypeProcessorCore> core( 86 scoped_ptr<NonBlockingTypeProcessorCore> core(
87 new NonBlockingTypeProcessorCore(type, type_task_runner, processor)); 87 new NonBlockingTypeProcessorCore(type, type_task_runner, processor));
88 88
89 // Initialize Processor -> CoreProcessor communication channel. 89 // Initialize Processor -> CoreProcessor communication channel.
90 type_task_runner->PostTask( 90 type_task_runner->PostTask(
91 FROM_HERE, 91 FROM_HERE,
92 base::Bind(&NonBlockingTypeProcessor::OnConnect, 92 base::Bind(&NonBlockingTypeProcessor::OnConnect,
93 processor->AsWeakPtr(), 93 processor,
94 core->AsWeakPtr(), 94 core->AsWeakPtr(),
95 scoped_refptr<base::SequencedTaskRunner>( 95 scoped_refptr<base::SequencedTaskRunner>(
96 base::MessageLoopProxy::current()))); 96 base::MessageLoopProxy::current())));
97 97
98 DCHECK(update_handler_map_.find(type) == update_handler_map_.end()); 98 DCHECK(update_handler_map_.find(type) == update_handler_map_.end());
99 DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end()); 99 DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end());
100 100
101 update_handler_map_.insert(std::make_pair(type, core.get())); 101 update_handler_map_.insert(std::make_pair(type, core.get()));
102 commit_contributor_map_.insert(std::make_pair(type, core.get())); 102 commit_contributor_map_.insert(std::make_pair(type, core.get()));
103 103
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 ModelTypeSet enabled_off_thread_types; 150 ModelTypeSet enabled_off_thread_types;
151 for (ScopedVector<NonBlockingTypeProcessorCore>::const_iterator it = 151 for (ScopedVector<NonBlockingTypeProcessorCore>::const_iterator it =
152 non_blocking_type_processor_cores_.begin(); 152 non_blocking_type_processor_cores_.begin();
153 it != non_blocking_type_processor_cores_.end(); ++it) { 153 it != non_blocking_type_processor_cores_.end(); ++it) {
154 enabled_off_thread_types.Put((*it)->GetModelType()); 154 enabled_off_thread_types.Put((*it)->GetModelType());
155 } 155 }
156 return enabled_off_thread_types; 156 return enabled_off_thread_types;
157 } 157 }
158 158
159 } // namespace syncer 159 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/test/fake_sync_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698