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

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: Self review 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..ce4d25b1ad963cafb7eb973663ae65ca9ab7d14a 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,32 @@ 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 expirationi,
+ const QuicVersionVector& advertised_versions);
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);
+
+ bool EqualAdvertisedVersions(const AlternativeServiceInfo& other) const;
+
+ void set_advertised_versions(const QuicVersionVector& advertised_versions) {
+ 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 && EqualAdvertisedVersions(other);
}
bool operator!=(const AlternativeServiceInfo& other) const {
@@ -144,8 +150,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_;
Zhongyi Shi 2017/06/06 22:04:52 We might want to change the AlternativeServiceInfo
};
struct NET_EXPORT SupportsQuic {
@@ -251,7 +268,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