#include "components/sync/service/data_type_controller.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/task/sequenced_task_runner.h"
#include "components/sync/base/data_type.h"
#include "components/sync/engine/data_type_activation_response.h"
#include "components/sync/model/data_type_activation_request.h"
#include "components/sync/model/type_entities_count.h"
#include "components/sync/service/configure_context.h"
namespace syncer {
namespace {
void ReportErrorOnModelThread(
scoped_refptr<base::SequencedTaskRunner> ui_thread,
const ModelErrorHandler& error_handler,
const ModelError& error) { … }
SyncStopMetadataFate TakeStrictestMetadataFate(SyncStopMetadataFate fate1,
SyncStopMetadataFate fate2) { … }
}
std::string DataTypeController::StateToString(State state) { … }
DataTypeController::DataTypeController(
DataType type,
std::unique_ptr<DataTypeLocalDataBatchUploader> batch_uploader)
: … { … }
DataTypeController::DataTypeController(
DataType type,
std::unique_ptr<DataTypeControllerDelegate> delegate_for_full_sync_mode,
std::unique_ptr<DataTypeControllerDelegate> delegate_for_transport_mode,
std::unique_ptr<DataTypeLocalDataBatchUploader> batch_uploader)
: … { … }
DataTypeController::~DataTypeController() = default;
void DataTypeController::InitDataTypeController(
std::unique_ptr<DataTypeControllerDelegate> delegate_for_full_sync_mode,
std::unique_ptr<DataTypeControllerDelegate> delegate_for_transport_mode) { … }
void DataTypeController::LoadModels(
const ConfigureContext& configure_context,
const ModelLoadCallback& model_load_callback) { … }
std::unique_ptr<DataTypeActivationResponse> DataTypeController::Connect() { … }
void DataTypeController::Stop(SyncStopMetadataFate fate,
StopCallback callback) { … }
DataTypeController::State DataTypeController::state() const { … }
DataTypeController::PreconditionState
DataTypeController::GetPreconditionState() const { … }
bool DataTypeController::ShouldRunInTransportOnlyMode() const { … }
void DataTypeController::HasUnsyncedData(
base::OnceCallback<void(bool)> callback) { … }
void DataTypeController::GetAllNodes(AllNodesCallback callback) { … }
void DataTypeController::GetTypeEntitiesCount(
base::OnceCallback<void(const TypeEntitiesCount&)> callback) const { … }
void DataTypeController::RecordMemoryUsageAndCountsHistograms() { … }
DataTypeLocalDataBatchUploader*
DataTypeController::GetLocalDataBatchUploader() { … }
void DataTypeController::ReportBridgeErrorForTest() { … }
DataTypeControllerDelegate* DataTypeController::GetDelegateForTesting(
SyncMode sync_mode) { … }
void DataTypeController::ReportModelError(SyncError::ErrorType error_type,
const ModelError& error) { … }
bool DataTypeController::CalledOnValidThread() const { … }
void DataTypeController::ClearDelegateMap() { … }
void DataTypeController::RecordStartFailure() const { … }
void DataTypeController::RecordRunFailure() const { … }
void DataTypeController::OnDelegateStarted(
std::unique_ptr<DataTypeActivationResponse> activation_response) { … }
void DataTypeController::TriggerCompletionCallbacks(const SyncError& error) { … }
void DataTypeController::ClearMetadataIfStopped() { … }
}