#include "components/cronet/stale_host_resolver.h"
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/notreached.h"
#include "base/timer/timer.h"
#include "base/values.h"
#include "net/base/host_port_pair.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/dns/context_host_resolver.h"
#include "net/dns/dns_util.h"
#include "net/dns/host_resolver.h"
#include "net/dns/public/host_resolver_results.h"
#include "net/dns/public/host_resolver_source.h"
#include "net/dns/public/resolve_error_info.h"
#include "net/log/net_log_with_source.h"
#include "url/scheme_host_port.h"
namespace cronet {
class StaleHostResolver::RequestImpl
: public net::HostResolver::ResolveHostRequest { … };
StaleHostResolver::RequestImpl::RequestImpl(
base::WeakPtr<StaleHostResolver> resolver,
const net::HostPortPair& host,
const net::NetworkAnonymizationKey& network_anonymization_key,
const net::NetLogWithSource& net_log,
const ResolveHostParameters& input_parameters,
const base::TickClock* tick_clock)
: … { … }
int StaleHostResolver::RequestImpl::Start(
net::CompletionOnceCallback result_callback) { … }
const net::AddressList* StaleHostResolver::RequestImpl::GetAddressResults()
const { … }
const net::HostResolverEndpointResults*
StaleHostResolver::RequestImpl::GetEndpointResults() const { … }
const std::vector<std::string>* StaleHostResolver::RequestImpl::GetTextResults()
const { … }
const std::vector<net::HostPortPair>*
StaleHostResolver::RequestImpl::GetHostnameResults() const { … }
const std::set<std::string>*
StaleHostResolver::RequestImpl::GetDnsAliasResults() const { … }
net::ResolveErrorInfo StaleHostResolver::RequestImpl::GetResolveErrorInfo()
const { … }
const std::optional<net::HostCache::EntryStaleness>&
StaleHostResolver::RequestImpl::GetStaleInfo() const { … }
void StaleHostResolver::RequestImpl::ChangeRequestPriority(
net::RequestPriority priority) { … }
void StaleHostResolver::RequestImpl::OnNetworkRequestComplete(int error) { … }
bool StaleHostResolver::RequestImpl::CacheDataIsUsable() const { … }
void StaleHostResolver::RequestImpl::OnStaleDelayElapsed() { … }
StaleHostResolver::StaleOptions::StaleOptions()
: … { … }
StaleHostResolver::StaleHostResolver(
std::unique_ptr<net::ContextHostResolver> inner_resolver,
const StaleOptions& stale_options)
: … { … }
StaleHostResolver::~StaleHostResolver() { … }
void StaleHostResolver::OnShutdown() { … }
std::unique_ptr<net::HostResolver::ResolveHostRequest>
StaleHostResolver::CreateRequest(
url::SchemeHostPort host,
net::NetworkAnonymizationKey network_anonymization_key,
net::NetLogWithSource net_log,
std::optional<ResolveHostParameters> optional_parameters) { … }
std::unique_ptr<net::HostResolver::ResolveHostRequest>
StaleHostResolver::CreateRequest(
const net::HostPortPair& host,
const net::NetworkAnonymizationKey& network_anonymization_key,
const net::NetLogWithSource& net_log,
const std::optional<ResolveHostParameters>& optional_parameters) { … }
std::unique_ptr<net::HostResolver::ServiceEndpointRequest>
StaleHostResolver::CreateServiceEndpointRequest(
Host host,
net::NetworkAnonymizationKey network_anonymization_key,
net::NetLogWithSource net_log,
ResolveHostParameters parameters) { … }
net::HostCache* StaleHostResolver::GetHostCache() { … }
base::Value::Dict StaleHostResolver::GetDnsConfigAsValue() const { … }
void StaleHostResolver::SetRequestContext(
net::URLRequestContext* request_context) { … }
void StaleHostResolver::OnNetworkRequestComplete(
ResolveHostRequest* network_request,
base::WeakPtr<RequestImpl> stale_request,
int error) { … }
void StaleHostResolver::DetachRequest(
std::unique_ptr<ResolveHostRequest> request) { … }
void StaleHostResolver::SetTickClockForTesting(
const base::TickClock* tick_clock) { … }
}