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

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

Issue 1539843002: Convert Pass()→std::move() in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
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 <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/observer_list.h" 10 #include "base/observer_list.h"
9 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
10 #include "sync/engine/commit_queue.h" 12 #include "sync/engine/commit_queue.h"
11 #include "sync/engine/directory_commit_contributor.h" 13 #include "sync/engine/directory_commit_contributor.h"
12 #include "sync/engine/directory_update_handler.h" 14 #include "sync/engine/directory_update_handler.h"
13 #include "sync/engine/model_type_worker.h" 15 #include "sync/engine/model_type_worker.h"
14 #include "sync/internal_api/public/activation_context.h" 16 #include "sync/internal_api/public/activation_context.h"
15 #include "sync/internal_api/public/model_type_processor.h" 17 #include "sync/internal_api/public/model_type_processor.h"
16 #include "sync/sessions/directory_type_debug_info_emitter.h" 18 #include "sync/sessions/directory_type_debug_info_emitter.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // Initialize Worker -> Processor communication channel. 140 // Initialize Worker -> Processor communication channel.
139 syncer_v2::ModelTypeProcessor* type_processor = 141 syncer_v2::ModelTypeProcessor* type_processor =
140 activation_context->type_processor.get(); 142 activation_context->type_processor.get();
141 143
142 scoped_ptr<Cryptographer> cryptographer_copy; 144 scoped_ptr<Cryptographer> cryptographer_copy;
143 if (encrypted_types_.Has(type)) 145 if (encrypted_types_.Has(type))
144 cryptographer_copy.reset(new Cryptographer(*cryptographer_)); 146 cryptographer_copy.reset(new Cryptographer(*cryptographer_));
145 147
146 scoped_ptr<syncer_v2::ModelTypeWorker> worker(new syncer_v2::ModelTypeWorker( 148 scoped_ptr<syncer_v2::ModelTypeWorker> worker(new syncer_v2::ModelTypeWorker(
147 type, activation_context->data_type_state, 149 type, activation_context->data_type_state,
148 activation_context->saved_pending_updates, cryptographer_copy.Pass(), 150 activation_context->saved_pending_updates, std::move(cryptographer_copy),
149 nudge_handler_, activation_context->type_processor.Pass())); 151 nudge_handler_, std::move(activation_context->type_processor)));
150 152
151 // Initialize Processor -> Worker communication channel. 153 // Initialize Processor -> Worker communication channel.
152 scoped_ptr<syncer_v2::CommitQueue> commit_queue_proxy(new CommitQueueProxy( 154 scoped_ptr<syncer_v2::CommitQueue> commit_queue_proxy(new CommitQueueProxy(
153 worker->AsWeakPtr(), scoped_refptr<base::SequencedTaskRunner>( 155 worker->AsWeakPtr(), scoped_refptr<base::SequencedTaskRunner>(
154 base::ThreadTaskRunnerHandle::Get()))); 156 base::ThreadTaskRunnerHandle::Get())));
155 157
156 type_processor->OnConnect(commit_queue_proxy.Pass()); 158 type_processor->OnConnect(std::move(commit_queue_proxy));
157 159
158 DCHECK(update_handler_map_.find(type) == update_handler_map_.end()); 160 DCHECK(update_handler_map_.find(type) == update_handler_map_.end());
159 DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end()); 161 DCHECK(commit_contributor_map_.find(type) == commit_contributor_map_.end());
160 162
161 update_handler_map_.insert(std::make_pair(type, worker.get())); 163 update_handler_map_.insert(std::make_pair(type, worker.get()));
162 commit_contributor_map_.insert(std::make_pair(type, worker.get())); 164 commit_contributor_map_.insert(std::make_pair(type, worker.get()));
163 165
164 // The container takes ownership. 166 // The container takes ownership.
165 model_type_workers_.push_back(worker.Pass()); 167 model_type_workers_.push_back(std::move(worker));
166 168
167 DCHECK(Intersection(GetEnabledDirectoryTypes(), 169 DCHECK(Intersection(GetEnabledDirectoryTypes(),
168 GetEnabledNonBlockingTypes()).Empty()); 170 GetEnabledNonBlockingTypes()).Empty());
169 } 171 }
170 172
171 void ModelTypeRegistry::DisconnectSyncWorker(ModelType type) { 173 void ModelTypeRegistry::DisconnectSyncWorker(ModelType type) {
172 DVLOG(1) << "Disabling an off-thread sync type: " << ModelTypeToString(type); 174 DVLOG(1) << "Disabling an off-thread sync type: " << ModelTypeToString(type);
173 DCHECK(update_handler_map_.find(type) != update_handler_map_.end()); 175 DCHECK(update_handler_map_.find(type) != update_handler_map_.end());
174 DCHECK(commit_contributor_map_.find(type) != commit_contributor_map_.end()); 176 DCHECK(commit_contributor_map_.find(type) != commit_contributor_map_.end());
175 177
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 ModelTypeSet enabled_off_thread_types; 294 ModelTypeSet enabled_off_thread_types;
293 for (ScopedVector<syncer_v2::ModelTypeWorker>::const_iterator it = 295 for (ScopedVector<syncer_v2::ModelTypeWorker>::const_iterator it =
294 model_type_workers_.begin(); 296 model_type_workers_.begin();
295 it != model_type_workers_.end(); ++it) { 297 it != model_type_workers_.end(); ++it) {
296 enabled_off_thread_types.Put((*it)->GetModelType()); 298 enabled_off_thread_types.Put((*it)->GetModelType());
297 } 299 }
298 return enabled_off_thread_types; 300 return enabled_off_thread_types;
299 } 301 }
300 302
301 } // namespace syncer 303 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698