#include "components/sync_user_events/user_event_sync_bridge.h"
#include <array>
#include <map>
#include <set>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/numerics/byte_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/trace_event.h"
#include "components/sync/model/data_type_store_with_in_memory_cache.h"
#include "components/sync/model/entity_change.h"
#include "components/sync/model/metadata_batch.h"
#include "components/sync/model/mutable_data_batch.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync/protocol/user_event_specifics.pb.h"
namespace syncer {
UserEventSpecifics;
namespace {
std::string GetStorageKeyFromSpecifics(const UserEventSpecifics& specifics) { … }
int64_t GetEventTimeFromStorageKey(const std::string& storage_key) { … }
std::unique_ptr<EntityData> MoveToEntityData(
std::unique_ptr<UserEventSpecifics> specifics) { … }
}
UserEventSyncBridge::UserEventSyncBridge(
OnceDataTypeStoreFactory store_factory,
std::unique_ptr<DataTypeLocalChangeProcessor> change_processor,
GlobalIdMapper* global_id_mapper)
: … { … }
UserEventSyncBridge::~UserEventSyncBridge() = default;
std::unique_ptr<MetadataChangeList>
UserEventSyncBridge::CreateMetadataChangeList() { … }
std::optional<ModelError> UserEventSyncBridge::MergeFullSyncData(
std::unique_ptr<MetadataChangeList> metadata_change_list,
EntityChangeList entity_data) { … }
std::optional<ModelError> UserEventSyncBridge::ApplyIncrementalSyncChanges(
std::unique_ptr<MetadataChangeList> metadata_change_list,
EntityChangeList entity_changes) { … }
std::unique_ptr<DataBatch> UserEventSyncBridge::GetDataForCommit(
StorageKeyList storage_keys) { … }
std::unique_ptr<DataBatch> UserEventSyncBridge::GetAllDataForDebugging() { … }
std::string UserEventSyncBridge::GetClientTag(const EntityData& entity_data) { … }
std::string UserEventSyncBridge::GetStorageKey(const EntityData& entity_data) { … }
void UserEventSyncBridge::ApplyDisableSyncChanges(
std::unique_ptr<MetadataChangeList> delete_metadata_change_list) { … }
void UserEventSyncBridge::RecordUserEvent(
std::unique_ptr<UserEventSpecifics> specifics) { … }
std::string UserEventSyncBridge::GetStorageKeyFromSpecificsForTest(
const UserEventSpecifics& specifics) { … }
std::unique_ptr<DataTypeStore> UserEventSyncBridge::StealStoreForTest() { … }
void UserEventSyncBridge::RecordUserEventImpl(
std::unique_ptr<UserEventSpecifics> specifics) { … }
void UserEventSyncBridge::OnStoreLoaded(
const std::optional<ModelError>& error,
std::unique_ptr<StoreWithCache> store,
std::unique_ptr<MetadataBatch> metadata_batch) { … }
void UserEventSyncBridge::OnStoreCommit(
const std::optional<ModelError>& error) { … }
void UserEventSyncBridge::HandleGlobalIdChange(int64_t old_global_id,
int64_t new_global_id) { … }
}