| Index: components/sync/engine_impl/sync_manager_impl.cc
|
| diff --git a/components/sync/core_impl/sync_manager_impl.cc b/components/sync/engine_impl/sync_manager_impl.cc
|
| similarity index 94%
|
| rename from components/sync/core_impl/sync_manager_impl.cc
|
| rename to components/sync/engine_impl/sync_manager_impl.cc
|
| index eb0761ed1d9b76bb21e731c201ffb756dc7fc9ec..c0d18bec2fc642c25470915a34e64ad2978fd697 100644
|
| --- a/components/sync/core_impl/sync_manager_impl.cc
|
| +++ b/components/sync/engine_impl/sync_manager_impl.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "components/sync/core_impl/sync_manager_impl.h"
|
| +#include "components/sync/engine_impl/sync_manager_impl.h"
|
|
|
| #include <stddef.h>
|
|
|
| @@ -24,13 +24,13 @@
|
| #include "components/sync/base/experiments.h"
|
| #include "components/sync/base/invalidation_interface.h"
|
| #include "components/sync/base/model_type.h"
|
| -#include "components/sync/core/configure_reason.h"
|
| -#include "components/sync/core/internal_components_factory.h"
|
| -#include "components/sync/core_impl/model_type_connector_proxy.h"
|
| -#include "components/sync/core_impl/syncapi_internal.h"
|
| +#include "components/sync/engine/configure_reason.h"
|
| +#include "components/sync/engine/engine_components_factory.h"
|
| +#include "components/sync/engine/engine_util.h"
|
| #include "components/sync/engine/net/http_post_provider_factory.h"
|
| #include "components/sync/engine/polling_constants.h"
|
| #include "components/sync/engine_impl/cycle/directory_type_debug_info_emitter.h"
|
| +#include "components/sync/engine_impl/model_type_connector_proxy.h"
|
| #include "components/sync/engine_impl/net/sync_server_connection_manager.h"
|
| #include "components/sync/engine_impl/sync_scheduler.h"
|
| #include "components/sync/engine_impl/syncer_types.h"
|
| @@ -251,8 +251,8 @@ void SyncManagerImpl::Init(InitArgs* args) {
|
| DCHECK(absolute_db_path.IsAbsolute());
|
|
|
| std::unique_ptr<syncable::DirectoryBackingStore> backing_store =
|
| - args->internal_components_factory->BuildDirectoryBackingStore(
|
| - InternalComponentsFactory::STORAGE_ON_DISK,
|
| + args->engine_components_factory->BuildDirectoryBackingStore(
|
| + EngineComponentsFactory::STORAGE_ON_DISK,
|
| args->credentials.account_id, absolute_db_path);
|
|
|
| DCHECK(backing_store.get());
|
| @@ -305,11 +305,11 @@ void SyncManagerImpl::Init(InitArgs* args) {
|
| std::vector<SyncEngineEventListener*> listeners;
|
| listeners.push_back(&allstatus_);
|
| listeners.push_back(this);
|
| - cycle_context_ = args->internal_components_factory->BuildContext(
|
| + cycle_context_ = args->engine_components_factory->BuildContext(
|
| connection_manager_.get(), directory(), args->extensions_activity,
|
| listeners, &debug_info_event_listener_, model_type_registry_.get(),
|
| args->invalidator_client_id);
|
| - scheduler_ = args->internal_components_factory->BuildScheduler(
|
| + scheduler_ = args->engine_components_factory->BuildScheduler(
|
| name_, cycle_context_.get(), args->cancelation_signal);
|
|
|
| scheduler_->Start(SyncScheduler::CONFIGURATION_MODE, base::Time());
|
| @@ -326,19 +326,21 @@ void SyncManagerImpl::Init(InitArgs* args) {
|
| }
|
|
|
| void SyncManagerImpl::NotifyInitializationSuccess() {
|
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
|
| - OnInitializationComplete(
|
| - MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()),
|
| - MakeWeakHandle(debug_info_event_listener_.GetWeakPtr()),
|
| - true, InitialSyncEndedTypes()));
|
| + for (auto& observer : observers_) {
|
| + observer.OnInitializationComplete(
|
| + MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()),
|
| + MakeWeakHandle(debug_info_event_listener_.GetWeakPtr()), true,
|
| + InitialSyncEndedTypes());
|
| + }
|
| }
|
|
|
| void SyncManagerImpl::NotifyInitializationFailure() {
|
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
|
| - OnInitializationComplete(
|
| - MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()),
|
| - MakeWeakHandle(debug_info_event_listener_.GetWeakPtr()),
|
| - false, ModelTypeSet()));
|
| + for (auto& observer : observers_) {
|
| + observer.OnInitializationComplete(
|
| + MakeWeakHandle(weak_ptr_factory_.GetWeakPtr()),
|
| + MakeWeakHandle(debug_info_event_listener_.GetWeakPtr()), false,
|
| + ModelTypeSet());
|
| + }
|
| }
|
|
|
| void SyncManagerImpl::OnPassphraseRequired(
|
| @@ -579,19 +581,22 @@ void SyncManagerImpl::OnServerConnectionEvent(
|
| const ServerConnectionEvent& event) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| if (event.connection_code == HttpResponse::SERVER_CONNECTION_OK) {
|
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
|
| - OnConnectionStatusChange(CONNECTION_OK));
|
| + for (auto& observer : observers_) {
|
| + observer.OnConnectionStatusChange(CONNECTION_OK);
|
| + }
|
| }
|
|
|
| if (event.connection_code == HttpResponse::SYNC_AUTH_ERROR) {
|
| observing_network_connectivity_changes_ = false;
|
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
|
| - OnConnectionStatusChange(CONNECTION_AUTH_ERROR));
|
| + for (auto& observer : observers_) {
|
| + observer.OnConnectionStatusChange(CONNECTION_AUTH_ERROR);
|
| + }
|
| }
|
|
|
| if (event.connection_code == HttpResponse::SYNC_SERVER_ERROR) {
|
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
|
| - OnConnectionStatusChange(CONNECTION_SERVER_ERROR));
|
| + for (auto& observer : observers_) {
|
| + observer.OnConnectionStatusChange(CONNECTION_SERVER_ERROR);
|
| + }
|
| }
|
| }
|
|
|
| @@ -817,14 +822,16 @@ void SyncManagerImpl::OnSyncCycleEvent(const SyncCycleEvent& event) {
|
| }
|
|
|
| DVLOG(1) << "Sending OnSyncCycleCompleted";
|
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
|
| - OnSyncCycleCompleted(event.snapshot));
|
| + for (auto& observer : observers_) {
|
| + observer.OnSyncCycleCompleted(event.snapshot);
|
| + }
|
| }
|
| }
|
|
|
| void SyncManagerImpl::OnActionableError(const SyncProtocolError& error) {
|
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
|
| - OnActionableError(error));
|
| + for (auto& observer : observers_) {
|
| + observer.OnActionableError(error);
|
| + }
|
| }
|
|
|
| void SyncManagerImpl::OnRetryTimeChanged(base::Time) {}
|
| @@ -832,13 +839,16 @@ void SyncManagerImpl::OnRetryTimeChanged(base::Time) {}
|
| void SyncManagerImpl::OnThrottledTypesChanged(ModelTypeSet) {}
|
|
|
| void SyncManagerImpl::OnMigrationRequested(ModelTypeSet types) {
|
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_,
|
| - OnMigrationRequested(types));
|
| + for (auto& observer : observers_) {
|
| + observer.OnMigrationRequested(types);
|
| + }
|
| }
|
|
|
| void SyncManagerImpl::OnProtocolEvent(const ProtocolEvent& event) {
|
| protocol_event_buffer_.RecordProtocolEvent(event);
|
| - FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnProtocolEvent(event));
|
| + for (auto& observer : observers_) {
|
| + observer.OnProtocolEvent(event);
|
| + }
|
| }
|
|
|
| void SyncManagerImpl::SetJsEventHandler(
|
|
|