| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 scoped_ptr<syncer_v2::ModelTypeWorker> worker(new syncer_v2::ModelTypeWorker( | 149 scoped_ptr<syncer_v2::ModelTypeWorker> worker(new syncer_v2::ModelTypeWorker( |
| 150 type, activation_context->data_type_state, | 150 type, activation_context->data_type_state, |
| 151 activation_context->saved_pending_updates, std::move(cryptographer_copy), | 151 activation_context->saved_pending_updates, std::move(cryptographer_copy), |
| 152 nudge_handler_, std::move(activation_context->type_processor))); | 152 nudge_handler_, std::move(activation_context->type_processor))); |
| 153 | 153 |
| 154 // Initialize Processor -> Worker communication channel. | 154 // Initialize Processor -> Worker communication channel. |
| 155 scoped_ptr<syncer_v2::CommitQueue> commit_queue_proxy(new CommitQueueProxy( | 155 scoped_ptr<syncer_v2::CommitQueue> commit_queue_proxy(new CommitQueueProxy( |
| 156 worker->AsWeakPtr(), scoped_refptr<base::SequencedTaskRunner>( | 156 worker->AsWeakPtr(), scoped_refptr<base::SequencedTaskRunner>( |
| 157 base::ThreadTaskRunnerHandle::Get()))); | 157 base::ThreadTaskRunnerHandle::Get()))); |
| 158 | 158 |
| 159 type_processor->OnConnect(std::move(commit_queue_proxy)); | 159 type_processor->ConnectSync(std::move(commit_queue_proxy)); |
| 160 | 160 |
| 161 DCHECK(update_handler_map_.find(type) == update_handler_map_.end()); | 161 DCHECK(update_handler_map_.find(type) == update_handler_map_.end()); |
| 162 DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end()); | 162 DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end()); |
| 163 | 163 |
| 164 update_handler_map_.insert(std::make_pair(type, worker.get())); | 164 update_handler_map_.insert(std::make_pair(type, worker.get())); |
| 165 commit_contributor_map_.insert(std::make_pair(type, worker.get())); | 165 commit_contributor_map_.insert(std::make_pair(type, worker.get())); |
| 166 | 166 |
| 167 // The container takes ownership. | 167 // The container takes ownership. |
| 168 model_type_workers_.push_back(std::move(worker)); | 168 model_type_workers_.push_back(std::move(worker)); |
| 169 | 169 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 ModelTypeSet enabled_off_thread_types; | 295 ModelTypeSet enabled_off_thread_types; |
| 296 for (ScopedVector<syncer_v2::ModelTypeWorker>::const_iterator it = | 296 for (ScopedVector<syncer_v2::ModelTypeWorker>::const_iterator it = |
| 297 model_type_workers_.begin(); | 297 model_type_workers_.begin(); |
| 298 it != model_type_workers_.end(); ++it) { | 298 it != model_type_workers_.end(); ++it) { |
| 299 enabled_off_thread_types.Put((*it)->GetModelType()); | 299 enabled_off_thread_types.Put((*it)->GetModelType()); |
| 300 } | 300 } |
| 301 return enabled_off_thread_types; | 301 return enabled_off_thread_types; |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace syncer | 304 } // namespace syncer |
| OLD | NEW |