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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 SyncBackendHost::SyncBackendHost(Profile* profile) | 60 SyncBackendHost::SyncBackendHost(Profile* profile) |
61 : core_(new Core(ALLOW_THIS_IN_INITIALIZER_LIST(this))), | 61 : core_(new Core(ALLOW_THIS_IN_INITIALIZER_LIST(this))), |
62 core_thread_("Chrome_SyncCoreThread"), | 62 core_thread_("Chrome_SyncCoreThread"), |
63 frontend_loop_(MessageLoop::current()), | 63 frontend_loop_(MessageLoop::current()), |
64 profile_(profile), | 64 profile_(profile), |
65 frontend_(NULL), | 65 frontend_(NULL), |
66 sync_data_folder_path_( | 66 sync_data_folder_path_( |
67 profile_->GetPath().Append(kSyncDataFolderName)), | 67 profile_->GetPath().Append(kSyncDataFolderName)), |
68 last_auth_error_(AuthError::None()), | 68 last_auth_error_(AuthError::None()), |
69 using_new_syncer_thread_( | |
70 CommandLine::ForCurrentProcess()->HasSwitch( | |
71 switches::kNewSyncerThread)), | |
72 syncapi_initialized_(false) { | 69 syncapi_initialized_(false) { |
73 } | 70 } |
74 | 71 |
75 SyncBackendHost::SyncBackendHost() | 72 SyncBackendHost::SyncBackendHost() |
76 : core_thread_("Chrome_SyncCoreThread"), | 73 : core_thread_("Chrome_SyncCoreThread"), |
77 frontend_loop_(MessageLoop::current()), | 74 frontend_loop_(MessageLoop::current()), |
78 profile_(NULL), | 75 profile_(NULL), |
79 frontend_(NULL), | 76 frontend_(NULL), |
80 last_auth_error_(AuthError::None()), | 77 last_auth_error_(AuthError::None()), |
81 using_new_syncer_thread_( | |
82 CommandLine::ForCurrentProcess()->HasSwitch( | |
83 switches::kNewSyncerThread)), | |
84 syncapi_initialized_(false) { | 78 syncapi_initialized_(false) { |
85 } | 79 } |
86 | 80 |
87 SyncBackendHost::~SyncBackendHost() { | 81 SyncBackendHost::~SyncBackendHost() { |
88 DCHECK(!core_ && !frontend_) << "Must call Shutdown before destructor."; | 82 DCHECK(!core_ && !frontend_) << "Must call Shutdown before destructor."; |
89 DCHECK(registrar_.workers.empty()); | 83 DCHECK(registrar_.workers.empty()); |
90 } | 84 } |
91 | 85 |
92 void SyncBackendHost::Initialize( | 86 void SyncBackendHost::Initialize( |
93 SyncFrontend* frontend, | 87 SyncFrontend* frontend, |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 ConfigureAutofillMigration(); | 396 ConfigureAutofillMigration(); |
403 } | 397 } |
404 | 398 |
405 { | 399 { |
406 base::AutoLock lock(registrar_lock_); | 400 base::AutoLock lock(registrar_lock_); |
407 pending_config_mode_state_.reset( | 401 pending_config_mode_state_.reset( |
408 MakePendingConfigModeState(data_type_controllers, types, ready_task, | 402 MakePendingConfigModeState(data_type_controllers, types, ready_task, |
409 ®istrar_.routing_info)); | 403 ®istrar_.routing_info)); |
410 } | 404 } |
411 | 405 |
412 // If we're doing the first configure (at startup) this is redundant as the | 406 FinishConfigureDataTypesOnFrontendLoop(); |
413 // syncer thread always must start in config mode. | |
414 if (using_new_syncer_thread_) { | |
415 core_thread_.message_loop()->PostTask( | |
416 FROM_HERE, | |
417 NewRunnableMethod(core_.get(), | |
418 &SyncBackendHost::Core::DoStartConfigurationMode)); | |
419 } else { | |
420 FinishConfigureDataTypesOnFrontendLoop(); | |
421 } | |
422 } | 407 } |
423 | 408 |
424 void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { | 409 void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { |
425 DCHECK_EQ(MessageLoop::current(), frontend_loop_); | 410 DCHECK_EQ(MessageLoop::current(), frontend_loop_); |
426 // Nudge the syncer. This is necessary for both datatype addition/deletion. | 411 // Nudge the syncer. This is necessary for both datatype addition/deletion. |
427 // | 412 // |
428 // Deletions need a nudge in order to ensure the deletion occurs in a timely | 413 // Deletions need a nudge in order to ensure the deletion occurs in a timely |
429 // manner (see issue 56416). | 414 // manner (see issue 56416). |
430 // | 415 // |
431 // In the case of additions, on the next sync cycle, the syncer should | 416 // In the case of additions, on the next sync cycle, the syncer should |
432 // notice that the routing info has changed and start the process of | 417 // notice that the routing info has changed and start the process of |
433 // downloading updates for newly added data types. Once this is | 418 // downloading updates for newly added data types. Once this is |
434 // complete, the configure_state_.ready_task_ is run via an | 419 // complete, the configure_state_.ready_task_ is run via an |
435 // OnInitializationComplete notification. | 420 // OnInitializationComplete notification. |
436 bool request_nudge = false; | 421 |
437 if (pending_config_mode_state_->deleted_type) { | 422 if (pending_config_mode_state_->deleted_type) { |
438 if (using_new_syncer_thread_) { | 423 core_thread_.message_loop()->PostTask(FROM_HERE, |
439 core_thread_.message_loop()->PostTask(FROM_HERE, | 424 NewRunnableMethod(core_.get(), |
440 NewRunnableMethod(core_.get(), | 425 &SyncBackendHost::Core::DeferNudgeForCleanup)); |
441 &SyncBackendHost::Core::DeferNudgeForCleanup)); | |
442 } else { | |
443 request_nudge = true; | |
444 } | |
445 } | 426 } |
446 | 427 |
447 if (pending_config_mode_state_->added_types.none() && | 428 if (pending_config_mode_state_->added_types.none() && |
448 !core_->syncapi()->InitialSyncEndedForAllEnabledTypes()) { | 429 !core_->syncapi()->InitialSyncEndedForAllEnabledTypes()) { |
449 LOG(WARNING) << "No new types, but initial sync not finished." | 430 LOG(WARNING) << "No new types, but initial sync not finished." |
450 << "Possible sync db corruption / removal."; | 431 << "Possible sync db corruption / removal."; |
451 // TODO(tim): Log / UMA / count this somehow? | 432 // TODO(tim): Log / UMA / count this somehow? |
452 // TODO(tim): If no added types, we could (should?) config only for | 433 // TODO(tim): If no added types, we could (should?) config only for |
453 // types that are needed... but this is a rare corruption edge case or | 434 // types that are needed... but this is a rare corruption edge case or |
454 // implies the user mucked around with their syncdb, so for now do all. | 435 // implies the user mucked around with their syncdb, so for now do all. |
455 pending_config_mode_state_->added_types = | 436 pending_config_mode_state_->added_types = |
456 syncable::ModelTypeBitSetFromSet( | 437 syncable::ModelTypeBitSetFromSet( |
457 pending_config_mode_state_->initial_types); | 438 pending_config_mode_state_->initial_types); |
458 } | 439 } |
459 | 440 |
460 // If we've added types, we always want to request a nudge/config (even if | 441 // If we've added types, we always want to request a nudge/config (even if |
461 // the initial sync is ended), in case we could not decrypt the data. | 442 // the initial sync is ended), in case we could not decrypt the data. |
462 if (pending_config_mode_state_->added_types.none()) { | 443 if (pending_config_mode_state_->added_types.none()) { |
463 // No new types - just notify the caller that the types are available. | 444 // No new types - just notify the caller that the types are available. |
464 pending_config_mode_state_->ready_task->Run(); | 445 pending_config_mode_state_->ready_task->Run(); |
465 } else { | 446 } else { |
466 pending_download_state_.reset(pending_config_mode_state_.release()); | 447 pending_download_state_.reset(pending_config_mode_state_.release()); |
467 if (using_new_syncer_thread_) { | |
468 RequestConfig(pending_download_state_->added_types); | |
469 } else { | |
470 request_nudge = true; | |
471 } | |
472 } | |
473 | 448 |
474 // TODO(tim): Remove this when we get rid of the old syncer thread. | 449 syncable::ModelTypeBitSet types_copy(pending_download_state_->added_types); |
475 if (request_nudge) { | 450 if (IsNigoriEnabled()) |
476 CHECK(!using_new_syncer_thread_); | 451 types_copy.set(syncable::NIGORI); |
477 RequestNudge(FROM_HERE); | 452 core_thread_.message_loop()->PostTask(FROM_HERE, |
| 453 NewRunnableMethod(core_.get(), |
| 454 &SyncBackendHost::Core::DoRequestConfig, |
| 455 types_copy)); |
478 } | 456 } |
479 | 457 |
480 pending_config_mode_state_.reset(); | 458 pending_config_mode_state_.reset(); |
481 | 459 |
482 // Notify the SyncManager about the new types. | 460 // Notify the SyncManager about the new types. |
483 core_thread_.message_loop()->PostTask(FROM_HERE, | 461 core_thread_.message_loop()->PostTask(FROM_HERE, |
484 NewRunnableMethod(core_.get(), | 462 NewRunnableMethod(core_.get(), |
485 &SyncBackendHost::Core::DoUpdateEnabledTypes)); | 463 &SyncBackendHost::Core::DoUpdateEnabledTypes)); |
486 } | 464 } |
487 | 465 |
488 void SyncBackendHost::EncryptDataTypes( | 466 void SyncBackendHost::EncryptDataTypes( |
489 const syncable::ModelTypeSet& encrypted_types) { | 467 const syncable::ModelTypeSet& encrypted_types) { |
490 core_thread_.message_loop()->PostTask(FROM_HERE, | 468 core_thread_.message_loop()->PostTask(FROM_HERE, |
491 NewRunnableMethod(core_.get(), | 469 NewRunnableMethod(core_.get(), |
492 &SyncBackendHost::Core::DoEncryptDataTypes, | 470 &SyncBackendHost::Core::DoEncryptDataTypes, |
493 encrypted_types)); | 471 encrypted_types)); |
494 } | 472 } |
495 | 473 |
496 void SyncBackendHost::RequestNudge(const tracked_objects::Location& location) { | 474 void SyncBackendHost::RequestNudge(const tracked_objects::Location& location) { |
497 core_thread_.message_loop()->PostTask(FROM_HERE, | 475 core_thread_.message_loop()->PostTask(FROM_HERE, |
498 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoRequestNudge, | 476 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoRequestNudge, |
499 location)); | 477 location)); |
500 } | 478 } |
501 | 479 |
502 void SyncBackendHost::RequestConfig( | |
503 const syncable::ModelTypeBitSet& added_types) { | |
504 DCHECK(core_->syncapi()); | |
505 | |
506 syncable::ModelTypeBitSet types_copy(added_types); | |
507 if (IsNigoriEnabled()) | |
508 types_copy.set(syncable::NIGORI); | |
509 | |
510 core_->syncapi()->RequestConfig(types_copy); | |
511 } | |
512 | |
513 void SyncBackendHost::ActivateDataType( | 480 void SyncBackendHost::ActivateDataType( |
514 DataTypeController* data_type_controller, | 481 DataTypeController* data_type_controller, |
515 ChangeProcessor* change_processor) { | 482 ChangeProcessor* change_processor) { |
516 base::AutoLock lock(registrar_lock_); | 483 base::AutoLock lock(registrar_lock_); |
517 | 484 |
518 // Ensure that the given data type is in the PASSIVE group. | 485 // Ensure that the given data type is in the PASSIVE group. |
519 browser_sync::ModelSafeRoutingInfo::iterator i = | 486 browser_sync::ModelSafeRoutingInfo::iterator i = |
520 registrar_.routing_info.find(data_type_controller->type()); | 487 registrar_.routing_info.find(data_type_controller->type()); |
521 DCHECK(i != registrar_.routing_info.end()); | 488 DCHECK(i != registrar_.routing_info.end()); |
522 DCHECK((*i).second == GROUP_PASSIVE); | 489 DCHECK((*i).second == GROUP_PASSIVE); |
(...skipping 11 matching lines...) Expand all Loading... |
534 DataTypeController* data_type_controller, | 501 DataTypeController* data_type_controller, |
535 ChangeProcessor* change_processor) { | 502 ChangeProcessor* change_processor) { |
536 base::AutoLock lock(registrar_lock_); | 503 base::AutoLock lock(registrar_lock_); |
537 registrar_.routing_info.erase(data_type_controller->type()); | 504 registrar_.routing_info.erase(data_type_controller->type()); |
538 | 505 |
539 std::map<syncable::ModelType, ChangeProcessor*>::size_type erased = | 506 std::map<syncable::ModelType, ChangeProcessor*>::size_type erased = |
540 processors_.erase(data_type_controller->type()); | 507 processors_.erase(data_type_controller->type()); |
541 DCHECK_EQ(erased, 1U); | 508 DCHECK_EQ(erased, 1U); |
542 } | 509 } |
543 | 510 |
544 bool SyncBackendHost::RequestPause() { | |
545 DCHECK(!using_new_syncer_thread_); | |
546 core_thread_.message_loop()->PostTask(FROM_HERE, | |
547 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoRequestPause)); | |
548 return true; | |
549 } | |
550 | |
551 bool SyncBackendHost::RequestResume() { | |
552 DCHECK(!using_new_syncer_thread_); | |
553 core_thread_.message_loop()->PostTask(FROM_HERE, | |
554 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoRequestResume)); | |
555 return true; | |
556 } | |
557 | |
558 bool SyncBackendHost::RequestClearServerData() { | 511 bool SyncBackendHost::RequestClearServerData() { |
559 core_thread_.message_loop()->PostTask(FROM_HERE, | 512 core_thread_.message_loop()->PostTask(FROM_HERE, |
560 NewRunnableMethod(core_.get(), | 513 NewRunnableMethod(core_.get(), |
561 &SyncBackendHost::Core::DoRequestClearServerData)); | 514 &SyncBackendHost::Core::DoRequestClearServerData)); |
562 return true; | 515 return true; |
563 } | 516 } |
564 | 517 |
565 SyncBackendHost::Core::~Core() { | 518 SyncBackendHost::Core::~Core() { |
566 } | 519 } |
567 | 520 |
568 void SyncBackendHost::Core::NotifyPaused() { | |
569 DCHECK(!host_ || !host_->using_new_syncer_thread_); | |
570 NotificationService::current()->Notify(NotificationType::SYNC_PAUSED, | |
571 NotificationService::AllSources(), | |
572 NotificationService::NoDetails()); | |
573 } | |
574 | |
575 void SyncBackendHost::Core::NotifyResumed() { | |
576 DCHECK(!host_ || !host_->using_new_syncer_thread_); | |
577 NotificationService::current()->Notify(NotificationType::SYNC_RESUMED, | |
578 NotificationService::AllSources(), | |
579 NotificationService::NoDetails()); | |
580 } | |
581 | |
582 void SyncBackendHost::Core::NotifyPassphraseRequired(bool for_decryption) { | 521 void SyncBackendHost::Core::NotifyPassphraseRequired(bool for_decryption) { |
583 if (!host_ || !host_->frontend_) | 522 if (!host_ || !host_->frontend_) |
584 return; | 523 return; |
585 | 524 |
586 DCHECK_EQ(MessageLoop::current(), host_->frontend_loop_); | 525 DCHECK_EQ(MessageLoop::current(), host_->frontend_loop_); |
587 | 526 |
588 if (processing_passphrase_) { | 527 if (processing_passphrase_) { |
589 VLOG(1) << "Core received OnPassphraseRequired while processing a " | 528 VLOG(1) << "Core received OnPassphraseRequired while processing a " |
590 << "passphrase. Silently dropping."; | 529 << "passphrase. Silently dropping."; |
591 return; | 530 return; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 DCHECK(MessageLoop::current() == host_->frontend_loop_); | 764 DCHECK(MessageLoop::current() == host_->frontend_loop_); |
826 processing_passphrase_ = true; | 765 processing_passphrase_ = true; |
827 } | 766 } |
828 | 767 |
829 void SyncBackendHost::Core::DoEncryptDataTypes( | 768 void SyncBackendHost::Core::DoEncryptDataTypes( |
830 const syncable::ModelTypeSet& encrypted_types) { | 769 const syncable::ModelTypeSet& encrypted_types) { |
831 DCHECK(MessageLoop::current() == host_->core_thread_.message_loop()); | 770 DCHECK(MessageLoop::current() == host_->core_thread_.message_loop()); |
832 syncapi_->EncryptDataTypes(encrypted_types); | 771 syncapi_->EncryptDataTypes(encrypted_types); |
833 } | 772 } |
834 | 773 |
| 774 void SyncBackendHost::Core::DoRequestConfig( |
| 775 const syncable::ModelTypeBitSet& added_types) { |
| 776 syncapi_->RequestConfig(added_types); |
| 777 } |
| 778 |
835 UIModelWorker* SyncBackendHost::ui_worker() { | 779 UIModelWorker* SyncBackendHost::ui_worker() { |
836 ModelSafeWorker* w = registrar_.workers[GROUP_UI]; | 780 ModelSafeWorker* w = registrar_.workers[GROUP_UI]; |
837 if (w == NULL) | 781 if (w == NULL) |
838 return NULL; | 782 return NULL; |
839 if (w->GetModelSafeGroup() != GROUP_UI) | 783 if (w->GetModelSafeGroup() != GROUP_UI) |
840 NOTREACHED(); | 784 NOTREACHED(); |
841 return static_cast<UIModelWorker*>(w); | 785 return static_cast<UIModelWorker*>(w); |
842 } | 786 } |
843 | 787 |
844 void SyncBackendHost::Core::DoShutdown(bool sync_disabled) { | 788 void SyncBackendHost::Core::DoShutdown(bool sync_disabled) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 bool found_all_added = true; | 886 bool found_all_added = true; |
943 for (syncable::ModelTypeSet::const_iterator it = | 887 for (syncable::ModelTypeSet::const_iterator it = |
944 host_->pending_download_state_->initial_types.begin(); | 888 host_->pending_download_state_->initial_types.begin(); |
945 it != host_->pending_download_state_->initial_types.end(); | 889 it != host_->pending_download_state_->initial_types.end(); |
946 ++it) { | 890 ++it) { |
947 if (host_->pending_download_state_->added_types.test(*it)) | 891 if (host_->pending_download_state_->added_types.test(*it)) |
948 found_all_added &= snapshot->initial_sync_ended.test(*it); | 892 found_all_added &= snapshot->initial_sync_ended.test(*it); |
949 } | 893 } |
950 if (!found_all_added) { | 894 if (!found_all_added) { |
951 CHECK(false); | 895 CHECK(false); |
952 DCHECK(!host_->using_new_syncer_thread_); | |
953 } else { | 896 } else { |
954 host_->pending_download_state_->ready_task->Run(); | 897 host_->pending_download_state_->ready_task->Run(); |
955 host_->pending_download_state_.reset(); | 898 host_->pending_download_state_.reset(); |
956 } | 899 } |
957 } | 900 } |
958 host_->frontend_->OnSyncCycleCompleted(); | 901 host_->frontend_->OnSyncCycleCompleted(); |
959 } | 902 } |
960 | 903 |
961 void SyncBackendHost::Core::OnInitializationComplete() { | 904 void SyncBackendHost::Core::OnInitializationComplete() { |
962 if (!host_ || !host_->frontend_) | 905 if (!host_ || !host_->frontend_) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 NewRunnableMethod(this, &Core::NotifyPassphraseFailed)); | 963 NewRunnableMethod(this, &Core::NotifyPassphraseFailed)); |
1021 } | 964 } |
1022 | 965 |
1023 void SyncBackendHost::Core::OnPassphraseAccepted( | 966 void SyncBackendHost::Core::OnPassphraseAccepted( |
1024 const std::string& bootstrap_token) { | 967 const std::string& bootstrap_token) { |
1025 host_->frontend_loop_->PostTask(FROM_HERE, | 968 host_->frontend_loop_->PostTask(FROM_HERE, |
1026 NewRunnableMethod(this, &Core::NotifyPassphraseAccepted, | 969 NewRunnableMethod(this, &Core::NotifyPassphraseAccepted, |
1027 bootstrap_token)); | 970 bootstrap_token)); |
1028 } | 971 } |
1029 | 972 |
1030 void SyncBackendHost::Core::OnPaused() { | |
1031 host_->frontend_loop_->PostTask( | |
1032 FROM_HERE, | |
1033 NewRunnableMethod(this, &Core::NotifyPaused)); | |
1034 } | |
1035 | |
1036 void SyncBackendHost::Core::OnResumed() { | |
1037 host_->frontend_loop_->PostTask( | |
1038 FROM_HERE, | |
1039 NewRunnableMethod(this, &Core::NotifyResumed)); | |
1040 } | |
1041 | |
1042 void SyncBackendHost::Core::OnStopSyncingPermanently() { | 973 void SyncBackendHost::Core::OnStopSyncingPermanently() { |
1043 host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 974 host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, |
1044 &Core::HandleStopSyncingPermanentlyOnFrontendLoop)); | 975 &Core::HandleStopSyncingPermanentlyOnFrontendLoop)); |
1045 } | 976 } |
1046 | 977 |
1047 void SyncBackendHost::Core::OnUpdatedToken(const std::string& token) { | 978 void SyncBackendHost::Core::OnUpdatedToken(const std::string& token) { |
1048 host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, | 979 host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, |
1049 &Core::NotifyUpdatedToken, token)); | 980 &Core::NotifyUpdatedToken, token)); |
1050 } | 981 } |
1051 | 982 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 | 1054 |
1124 void SyncBackendHost::Core::DoRequestNudge( | 1055 void SyncBackendHost::Core::DoRequestNudge( |
1125 const tracked_objects::Location& nudge_location) { | 1056 const tracked_objects::Location& nudge_location) { |
1126 syncapi_->RequestNudge(nudge_location); | 1057 syncapi_->RequestNudge(nudge_location); |
1127 } | 1058 } |
1128 | 1059 |
1129 void SyncBackendHost::Core::DoRequestClearServerData() { | 1060 void SyncBackendHost::Core::DoRequestClearServerData() { |
1130 syncapi_->RequestClearServerData(); | 1061 syncapi_->RequestClearServerData(); |
1131 } | 1062 } |
1132 | 1063 |
1133 void SyncBackendHost::Core::DoRequestResume() { | |
1134 syncapi_->RequestResume(); | |
1135 } | |
1136 | |
1137 void SyncBackendHost::Core::DoRequestPause() { | |
1138 syncapi()->RequestPause(); | |
1139 } | |
1140 | |
1141 void SyncBackendHost::Core::SaveChanges() { | 1064 void SyncBackendHost::Core::SaveChanges() { |
1142 syncapi_->SaveChanges(); | 1065 syncapi_->SaveChanges(); |
1143 } | 1066 } |
1144 | 1067 |
1145 void SyncBackendHost::Core::DeleteSyncDataFolder() { | 1068 void SyncBackendHost::Core::DeleteSyncDataFolder() { |
1146 if (file_util::DirectoryExists(host_->sync_data_folder_path())) { | 1069 if (file_util::DirectoryExists(host_->sync_data_folder_path())) { |
1147 if (!file_util::Delete(host_->sync_data_folder_path(), true)) | 1070 if (!file_util::Delete(host_->sync_data_folder_path(), true)) |
1148 LOG(DFATAL) << "Could not delete the Sync Data folder."; | 1071 LOG(DFATAL) << "Could not delete the Sync Data folder."; |
1149 } | 1072 } |
1150 } | 1073 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 syncapi_->RemoveObserver(&sync_manager_observer_); | 1129 syncapi_->RemoveObserver(&sync_manager_observer_); |
1207 } | 1130 } |
1208 | 1131 |
1209 void SyncBackendHost::Core::DoProcessMessage( | 1132 void SyncBackendHost::Core::DoProcessMessage( |
1210 const std::string& name, const JsArgList& args, | 1133 const std::string& name, const JsArgList& args, |
1211 const JsEventHandler* sender) { | 1134 const JsEventHandler* sender) { |
1212 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); | 1135 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); |
1213 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); | 1136 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); |
1214 } | 1137 } |
1215 | 1138 |
1216 void SyncBackendHost::Core::DoStartConfigurationMode() { | |
1217 syncapi_->StartConfigurationMode(NewCallback(this, | |
1218 &SyncBackendHost::Core::FinishConfigureDataTypes)); | |
1219 } | |
1220 | |
1221 void SyncBackendHost::Core::DeferNudgeForCleanup() { | 1139 void SyncBackendHost::Core::DeferNudgeForCleanup() { |
1222 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); | 1140 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); |
1223 deferred_nudge_for_cleanup_requested_ = true; | 1141 deferred_nudge_for_cleanup_requested_ = true; |
1224 } | 1142 } |
1225 | 1143 |
1226 } // namespace browser_sync | 1144 } // namespace browser_sync |
OLD | NEW |