| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/driver/glue/sync_backend_host_impl.h" | 5 #include "components/sync/driver/glue/sync_backend_host_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 } | 532 } |
| 533 | 533 |
| 534 void SyncBackendHostImpl::AddExperimentalTypes() { | 534 void SyncBackendHostImpl::AddExperimentalTypes() { |
| 535 CHECK(initialized()); | 535 CHECK(initialized()); |
| 536 Experiments experiments; | 536 Experiments experiments; |
| 537 if (core_->sync_manager()->ReceivedExperiment(&experiments)) | 537 if (core_->sync_manager()->ReceivedExperiment(&experiments)) |
| 538 host_->OnExperimentsChanged(experiments); | 538 host_->OnExperimentsChanged(experiments); |
| 539 } | 539 } |
| 540 | 540 |
| 541 void SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop( | 541 void SyncBackendHostImpl::HandleInitializationSuccessOnFrontendLoop( |
| 542 ModelTypeSet initial_types, |
| 542 const WeakHandle<JsBackend> js_backend, | 543 const WeakHandle<JsBackend> js_backend, |
| 543 const WeakHandle<DataTypeDebugInfoListener> debug_info_listener, | 544 const WeakHandle<DataTypeDebugInfoListener> debug_info_listener, |
| 544 std::unique_ptr<ModelTypeConnector> model_type_connector, | 545 std::unique_ptr<ModelTypeConnector> model_type_connector, |
| 545 const std::string& cache_guid) { | 546 const std::string& cache_guid) { |
| 546 DCHECK(thread_checker_.CalledOnValidThread()); | 547 DCHECK(thread_checker_.CalledOnValidThread()); |
| 547 | 548 |
| 548 model_type_connector_ = std::move(model_type_connector); | 549 model_type_connector_ = std::move(model_type_connector); |
| 549 | 550 |
| 550 initialized_ = true; | 551 initialized_ = true; |
| 551 | 552 |
| 552 if (invalidator_) { | 553 if (invalidator_) { |
| 553 invalidator_->RegisterInvalidationHandler(this); | 554 invalidator_->RegisterInvalidationHandler(this); |
| 554 invalidation_handler_registered_ = true; | 555 invalidation_handler_registered_ = true; |
| 555 | 556 |
| 556 // Fake a state change to initialize the SyncManager's cached invalidator | 557 // Fake a state change to initialize the SyncManager's cached invalidator |
| 557 // state. | 558 // state. |
| 558 OnInvalidatorStateChange(invalidator_->GetInvalidatorState()); | 559 OnInvalidatorStateChange(invalidator_->GetInvalidatorState()); |
| 559 } | 560 } |
| 560 | 561 |
| 561 // Now that we've downloaded the control types, we can see if there are any | 562 // Now that we've downloaded the control types, we can see if there are any |
| 562 // experimental types to enable. This should be done before we inform | 563 // experimental types to enable. This should be done before we inform |
| 563 // the host to ensure they're visible in the customize screen. | 564 // the host to ensure they're visible in the customize screen. |
| 564 AddExperimentalTypes(); | 565 AddExperimentalTypes(); |
| 565 host_->OnEngineInitialized(js_backend, debug_info_listener, cache_guid, true); | 566 host_->OnEngineInitialized(initial_types, js_backend, debug_info_listener, |
| 567 cache_guid, true); |
| 566 } | 568 } |
| 567 | 569 |
| 568 void SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop() { | 570 void SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop() { |
| 569 DCHECK(thread_checker_.CalledOnValidThread()); | 571 DCHECK(thread_checker_.CalledOnValidThread()); |
| 570 host_->OnEngineInitialized(WeakHandle<JsBackend>(), | 572 host_->OnEngineInitialized(ModelTypeSet(), WeakHandle<JsBackend>(), |
| 571 WeakHandle<DataTypeDebugInfoListener>(), "", | 573 WeakHandle<DataTypeDebugInfoListener>(), "", |
| 572 false); | 574 false); |
| 573 } | 575 } |
| 574 | 576 |
| 575 void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop( | 577 void SyncBackendHostImpl::HandleSyncCycleCompletedOnFrontendLoop( |
| 576 const SyncCycleSnapshot& snapshot) { | 578 const SyncCycleSnapshot& snapshot) { |
| 577 DCHECK(thread_checker_.CalledOnValidThread()); | 579 DCHECK(thread_checker_.CalledOnValidThread()); |
| 578 | 580 |
| 579 last_snapshot_ = snapshot; | 581 last_snapshot_ = snapshot; |
| 580 | 582 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 const SyncManager::ClearServerDataCallback& frontend_callback) { | 763 const SyncManager::ClearServerDataCallback& frontend_callback) { |
| 762 DCHECK(thread_checker_.CalledOnValidThread()); | 764 DCHECK(thread_checker_.CalledOnValidThread()); |
| 763 frontend_callback.Run(); | 765 frontend_callback.Run(); |
| 764 } | 766 } |
| 765 | 767 |
| 766 } // namespace syncer | 768 } // namespace syncer |
| 767 | 769 |
| 768 #undef SDVLOG | 770 #undef SDVLOG |
| 769 | 771 |
| 770 #undef SLOG | 772 #undef SLOG |
| OLD | NEW |