#include "net/socket/transport_connect_job.h"
#include <memory>
#include <utility>
#include "base/check_op.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "net/base/features.h"
#include "net/base/host_port_pair.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/trace_constants.h"
#include "net/base/tracing.h"
#include "net/dns/public/host_resolver_results.h"
#include "net/dns/public/secure_dns_policy.h"
#include "net/log/net_log_event_type.h"
#include "net/socket/socket_tag.h"
#include "net/socket/transport_connect_sub_job.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "url/scheme_host_port.h"
#include "url/url_constants.h"
namespace net {
namespace {
HostPortPair ToLegacyDestinationEndpoint(
const TransportSocketParams::Endpoint& endpoint) { … }
}
TransportSocketParams::TransportSocketParams(
Endpoint destination,
NetworkAnonymizationKey network_anonymization_key,
SecureDnsPolicy secure_dns_policy,
OnHostResolutionCallback host_resolution_callback,
base::flat_set<std::string> supported_alpns)
: … { … }
TransportSocketParams::~TransportSocketParams() = default;
std::unique_ptr<TransportConnectJob> TransportConnectJob::Factory::Create(
RequestPriority priority,
const SocketTag& socket_tag,
const CommonConnectJobParams* common_connect_job_params,
const scoped_refptr<TransportSocketParams>& params,
Delegate* delegate,
const NetLogWithSource* net_log) { … }
TransportConnectJob::EndpointResultOverride::EndpointResultOverride(
HostResolverEndpointResult result,
std::set<std::string> dns_aliases)
: … { … }
TransportConnectJob::EndpointResultOverride::EndpointResultOverride(
EndpointResultOverride&&) = default;
TransportConnectJob::EndpointResultOverride::EndpointResultOverride(
const EndpointResultOverride&) = default;
TransportConnectJob::EndpointResultOverride::~EndpointResultOverride() =
default;
TransportConnectJob::TransportConnectJob(
RequestPriority priority,
const SocketTag& socket_tag,
const CommonConnectJobParams* common_connect_job_params,
const scoped_refptr<TransportSocketParams>& params,
Delegate* delegate,
const NetLogWithSource* net_log,
std::optional<EndpointResultOverride> endpoint_result_override)
: … { … }
TransportConnectJob::~TransportConnectJob() = default;
LoadState TransportConnectJob::GetLoadState() const { … }
bool TransportConnectJob::HasEstablishedConnection() const { … }
ConnectionAttempts TransportConnectJob::GetConnectionAttempts() const { … }
ResolveErrorInfo TransportConnectJob::GetResolveErrorInfo() const { … }
std::optional<HostResolverEndpointResult>
TransportConnectJob::GetHostResolverEndpointResult() const { … }
base::TimeDelta TransportConnectJob::ConnectionTimeout() { … }
void TransportConnectJob::OnIOComplete(int result) { … }
int TransportConnectJob::DoLoop(int result) { … }
int TransportConnectJob::DoResolveHost() { … }
int TransportConnectJob::DoResolveHostComplete(int result) { … }
int TransportConnectJob::DoResolveHostCallbackComplete() { … }
int TransportConnectJob::DoTransportConnect() { … }
int TransportConnectJob::DoTransportConnectComplete(int result) { … }
int TransportConnectJob::HandleSubJobComplete(int result,
TransportConnectSubJob* job) { … }
void TransportConnectJob::OnSubJobComplete(int result,
TransportConnectSubJob* job) { … }
void TransportConnectJob::StartIPv4JobAsync() { … }
int TransportConnectJob::ConnectInternal() { … }
void TransportConnectJob::ChangePriorityInternal(RequestPriority priority) { … }
bool TransportConnectJob::IsSvcbOptional(
base::span<const HostResolverEndpointResult> results) const { … }
bool TransportConnectJob::IsEndpointResultUsable(
const HostResolverEndpointResult& result,
bool svcb_optional) const { … }
const HostResolverEndpointResult&
TransportConnectJob::GetEndpointResultForCurrentSubJobs() const { … }
}