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

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 cronet/grpc 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
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 4140e1d6e35ae5dd9ed1ad236a66779aee6d4fcf..65eb7fde8fd21cd50fbd9aaf6850460bb8a15e42 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -322,8 +322,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()) {
@@ -358,8 +366,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()) {
@@ -368,14 +384,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(alternative_service.protocol != kProtoQUIC);
Bence 2017/06/16 14:43:40 Optional: this is not necessary, as CreateHttp2Alt
Zhongyi Shi 2017/06/20 23:23:37 Done.
+
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(
@@ -415,6 +448,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;
}
}

Powered by Google App Engine
This is Rietveld 408576698