Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions net/http/http_network_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,12 @@ void HttpNetworkSession::DisableQuic() {
params_.enable_quic = false;
}

#if BUILDFLAG(IS_ANDROIDTV)
Comment thread
ckim1346 marked this conversation as resolved.
Outdated
bool HttpNetworkSession::UseQuicForUnknownOrigin() const {
return params_.use_quic_for_unknown_origins;
}
#endif

bool HttpNetworkSession::ShouldForceQuic(const url::SchemeHostPort& destination,
const ProxyInfo& proxy_info,
bool is_websocket) {
Expand Down
11 changes: 11 additions & 0 deletions net/http/http_network_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ struct NET_EXPORT HttpNetworkSessionParams {
// Enables QUIC support.
bool enable_quic = true;

#if BUILDFLAG(IS_ANDROIDTV)
Comment thread
ckim1346 marked this conversation as resolved.
Outdated
// If true, request to an origin without recorded alt-svc info will
// try to establish both QUIC and TCP connections and use the faster one.
bool use_quic_for_unknown_origins = false;
#endif

// If non-empty, QUIC will only be spoken to hosts in this list.
base::flat_set<std::string> quic_host_allowlist;

Expand Down Expand Up @@ -303,6 +309,11 @@ class NET_EXPORT HttpNetworkSession : public base::PowerSuspendObserver {
// Disable QUIC for new streams.
void DisableQuic();

#if BUILDFLAG(IS_ANDROIDTV)
Comment thread
ckim1346 marked this conversation as resolved.
Outdated
// Whether to try QUIC connection for origins without alt-svc on record.
bool UseQuicForUnknownOrigin() const;
#endif

// Returns true when QUIC is forcibly used for `destination`.
bool ShouldForceQuic(const url::SchemeHostPort& destination,
const ProxyInfo& proxy_info,
Expand Down
16 changes: 16 additions & 0 deletions net/http/http_stream_factory_job_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,22 @@ HttpStreamFactory::JobController::GetAlternativeServiceInfoInternal(
url::SchemeHostPort(original_url),
request_info.network_anonymization_key);
if (alternative_service_info_vector.empty()) {
#if BUILDFLAG(IS_ANDROIDTV)
Comment thread
ckim1346 marked this conversation as resolved.
Outdated
if (session_->IsQuicEnabled() && session_->UseQuicForUnknownOrigin()) {
Comment thread
ckim1346 marked this conversation as resolved.
url::SchemeHostPort origin(original_url);
#if defined(COBALT_BUILD_TYPE_GOLD)
Comment thread
ckim1346 marked this conversation as resolved.
const int kDefaultQUICServerPort = 443;
if (origin.port() == kDefaultQUICServerPort) {
#endif
quic::ParsedQuicVersionVector versions = quic::AllSupportedVersions();
return AlternativeServiceInfo::CreateQuicAlternativeServiceInfo(
AlternativeService(NextProto::kProtoQUIC, origin.host(), origin.port()),
base::Time::Max(), versions);
#if defined(COBALT_BUILD_TYPE_GOLD)
}
#endif
Comment thread
ckim1346 marked this conversation as resolved.
}
#endif // BUILDFLAG(IS_ANDROIDTV)
return AlternativeServiceInfo();
}

Expand Down
4 changes: 4 additions & 0 deletions services/network/network_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2914,6 +2914,10 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
*base::CommandLine::ForCurrentProcess(), is_quic_force_disabled,
&session_params, quic_context->params());

#if BUILDFLAG(IS_ANDROIDTV)
Comment thread
ckim1346 marked this conversation as resolved.
Outdated
session_params.use_quic_for_unknown_origins = true;
#endif

session_params.disable_idle_sockets_close_on_memory_pressure =
params_->disable_idle_sockets_close_on_memory_pressure;

Expand Down
Loading