#include "components/domain_reliability/scheduler.h"
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <utility>
#include "base/metrics/field_trial.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "components/domain_reliability/config.h"
#include "components/domain_reliability/util.h"
#include "net/base/backoff_entry.h"
namespace {
const unsigned kInvalidCollectorIndex = …;
const unsigned kDefaultMinimumUploadDelaySec = …;
const unsigned kDefaultMaximumUploadDelaySec = …;
const unsigned kDefaultUploadRetryIntervalSec = …;
const char* kMinimumUploadDelayFieldTrialName = …;
const char* kMaximumUploadDelayFieldTrialName = …;
const char* kUploadRetryIntervalFieldTrialName = …;
const double kMultiplyFactor = …;
const double kJitterFactor = …;
const int64_t kMaximumBackoffMs = …;
unsigned GetUnsignedFieldTrialValueOrDefault(std::string field_trial_name,
unsigned default_value) { … }
}
namespace domain_reliability {
DomainReliabilityScheduler::Params
DomainReliabilityScheduler::Params::GetFromFieldTrialsOrDefaults() { … }
DomainReliabilityScheduler::DomainReliabilityScheduler(
const MockableTime* time,
size_t num_collectors,
const Params& params,
const ScheduleUploadCallback& callback)
: … { … }
DomainReliabilityScheduler::~DomainReliabilityScheduler() { … }
void DomainReliabilityScheduler::OnBeaconAdded() { … }
size_t DomainReliabilityScheduler::OnUploadStart() { … }
void DomainReliabilityScheduler::OnUploadComplete(
const DomainReliabilityUploader::UploadResult& result) { … }
void DomainReliabilityScheduler::MakeDeterministicForTesting() { … }
void DomainReliabilityScheduler::MaybeScheduleUpload() { … }
void DomainReliabilityScheduler::GetNextUploadTimeAndCollector(
base::TimeTicks now,
base::TimeTicks* upload_time_out,
size_t* collector_index_out) { … }
}