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

Unified Diff: net/http/http_server_properties.h

Issue 2901093004: Add and persist a new field in AlternativeServiceInfo to list QUIC verisons advertised (Closed)
Patch Set: manually fix rebase issues 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.h
diff --git a/net/http/http_server_properties.h b/net/http/http_server_properties.h
index fc19d24e18b103a384f34507ddf30a277dd5582c..9e3913a9b8db3bc1a1aa50e7e015a669d15c3d65 100644
--- a/net/http/http_server_properties.h
+++ b/net/http/http_server_properties.h
@@ -20,6 +20,7 @@
#include "net/base/net_export.h"
#include "net/quic/core/quic_bandwidth.h"
#include "net/quic/core/quic_server_id.h"
+#include "net/quic/core/quic_versions.h"
#include "net/socket/next_proto.h"
#include "net/spdy/core/spdy_framer.h" // TODO(willchan): Reconsider this.
#include "net/spdy/core/spdy_protocol.h"
@@ -115,27 +116,34 @@ NET_EXPORT_PRIVATE std::ostream& operator<<(
const AlternativeService& alternative_service);
struct NET_EXPORT AlternativeServiceInfo {
- AlternativeServiceInfo() : alternative_service() {}
+ AlternativeServiceInfo();
+ ~AlternativeServiceInfo();
AlternativeServiceInfo(const AlternativeService& alternative_service,
- base::Time expiration)
- : alternative_service(alternative_service),
- expiration(expiration) {}
+ base::Time expiration);
- AlternativeServiceInfo(NextProto protocol,
- const std::string& host,
- uint16_t port,
- base::Time expiration)
- : alternative_service(protocol, host, port), expiration(expiration) {}
+ AlternativeServiceInfo(const AlternativeService& alternative_service,
+ base::Time expiration,
+ const QuicVersionVector& advertised_versions);
xunjieli 2017/06/09 16:41:55 AlternativeService can advertise any protocol. It'
Zhongyi Shi 2017/06/16 00:24:04 As discussed offline, I hide the generic construct
AlternativeServiceInfo(
- const AlternativeServiceInfo& alternative_service_info) = default;
+ const AlternativeServiceInfo& alternative_service_info);
+
AlternativeServiceInfo& operator=(
- const AlternativeServiceInfo& alternative_service_info) = default;
+ const AlternativeServiceInfo& alternative_service_info);
+
+ void set_advertised_versions(const QuicVersionVector& advertised_versions) {
+ if (alternative_service.protocol != kProtoQUIC)
+ return;
+
+ advertised_versions_ = advertised_versions;
+ std::sort(advertised_versions_.begin(), advertised_versions_.end());
+ }
bool operator==(const AlternativeServiceInfo& other) const {
return alternative_service == other.alternative_service &&
- expiration == other.expiration;
+ expiration == other.expiration &&
+ advertised_versions_ == other.advertised_versions();
}
bool operator!=(const AlternativeServiceInfo& other) const {
@@ -144,8 +152,19 @@ struct NET_EXPORT AlternativeServiceInfo {
std::string ToString() const;
+ const QuicVersionVector& advertised_versions() const {
+ return advertised_versions_;
+ }
+
AlternativeService alternative_service;
base::Time expiration;
+
+ private:
+ // Lists all the QUIC versions that are advertised by the server and supported
+ // by Chrome. If empty, defaults to versions used by the current instance of
+ // the netstack.
+ // This list MUST be sorted in ascending order.
+ QuicVersionVector advertised_versions_;
};
struct NET_EXPORT SupportsQuic {
@@ -251,7 +270,8 @@ class NET_EXPORT HttpServerProperties {
virtual bool SetAlternativeService(
const url::SchemeHostPort& origin,
const AlternativeService& alternative_service,
- base::Time expiration) = 0;
+ base::Time expiration,
+ const QuicVersionVector& advertised_versions) = 0;
// Set alternative services for |origin|. Previous alternative services for
// |origin| are discarded.

Powered by Google App Engine
This is Rietveld 408576698