Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(789)

Unified Diff: net/http/http_server_properties_impl.cc

Issue 2901093004: Add and persist a new field in AlternativeServiceInfo to list QUIC verisons advertised (Closed)
Patch Set: fix Canonical test Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_server_properties_impl.h ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties_impl.cc
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index b96a4b27d707291d89ce5a9629f96cf4b447cb48..843a01719c06070e496944c42807e40dff8a3539 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -287,8 +287,16 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfos(
++it;
continue;
}
- valid_alternative_service_infos.push_back(
- AlternativeServiceInfo(alternative_service, it->expiration()));
+ if (alternative_service.protocol == kProtoQUIC) {
+ valid_alternative_service_infos.push_back(
+ AlternativeServiceInfo::CreateQuicAlternativeServiceInfo(
+ alternative_service, it->expiration(),
+ it->advertised_versions()));
+ } else {
+ valid_alternative_service_infos.push_back(
+ AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo(
+ alternative_service, it->expiration()));
+ }
++it;
}
if (map_it->second.empty()) {
@@ -323,8 +331,16 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfos(
++it;
continue;
}
- valid_alternative_service_infos.push_back(
- AlternativeServiceInfo(alternative_service, it->expiration()));
+ if (alternative_service.protocol == kProtoQUIC) {
+ valid_alternative_service_infos.push_back(
+ AlternativeServiceInfo::CreateQuicAlternativeServiceInfo(
+ alternative_service, it->expiration(),
+ it->advertised_versions()));
+ } else {
+ valid_alternative_service_infos.push_back(
+ AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo(
+ alternative_service, it->expiration()));
+ }
++it;
}
if (map_it->second.empty()) {
@@ -333,14 +349,31 @@ HttpServerPropertiesImpl::GetAlternativeServiceInfos(
return valid_alternative_service_infos;
}
-bool HttpServerPropertiesImpl::SetAlternativeService(
+bool HttpServerPropertiesImpl::SetHttp2AlternativeService(
const url::SchemeHostPort& origin,
const AlternativeService& alternative_service,
base::Time expiration) {
+ DCHECK_EQ(alternative_service.protocol, kProtoHTTP2);
+
return SetAlternativeServices(
origin,
AlternativeServiceInfoVector(
- /*size=*/1, AlternativeServiceInfo(alternative_service, expiration)));
+ /*size=*/1, AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo(
+ alternative_service, expiration)));
+}
+
+bool HttpServerPropertiesImpl::SetQuicAlternativeService(
+ const url::SchemeHostPort& origin,
+ const AlternativeService& alternative_service,
+ base::Time expiration,
+ const QuicVersionVector& advertised_versions) {
+ DCHECK(alternative_service.protocol == kProtoQUIC);
+
+ return SetAlternativeServices(
+ origin, AlternativeServiceInfoVector(
+ /*size=*/1,
+ AlternativeServiceInfo::CreateQuicAlternativeServiceInfo(
+ alternative_service, expiration, advertised_versions)));
}
bool HttpServerPropertiesImpl::SetAlternativeServices(
@@ -380,6 +413,12 @@ bool HttpServerPropertiesImpl::SetAlternativeServices(
changed = true;
break;
}
+ // Also persist to disk if new entry has a different list of advertised
+ // versions.
+ if (old.advertised_versions() != new_it->advertised_versions()) {
+ changed = true;
+ break;
+ }
++new_it;
}
}
« no previous file with comments | « net/http/http_server_properties_impl.h ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698