#include "components/sync/service/glue/sync_engine_backend.h"
#include <utility>
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "components/sync/base/legacy_directory_deletion.h"
#include "components/sync/base/sync_invalidation_adapter.h"
#include "components/sync/base/sync_stop_metadata_fate.h"
#include "components/sync/engine/cycle/sync_cycle_snapshot.h"
#include "components/sync/engine/data_type_activation_response.h"
#include "components/sync/engine/engine_components_factory.h"
#include "components/sync/engine/events/protocol_event.h"
#include "components/sync/engine/net/http_post_provider_factory.h"
#include "components/sync/engine/shutdown_reason.h"
#include "components/sync/engine/sync_manager.h"
#include "components/sync/engine/sync_manager_factory.h"
#include "components/sync/model/forwarding_data_type_controller_delegate.h"
#include "components/sync/nigori/nigori_data_type_processor.h"
#include "components/sync/nigori/nigori_storage_impl.h"
#include "components/sync/nigori/nigori_sync_bridge_impl.h"
#include "components/sync/protocol/sync_invalidations_payload.pb.h"
#include "components/sync/service/configure_context.h"
#include "components/sync/service/data_type_controller.h"
#include "components/sync/service/glue/sync_engine_impl.h"
#define SDVLOG(verbose_level) …
namespace syncer {
namespace {
const base::FilePath::CharType kNigoriStorageFilename[] = …);
void RecordInvalidationPerDataType(DataType type) { … }
void RecordIncomingInvalidationStatus(
SyncEngineBackend::IncomingInvalidationStatus status) { … }
}
SyncEngineBackend::RestoredLocalTransportData::RestoredLocalTransportData() =
default;
SyncEngineBackend::RestoredLocalTransportData::RestoredLocalTransportData(
RestoredLocalTransportData&&) = default;
SyncEngineBackend::RestoredLocalTransportData::~RestoredLocalTransportData() =
default;
SyncEngineBackend::SyncEngineBackend(const std::string& name,
const base::FilePath& sync_data_folder,
const base::WeakPtr<SyncEngineImpl>& host)
: … { … }
SyncEngineBackend::~SyncEngineBackend() { … }
void SyncEngineBackend::OnSyncCycleCompleted(
const SyncCycleSnapshot& snapshot) { … }
void SyncEngineBackend::DoRefreshTypes(DataTypeSet types) { … }
void SyncEngineBackend::OnConnectionStatusChange(ConnectionStatus status) { … }
void SyncEngineBackend::OnActionableProtocolError(
const SyncProtocolError& sync_error) { … }
void SyncEngineBackend::OnMigrationRequested(DataTypeSet types) { … }
void SyncEngineBackend::OnProtocolEvent(const ProtocolEvent& event) { … }
void SyncEngineBackend::OnSyncStatusChanged(const SyncStatus& status) { … }
void SyncEngineBackend::DoOnInvalidatorStateChange(bool enabled) { … }
void SyncEngineBackend::DoInitialize(
SyncEngine::InitParams params,
RestoredLocalTransportData restored_local_transport_data) { … }
void SyncEngineBackend::DoUpdateCredentials(
const SyncCredentials& credentials) { … }
void SyncEngineBackend::DoInvalidateCredentials() { … }
void SyncEngineBackend::DoStartConfiguration() { … }
void SyncEngineBackend::DoStartSyncing(base::Time last_poll_time) { … }
void SyncEngineBackend::DoSetEncryptionPassphrase(
const std::string& passphrase,
const KeyDerivationParams& key_derivation_params) { … }
void SyncEngineBackend::DoAddTrustedVaultDecryptionKeys(
const std::vector<std::vector<uint8_t>>& keys) { … }
void SyncEngineBackend::DoInitialProcessControlTypes() { … }
void SyncEngineBackend::DoSetExplicitPassphraseDecryptionKey(
std::unique_ptr<Nigori> key) { … }
void SyncEngineBackend::ShutdownOnUIThread() { … }
void SyncEngineBackend::DoShutdown(ShutdownReason reason) { … }
void SyncEngineBackend::DoPurgeDisabledTypes(const DataTypeSet& to_purge) { … }
void SyncEngineBackend::DoConfigureSyncer(
DataTypeConfigurer::ConfigureParams params) { … }
void SyncEngineBackend::DoFinishConfigureDataTypes(
DataTypeSet types_to_download,
base::OnceCallback<void(DataTypeSet, DataTypeSet)> ready_task) { … }
void SyncEngineBackend::SendBufferedProtocolEventsAndEnableForwarding() { … }
void SyncEngineBackend::DisableProtocolEventForwarding() { … }
void SyncEngineBackend::DoOnCookieJarChanged(bool account_mismatch,
base::OnceClosure callback) { … }
void SyncEngineBackend::DoOnStandaloneInvalidationReceived(
const std::string& payload,
const DataTypeSet& interested_data_types) { … }
SyncEngineBackend::IncomingInvalidationStatus
SyncEngineBackend::DoOnStandaloneInvalidationReceivedImpl(
const std::string& payload,
const DataTypeSet& interested_data_types) { … }
void SyncEngineBackend::DoOnActiveDevicesChanged(
ActiveDevicesInvalidationInfo active_devices_invalidation_info) { … }
void SyncEngineBackend::GetNigoriNodeForDebugging(AllNodesCallback callback) { … }
void SyncEngineBackend::RecordNigoriMemoryUsageAndCountsHistograms() { … }
bool SyncEngineBackend::HasUnsyncedItemsForTest() const { … }
DataTypeSet SyncEngineBackend::GetTypesWithUnsyncedData() const { … }
void SyncEngineBackend::LoadAndConnectNigoriController() { … }
}