| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 DCHECK(i != registrar_.routing_info.end()); | 508 DCHECK(i != registrar_.routing_info.end()); |
| 509 DCHECK((*i).second == GROUP_PASSIVE); | 509 DCHECK((*i).second == GROUP_PASSIVE); |
| 510 syncable::ModelType type = data_type_controller->type(); | 510 syncable::ModelType type = data_type_controller->type(); |
| 511 // Change the data type's routing info to its group. | 511 // Change the data type's routing info to its group. |
| 512 registrar_.routing_info[type] = data_type_controller->model_safe_group(); | 512 registrar_.routing_info[type] = data_type_controller->model_safe_group(); |
| 513 | 513 |
| 514 // Add the data type's change processor to the list of change | 514 // Add the data type's change processor to the list of change |
| 515 // processors so it can receive updates. | 515 // processors so it can receive updates. |
| 516 DCHECK_EQ(processors_.count(type), 0U); | 516 DCHECK_EQ(processors_.count(type), 0U); |
| 517 processors_[type] = change_processor; | 517 processors_[type] = change_processor; |
| 518 |
| 519 // Start the change processor. |
| 520 change_processor->Start(profile_, GetUserShare()); |
| 518 } | 521 } |
| 519 | 522 |
| 520 void SyncBackendHost::DeactivateDataType( | 523 void SyncBackendHost::DeactivateDataType( |
| 521 DataTypeController* data_type_controller, | 524 DataTypeController* data_type_controller, |
| 522 ChangeProcessor* change_processor) { | 525 ChangeProcessor* change_processor) { |
| 523 base::AutoLock lock(registrar_lock_); | 526 base::AutoLock lock(registrar_lock_); |
| 524 registrar_.routing_info.erase(data_type_controller->type()); | 527 registrar_.routing_info.erase(data_type_controller->type()); |
| 525 | 528 |
| 529 // Stop the change processor and remove it from the list of processors. |
| 530 change_processor->Stop(); |
| 526 std::map<syncable::ModelType, ChangeProcessor*>::size_type erased = | 531 std::map<syncable::ModelType, ChangeProcessor*>::size_type erased = |
| 527 processors_.erase(data_type_controller->type()); | 532 processors_.erase(data_type_controller->type()); |
| 528 DCHECK_EQ(erased, 1U); | 533 DCHECK_EQ(erased, 1U); |
| 529 } | 534 } |
| 530 | 535 |
| 531 bool SyncBackendHost::RequestClearServerData() { | 536 bool SyncBackendHost::RequestClearServerData() { |
| 532 core_thread_.message_loop()->PostTask(FROM_HERE, | 537 core_thread_.message_loop()->PostTask(FROM_HERE, |
| 533 NewRunnableMethod(core_.get(), | 538 NewRunnableMethod(core_.get(), |
| 534 &SyncBackendHost::Core::DoRequestClearServerData)); | 539 &SyncBackendHost::Core::DoRequestClearServerData)); |
| 535 return true; | 540 return true; |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); | 1183 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); |
| 1179 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); | 1184 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); |
| 1180 } | 1185 } |
| 1181 | 1186 |
| 1182 void SyncBackendHost::Core::DeferNudgeForCleanup() { | 1187 void SyncBackendHost::Core::DeferNudgeForCleanup() { |
| 1183 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); | 1188 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); |
| 1184 deferred_nudge_for_cleanup_requested_ = true; | 1189 deferred_nudge_for_cleanup_requested_ = true; |
| 1185 } | 1190 } |
| 1186 | 1191 |
| 1187 } // namespace browser_sync | 1192 } // namespace browser_sync |
| OLD | NEW |