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

Unified Diff: net/http/http_server_properties.cc

Issue 2901093004: Add and persist a new field in AlternativeServiceInfo to list QUIC verisons advertised (Closed)
Patch Set: fix compile in components 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.cc
diff --git a/net/http/http_server_properties.cc b/net/http/http_server_properties.cc
index 386a00d0fe3e53c356865c2ce47088f3e245e1b0..e6018a2d32123ab76eecbcf07e0bd49dae1e876c 100644
--- a/net/http/http_server_properties.cc
+++ b/net/http/http_server_properties.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/stringprintf.h"
+#include "net/http/http_network_session.h"
#include "net/socket/ssl_client_socket.h"
#include "net/ssl/ssl_config.h"
@@ -78,6 +79,44 @@ bool IsAlternateProtocolValid(NextProto protocol) {
return false;
}
+AlternativeServiceInfo::AlternativeServiceInfo() : alternative_service() {}
+
+AlternativeServiceInfo::~AlternativeServiceInfo() {}
+
+AlternativeServiceInfo::AlternativeServiceInfo(
+ const AlternativeService& alternative_service,
+ base::Time expiration)
+ : alternative_service(alternative_service), expiration(expiration) {}
+
+AlternativeServiceInfo::AlternativeServiceInfo(
+ const AlternativeService& alternative_service,
+ base::Time expiration,
+ const QuicVersionVector& advertised_versions)
+ : alternative_service(alternative_service), expiration(expiration) {
+ if (alternative_service.protocol == kProtoQUIC) {
+ advertised_versions_ = advertised_versions;
+ std::sort(advertised_versions_.begin(), advertised_versions_.end());
+ }
+}
+
+AlternativeServiceInfo::AlternativeServiceInfo(
+ const AlternativeServiceInfo& alternative_service_info) = default;
+
+AlternativeServiceInfo& AlternativeServiceInfo::operator=(
+ const AlternativeServiceInfo& alternative_service_info) = default;
+
+bool AlternativeServiceInfo::EqualAdvertisedVersions(
+ const AlternativeServiceInfo& other) const {
+ if (alternative_service.protocol != kProtoQUIC)
+ return true;
+
+ // Check equality of advertised versions for QUIC.
+ if (advertised_versions_.size() != other.advertised_versions().size())
+ return false;
Ryan Hamilton 2017/06/07 20:52:23 Is this expression necessary? I suspect == will ju
Zhongyi Shi 2017/06/08 23:11:16 Acknowledged. This method is removed in the new pa
+
+ return advertised_versions_ == other.advertised_versions();
+}
+
std::string AlternativeService::ToString() const {
return base::StringPrintf("%s %s:%d", NextProtoToString(protocol),
host.c_str(), port);

Powered by Google App Engine
This is Rietveld 408576698