#include "net/http/broken_alternative_services.h"
#include "base/containers/adapters.h"
#include "base/functional/bind.h"
#include "base/memory/singleton.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "net/http/http_server_properties.h"
namespace net {
namespace {
constexpr base::TimeDelta kDefaultBrokenAlternativeProtocolDelay = …;
const int kBrokenDelayMaxShift = …;
constexpr base::TimeDelta kMinBrokenAlternativeProtocolDelay = …;
constexpr base::TimeDelta kMaxBrokenAlternativeProtocolDelay = …;
base::TimeDelta ComputeBrokenAlternativeServiceExpirationDelay(
int broken_count,
base::TimeDelta initial_delay,
bool exponential_backoff_on_initial_delay) { … }
}
BrokenAlternativeService::BrokenAlternativeService(
const AlternativeService& alternative_service,
const NetworkAnonymizationKey& network_anonymization_key,
bool use_network_anonymization_key)
: … { … }
BrokenAlternativeService::~BrokenAlternativeService() = default;
bool BrokenAlternativeService::operator<(
const BrokenAlternativeService& other) const { … }
BrokenAlternativeServices::BrokenAlternativeServices(
int max_recently_broken_alternative_service_entries,
Delegate* delegate,
const base::TickClock* clock)
: … { … }
BrokenAlternativeServices::~BrokenAlternativeServices() = default;
void BrokenAlternativeServices::Clear() { … }
void BrokenAlternativeServices::MarkBrokenUntilDefaultNetworkChanges(
const BrokenAlternativeService& broken_alternative_service) { … }
void BrokenAlternativeServices::MarkBroken(
const BrokenAlternativeService& broken_alternative_service) { … }
void BrokenAlternativeServices::MarkBrokenImpl(
const BrokenAlternativeService& broken_alternative_service) { … }
void BrokenAlternativeServices::MarkRecentlyBroken(
const BrokenAlternativeService& broken_alternative_service) { … }
bool BrokenAlternativeServices::IsBroken(
const BrokenAlternativeService& broken_alternative_service) const { … }
bool BrokenAlternativeServices::IsBroken(
const BrokenAlternativeService& broken_alternative_service,
base::TimeTicks* brokenness_expiration) const { … }
bool BrokenAlternativeServices::WasRecentlyBroken(
const BrokenAlternativeService& broken_alternative_service) { … }
void BrokenAlternativeServices::Confirm(
const BrokenAlternativeService& broken_alternative_service) { … }
bool BrokenAlternativeServices::OnDefaultNetworkChanged() { … }
void BrokenAlternativeServices::SetBrokenAndRecentlyBrokenAlternativeServices(
std::unique_ptr<BrokenAlternativeServiceList>
broken_alternative_service_list,
std::unique_ptr<RecentlyBrokenAlternativeServices>
recently_broken_alternative_services) { … }
void BrokenAlternativeServices::SetDelayParams(
std::optional<base::TimeDelta> initial_delay,
std::optional<bool> exponential_backoff_on_initial_delay) { … }
const BrokenAlternativeServiceList&
BrokenAlternativeServices::broken_alternative_service_list() const { … }
const RecentlyBrokenAlternativeServices&
BrokenAlternativeServices::recently_broken_alternative_services() const { … }
bool BrokenAlternativeServices::AddToBrokenListAndMap(
const BrokenAlternativeService& broken_alternative_service,
base::TimeTicks expiration,
BrokenAlternativeServiceList::iterator* it) { … }
void BrokenAlternativeServices::ExpireBrokenAlternateProtocolMappings() { … }
void BrokenAlternativeServices ::
ScheduleBrokenAlternateProtocolMappingsExpiration() { … }
}