#include "components/sync/engine/cycle/data_type_tracker.h"
#include <algorithm>
#include <memory>
#include "base/check.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "components/sync/base/data_type.h"
#include "components/sync/base/features.h"
#include "components/sync/engine/polling_constants.h"
#include "components/sync/protocol/data_type_progress_marker.pb.h"
namespace syncer {
namespace {
constexpr base::TimeDelta kMinLocalChangeNudgeDelay = …;
constexpr base::TimeDelta kMediumLocalChangeNudgeDelay = …;
constexpr base::TimeDelta kBigLocalChangeNudgeDelay = …;
constexpr base::TimeDelta kVeryBigLocalChangeNudgeDelay = …;
constexpr base::TimeDelta kDefaultLocalChangeNudgeDelayForSessions = …;
constexpr base::TimeDelta kRemoteInvalidationDelay = …;
constexpr base::TimeDelta kDepletedQuotaNudgeDelayForExtensionTypes = …;
constexpr base::TimeDelta kRefillIntervalForExtensionTypes = …;
constexpr int kInitialTokensForExtensionTypes = …;
base::TimeDelta GetDefaultLocalChangeNudgeDelay(DataType data_type) { … }
bool CanGetCommitsFromExtensions(DataType data_type) { … }
}
WaitInterval::WaitInterval(BlockingMode mode, base::TimeDelta length)
: … { … }
WaitInterval::~WaitInterval() = default;
DataTypeTracker::DataTypeTracker(DataType type)
: … { … }
DataTypeTracker::~DataTypeTracker() = default;
void DataTypeTracker::RecordLocalChange() { … }
void DataTypeTracker::RecordLocalRefreshRequest() { … }
void DataTypeTracker::RecordInitialSyncRequired() { … }
void DataTypeTracker::RecordCommitConflict() { … }
void DataTypeTracker::RecordSuccessfulCommitMessage() { … }
void DataTypeTracker::RecordSuccessfulSyncCycleIfNotBlocked() { … }
void DataTypeTracker::RecordInitialSyncDone() { … }
bool DataTypeTracker::IsSyncRequired() const { … }
bool DataTypeTracker::IsGetUpdatesRequired() const { … }
bool DataTypeTracker::HasLocalChangePending() const { … }
bool DataTypeTracker::HasRefreshRequestPending() const { … }
bool DataTypeTracker::HasPendingInvalidation() const { … }
bool DataTypeTracker::IsInitialSyncRequired() const { … }
bool DataTypeTracker::IsSyncRequiredToResolveConflict() const { … }
void DataTypeTracker::FillGetUpdatesTriggersMessage(
sync_pb::GetUpdateTriggers* msg) { … }
bool DataTypeTracker::IsBlocked() const { … }
base::TimeDelta DataTypeTracker::GetTimeUntilUnblock() const { … }
base::TimeDelta DataTypeTracker::GetLastBackoffInterval() const { … }
void DataTypeTracker::ThrottleType(base::TimeDelta duration,
base::TimeTicks now) { … }
void DataTypeTracker::BackOffType(base::TimeDelta duration,
base::TimeTicks now) { … }
void DataTypeTracker::UpdateThrottleOrBackoffState() { … }
void DataTypeTracker::SetHasPendingInvalidations(
bool has_pending_invalidations) { … }
void DataTypeTracker::UpdateLocalChangeNudgeDelay(base::TimeDelta delay) { … }
base::TimeDelta DataTypeTracker::GetLocalChangeNudgeDelay(
bool is_single_client) const { … }
base::TimeDelta DataTypeTracker::GetRemoteInvalidationDelay() const { … }
WaitInterval::BlockingMode DataTypeTracker::GetBlockingMode() const { … }
void DataTypeTracker::SetLocalChangeNudgeDelayIgnoringMinForTest(
base::TimeDelta delay) { … }
void DataTypeTracker::SetQuotaParamsIfExtensionType(
std::optional<int> max_tokens,
std::optional<base::TimeDelta> refill_interval,
std::optional<base::TimeDelta> depleted_quota_nudge_delay) { … }
}