chromium/components/reading_list/core/reading_list_sync_bridge.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/reading_list/core/reading_list_sync_bridge.h"

#include <set>
#include <utility>

#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/time/clock.h"
#include "base/trace_event/trace_event.h"
#include "components/reading_list/core/reading_list_model_impl.h"
#include "components/sync/base/data_type_histogram.h"
#include "components/sync/base/deletion_origin.h"
#include "components/sync/model/data_type_local_change_processor.h"
#include "components/sync/model/data_type_store.h"
#include "components/sync/model/entity_change.h"
#include "components/sync/model/in_memory_metadata_change_list.h"
#include "components/sync/model/metadata_batch.h"
#include "components/sync/model/mutable_data_batch.h"
#include "components/sync/protocol/data_type_state.pb.h"
#include "components/sync/protocol/data_type_state_helper.h"

ReadingListSyncBridge::ReadingListSyncBridge(
    syncer::StorageType storage_type,
    syncer::WipeModelUponSyncDisabledBehavior
        wipe_model_upon_sync_disabled_behavior,
    base::Clock* clock,
    std::unique_ptr<syncer::DataTypeLocalChangeProcessor> change_processor)
    :{}

ReadingListSyncBridge::~ReadingListSyncBridge() {}

void ReadingListSyncBridge::ModelReadyToSync(
    ReadingListModelImpl* model,
    std::unique_ptr<syncer::MetadataBatch> sync_metadata_batch) {}

void ReadingListSyncBridge::ReportError(const syncer::ModelError& error) {}

void ReadingListSyncBridge::DidAddOrUpdateEntry(
    const ReadingListEntry& entry,
    syncer::MetadataChangeList* metadata_change_list) {}

void ReadingListSyncBridge::DidRemoveEntry(
    const ReadingListEntry& entry,
    const base::Location& location,
    syncer::MetadataChangeList* metadata_change_list) {}

// IsTrackingMetadata() continues to be true while ApplyDisableSyncChanges() is
// running, but transitions to false immediately afterwards.
// ongoing_apply_disable_sync_changes_ is used to cause IsTrackingMetadata()
// return false slightly earlier, and before related observer notifications are
// triggered.
bool ReadingListSyncBridge::IsTrackingMetadata() const {}

syncer::StorageType ReadingListSyncBridge::GetStorageTypeForUma() const {}

std::unique_ptr<syncer::MetadataChangeList>
ReadingListSyncBridge::CreateMetadataChangeList() {}

// Perform the initial merge between local and sync data. This should only be
// called when a data type is first enabled to start syncing, and there is no
// sync metadata. Best effort should be made to match local and sync data. The
// storage keys in the |entity_data| are populated with GetStorageKey(...),
// local and sync copies of the same entity should resolve to the same storage
// key. Any local pieces of data that are not present in sync should immediately
// be Put(...) to the processor before returning. The same MetadataChangeList
// that was passed into this function can be passed to Put(...) calls.
// Delete(...) can also be called but should not be needed for most data types.
// Durable storage writes, if not able to combine all change atomically, should
// save the metadata after the data changes, so that this merge will be re-
// driven by sync if is not completely saved during the current run.
std::optional<syncer::ModelError> ReadingListSyncBridge::MergeFullSyncData(
    std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
    syncer::EntityChangeList entity_changes) {}

// Apply changes from the sync server locally.
// Please note that |entity_changes| might have fewer entries than
// |metadata_change_list| in case when some of the data changes are filtered
// out, or even be empty in case when a commit confirmation is processed and
// only the metadata needs to persisted.
std::optional<syncer::ModelError>
ReadingListSyncBridge::ApplyIncrementalSyncChanges(
    std::unique_ptr<syncer::MetadataChangeList> metadata_change_list,
    syncer::EntityChangeList entity_changes) {}

std::unique_ptr<syncer::DataBatch> ReadingListSyncBridge::GetDataForCommit(
    StorageKeyList storage_keys) {}

std::unique_ptr<syncer::DataBatch>
ReadingListSyncBridge::GetAllDataForDebugging() {}

void ReadingListSyncBridge::AddEntryToBatch(syncer::MutableDataBatch* batch,
                                            const ReadingListEntry& entry) {}

std::string ReadingListSyncBridge::GetClientTag(
    const syncer::EntityData& entity_data) {}

std::string ReadingListSyncBridge::GetStorageKey(
    const syncer::EntityData& entity_data) {}

void ReadingListSyncBridge::ApplyDisableSyncChanges(
    std::unique_ptr<syncer::MetadataChangeList> delete_metadata_change_list) {}

bool ReadingListSyncBridge::IsEntityDataValid(
    const syncer::EntityData& entity_data) const {}

bool ReadingListSyncBridge::CompareEntriesForSync(
    const sync_pb::ReadingListSpecifics& lhs,
    const sync_pb::ReadingListSpecifics& rhs) {}