| 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 "components/sync/engine_impl/model_type_registry.h" | 5 #include "components/sync/engine_impl/model_type_registry.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 void ModelTypeRegistry::ConnectType( | 139 void ModelTypeRegistry::ConnectType( |
| 140 ModelType type, | 140 ModelType type, |
| 141 std::unique_ptr<ActivationContext> activation_context) { | 141 std::unique_ptr<ActivationContext> activation_context) { |
| 142 DVLOG(1) << "Enabling an off-thread sync type: " << ModelTypeToString(type); | 142 DVLOG(1) << "Enabling an off-thread sync type: " << ModelTypeToString(type); |
| 143 | 143 |
| 144 // Initialize Worker -> Processor communication channel. | 144 // Initialize Worker -> Processor communication channel. |
| 145 ModelTypeProcessor* type_processor = activation_context->type_processor.get(); | 145 ModelTypeProcessor* type_processor = activation_context->type_processor.get(); |
| 146 | 146 |
| 147 std::unique_ptr<Cryptographer> cryptographer_copy; | 147 std::unique_ptr<Cryptographer> cryptographer_copy; |
| 148 if (encrypted_types_.Has(type)) | 148 if (encrypted_types_.Has(type)) |
| 149 cryptographer_copy.reset(new Cryptographer(*cryptographer_)); | 149 cryptographer_copy = base::MakeUnique<Cryptographer>(*cryptographer_); |
| 150 | 150 |
| 151 std::unique_ptr<ModelTypeWorker> worker(new ModelTypeWorker( | 151 std::unique_ptr<ModelTypeWorker> worker(new ModelTypeWorker( |
| 152 type, activation_context->model_type_state, std::move(cryptographer_copy), | 152 type, activation_context->model_type_state, std::move(cryptographer_copy), |
| 153 nudge_handler_, std::move(activation_context->type_processor))); | 153 nudge_handler_, std::move(activation_context->type_processor))); |
| 154 | 154 |
| 155 // Initialize Processor -> Worker communication channel. | 155 // Initialize Processor -> Worker communication channel. |
| 156 std::unique_ptr<CommitQueue> commit_queue_proxy(new CommitQueueProxy( | 156 std::unique_ptr<CommitQueue> commit_queue_proxy(new CommitQueueProxy( |
| 157 worker->AsWeakPtr(), scoped_refptr<base::SequencedTaskRunner>( | 157 worker->AsWeakPtr(), scoped_refptr<base::SequencedTaskRunner>( |
| 158 base::ThreadTaskRunnerHandle::Get()))); | 158 base::ThreadTaskRunnerHandle::Get()))); |
| 159 | 159 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 void ModelTypeRegistry::OnEncryptedTypesChanged(ModelTypeSet encrypted_types, | 269 void ModelTypeRegistry::OnEncryptedTypesChanged(ModelTypeSet encrypted_types, |
| 270 bool encrypt_everything) { | 270 bool encrypt_everything) { |
| 271 encrypted_types_ = encrypted_types; | 271 encrypted_types_ = encrypted_types; |
| 272 OnEncryptionStateChanged(); | 272 OnEncryptionStateChanged(); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void ModelTypeRegistry::OnEncryptionComplete() {} | 275 void ModelTypeRegistry::OnEncryptionComplete() {} |
| 276 | 276 |
| 277 void ModelTypeRegistry::OnCryptographerStateChanged( | 277 void ModelTypeRegistry::OnCryptographerStateChanged( |
| 278 Cryptographer* cryptographer) { | 278 Cryptographer* cryptographer) { |
| 279 cryptographer_.reset(new Cryptographer(*cryptographer)); | 279 cryptographer_ = base::MakeUnique<Cryptographer>(*cryptographer); |
| 280 OnEncryptionStateChanged(); | 280 OnEncryptionStateChanged(); |
| 281 } | 281 } |
| 282 | 282 |
| 283 void ModelTypeRegistry::OnPassphraseTypeChanged(PassphraseType type, | 283 void ModelTypeRegistry::OnPassphraseTypeChanged(PassphraseType type, |
| 284 base::Time passphrase_time) {} | 284 base::Time passphrase_time) {} |
| 285 | 285 |
| 286 void ModelTypeRegistry::OnLocalSetPassphraseEncryption( | 286 void ModelTypeRegistry::OnLocalSetPassphraseEncryption( |
| 287 const SyncEncryptionHandler::NigoriState& nigori_state) {} | 287 const SyncEncryptionHandler::NigoriState& nigori_state) {} |
| 288 | 288 |
| 289 ModelTypeSet ModelTypeRegistry::GetEnabledDirectoryTypes() const { | 289 ModelTypeSet ModelTypeRegistry::GetEnabledDirectoryTypes() const { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 304 ModelTypeSet enabled_non_blocking_types; | 304 ModelTypeSet enabled_non_blocking_types; |
| 305 for (ScopedVector<ModelTypeWorker>::const_iterator it = | 305 for (ScopedVector<ModelTypeWorker>::const_iterator it = |
| 306 model_type_workers_.begin(); | 306 model_type_workers_.begin(); |
| 307 it != model_type_workers_.end(); ++it) { | 307 it != model_type_workers_.end(); ++it) { |
| 308 enabled_non_blocking_types.Put((*it)->GetModelType()); | 308 enabled_non_blocking_types.Put((*it)->GetModelType()); |
| 309 } | 309 } |
| 310 return enabled_non_blocking_types; | 310 return enabled_non_blocking_types; |
| 311 } | 311 } |
| 312 | 312 |
| 313 } // namespace syncer | 313 } // namespace syncer |
| OLD | NEW |