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

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

Issue 1321613003: [Sync] Use ModelTypeProcessor instead of ModelTypeProcessorImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert unnecessary changes. Created 5 years, 3 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
« no previous file with comments | « sync/sessions/model_type_registry.h ('k') | sync/test/engine/injectable_sync_context_proxy.h » ('j') | 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/observer_list.h" 8 #include "base/observer_list.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "sync/engine/commit_queue.h" 10 #include "sync/engine/commit_queue.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 enabled_directory_types_ = GetRoutingInfoTypes(routing_info); 184 enabled_directory_types_ = GetRoutingInfoTypes(routing_info);
185 DCHECK(Intersection(GetEnabledDirectoryTypes(), 185 DCHECK(Intersection(GetEnabledDirectoryTypes(),
186 GetEnabledNonBlockingTypes()).Empty()); 186 GetEnabledNonBlockingTypes()).Empty());
187 } 187 }
188 188
189 void ModelTypeRegistry::ConnectSyncTypeToWorker( 189 void ModelTypeRegistry::ConnectSyncTypeToWorker(
190 ModelType type, 190 ModelType type,
191 const syncer_v2::DataTypeState& data_type_state, 191 const syncer_v2::DataTypeState& data_type_state,
192 const syncer_v2::UpdateResponseDataList& saved_pending_updates, 192 const syncer_v2::UpdateResponseDataList& saved_pending_updates,
193 const scoped_refptr<base::SequencedTaskRunner>& type_task_runner, 193 const scoped_refptr<base::SequencedTaskRunner>& type_task_runner,
194 const base::WeakPtr<syncer_v2::ModelTypeProcessorImpl>& processor_impl) { 194 const base::WeakPtr<syncer_v2::ModelTypeProcessor>& type_processor) {
195 DVLOG(1) << "Enabling an off-thread sync type: " << ModelTypeToString(type); 195 DVLOG(1) << "Enabling an off-thread sync type: " << ModelTypeToString(type);
196 196
197 // Initialize Worker -> Processor communication channel. 197 // Initialize Worker -> Processor communication channel.
198 scoped_ptr<syncer_v2::ModelTypeProcessor> processor( 198 scoped_ptr<syncer_v2::ModelTypeProcessor> processor_proxy(
199 new ModelTypeProcessorProxy(processor_impl, type_task_runner)); 199 new ModelTypeProcessorProxy(type_processor, type_task_runner));
200 scoped_ptr<Cryptographer> cryptographer_copy; 200 scoped_ptr<Cryptographer> cryptographer_copy;
201 if (encrypted_types_.Has(type)) 201 if (encrypted_types_.Has(type))
202 cryptographer_copy.reset(new Cryptographer(*cryptographer_)); 202 cryptographer_copy.reset(new Cryptographer(*cryptographer_));
203 203
204 scoped_ptr<syncer_v2::ModelTypeWorker> worker(new syncer_v2::ModelTypeWorker( 204 scoped_ptr<syncer_v2::ModelTypeWorker> worker(new syncer_v2::ModelTypeWorker(
205 type, data_type_state, saved_pending_updates, cryptographer_copy.Pass(), 205 type, data_type_state, saved_pending_updates, cryptographer_copy.Pass(),
206 nudge_handler_, processor.Pass())); 206 nudge_handler_, processor_proxy.Pass()));
207 207
208 // Initialize Processor -> Worker communication channel. 208 // Initialize Processor -> Worker communication channel.
209 scoped_ptr<syncer_v2::CommitQueue> commit_queue_proxy(new CommitQueueProxy( 209 scoped_ptr<syncer_v2::CommitQueue> commit_queue_proxy(new CommitQueueProxy(
210 worker->AsWeakPtr(), scoped_refptr<base::SequencedTaskRunner>( 210 worker->AsWeakPtr(), scoped_refptr<base::SequencedTaskRunner>(
211 base::ThreadTaskRunnerHandle::Get()))); 211 base::ThreadTaskRunnerHandle::Get())));
212 type_task_runner->PostTask( 212 type_task_runner->PostTask(
213 FROM_HERE, base::Bind(&syncer_v2::ModelTypeProcessorImpl::OnConnect, 213 FROM_HERE, base::Bind(&syncer_v2::ModelTypeProcessor::OnConnect,
214 processor_impl, base::Passed(&commit_queue_proxy))); 214 type_processor, base::Passed(&commit_queue_proxy)));
215 215
216 DCHECK(update_handler_map_.find(type) == update_handler_map_.end()); 216 DCHECK(update_handler_map_.find(type) == update_handler_map_.end());
217 DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end()); 217 DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end());
218 218
219 update_handler_map_.insert(std::make_pair(type, worker.get())); 219 update_handler_map_.insert(std::make_pair(type, worker.get()));
220 commit_contributor_map_.insert(std::make_pair(type, worker.get())); 220 commit_contributor_map_.insert(std::make_pair(type, worker.get()));
221 221
222 // The container takes ownership. 222 // The container takes ownership.
223 model_type_workers_.push_back(worker.Pass()); 223 model_type_workers_.push_back(worker.Pass());
224 224
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 ModelTypeSet enabled_off_thread_types; 350 ModelTypeSet enabled_off_thread_types;
351 for (ScopedVector<syncer_v2::ModelTypeWorker>::const_iterator it = 351 for (ScopedVector<syncer_v2::ModelTypeWorker>::const_iterator it =
352 model_type_workers_.begin(); 352 model_type_workers_.begin();
353 it != model_type_workers_.end(); ++it) { 353 it != model_type_workers_.end(); ++it) {
354 enabled_off_thread_types.Put((*it)->GetModelType()); 354 enabled_off_thread_types.Put((*it)->GetModelType());
355 } 355 }
356 return enabled_off_thread_types; 356 return enabled_off_thread_types;
357 } 357 }
358 358
359 } // namespace syncer 359 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/model_type_registry.h ('k') | sync/test/engine/injectable_sync_context_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698