| 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 DCHECK(i != registrar_.routing_info.end()); | 498 DCHECK(i != registrar_.routing_info.end()); |
| 499 DCHECK((*i).second == GROUP_PASSIVE); | 499 DCHECK((*i).second == GROUP_PASSIVE); |
| 500 syncable::ModelType type = data_type_controller->type(); | 500 syncable::ModelType type = data_type_controller->type(); |
| 501 // Change the data type's routing info to its group. | 501 // Change the data type's routing info to its group. |
| 502 registrar_.routing_info[type] = data_type_controller->model_safe_group(); | 502 registrar_.routing_info[type] = data_type_controller->model_safe_group(); |
| 503 | 503 |
| 504 // Add the data type's change processor to the list of change | 504 // Add the data type's change processor to the list of change |
| 505 // processors so it can receive updates. | 505 // processors so it can receive updates. |
| 506 DCHECK_EQ(processors_.count(type), 0U); | 506 DCHECK_EQ(processors_.count(type), 0U); |
| 507 processors_[type] = change_processor; | 507 processors_[type] = change_processor; |
| 508 |
| 509 // Start the change processor. |
| 510 change_processor->Start(profile_, GetUserShare()); |
| 508 } | 511 } |
| 509 | 512 |
| 510 void SyncBackendHost::DeactivateDataType( | 513 void SyncBackendHost::DeactivateDataType( |
| 511 DataTypeController* data_type_controller, | 514 DataTypeController* data_type_controller, |
| 512 ChangeProcessor* change_processor) { | 515 ChangeProcessor* change_processor) { |
| 513 base::AutoLock lock(registrar_lock_); | 516 base::AutoLock lock(registrar_lock_); |
| 514 registrar_.routing_info.erase(data_type_controller->type()); | 517 registrar_.routing_info.erase(data_type_controller->type()); |
| 515 | 518 |
| 519 // Stop the change processor and remove it from the list of processors. |
| 520 change_processor->Stop(); |
| 516 std::map<syncable::ModelType, ChangeProcessor*>::size_type erased = | 521 std::map<syncable::ModelType, ChangeProcessor*>::size_type erased = |
| 517 processors_.erase(data_type_controller->type()); | 522 processors_.erase(data_type_controller->type()); |
| 518 DCHECK_EQ(erased, 1U); | 523 DCHECK_EQ(erased, 1U); |
| 519 } | 524 } |
| 520 | 525 |
| 521 bool SyncBackendHost::RequestClearServerData() { | 526 bool SyncBackendHost::RequestClearServerData() { |
| 522 core_thread_.message_loop()->PostTask(FROM_HERE, | 527 core_thread_.message_loop()->PostTask(FROM_HERE, |
| 523 NewRunnableMethod(core_.get(), | 528 NewRunnableMethod(core_.get(), |
| 524 &SyncBackendHost::Core::DoRequestClearServerData)); | 529 &SyncBackendHost::Core::DoRequestClearServerData)); |
| 525 return true; | 530 return true; |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); | 1149 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); |
| 1145 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); | 1150 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); |
| 1146 } | 1151 } |
| 1147 | 1152 |
| 1148 void SyncBackendHost::Core::DeferNudgeForCleanup() { | 1153 void SyncBackendHost::Core::DeferNudgeForCleanup() { |
| 1149 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); | 1154 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); |
| 1150 deferred_nudge_for_cleanup_requested_ = true; | 1155 deferred_nudge_for_cleanup_requested_ = true; |
| 1151 } | 1156 } |
| 1152 | 1157 |
| 1153 } // namespace browser_sync | 1158 } // namespace browser_sync |
| OLD | NEW |