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

Unified Diff: net/http/http_server_properties.h

Issue 665083009: ABANDONED Handle multiple AlternateProtocols for each HostPortPair. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re: 18. Created 5 years, 10 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_network_transaction_unittest.cc ('k') | net/http/http_server_properties.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_server_properties.h
diff --git a/net/http/http_server_properties.h b/net/http/http_server_properties.h
index dcb4cdcecf84b76590a28fa4ccaab9e4cf594e5a..b4bc1fe1068ee29a409f1ba9b720fc60331fadfc 100644
--- a/net/http/http_server_properties.h
+++ b/net/http/http_server_properties.h
@@ -7,6 +7,8 @@
#include <map>
#include <string>
+#include <vector>
+
#include "base/basictypes.h"
#include "base/containers/mru_cache.h"
#include "base/memory/weak_ptr.h"
@@ -80,17 +82,11 @@ enum AlternateProtocolSize {
ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION + 1,
};
-NET_EXPORT const char* AlternateProtocolToString(AlternateProtocol protocol);
-NET_EXPORT AlternateProtocol AlternateProtocolFromString(
- const std::string& str);
-NET_EXPORT_PRIVATE AlternateProtocol AlternateProtocolFromNextProto(
- NextProto next_proto);
-
struct NET_EXPORT AlternateProtocolInfo {
AlternateProtocolInfo()
: port(0),
protocol(UNINITIALIZED_ALTERNATE_PROTOCOL),
- probability(0),
+ probability(0.0),
is_broken(false) {}
AlternateProtocolInfo(uint16 port,
@@ -111,9 +107,12 @@ struct NET_EXPORT AlternateProtocolInfo {
is_broken(is_broken) {}
bool Equals(const AlternateProtocolInfo& other) const {
- return port == other.port &&
- protocol == other.protocol &&
- probability == other.probability;
+ return port == other.port && protocol == other.protocol &&
+ probability == other.probability;
+ }
+
+ bool EqualsModuloProbability(const AlternateProtocolInfo& other) const {
+ return port == other.port && protocol == other.protocol;
}
std::string ToString() const;
@@ -145,13 +144,21 @@ struct NET_EXPORT ServerNetworkStats {
QuicBandwidth bandwidth_estimate;
};
-typedef base::MRUCache<
- HostPortPair, AlternateProtocolInfo> AlternateProtocolMap;
+typedef std::vector<AlternateProtocolInfo> AlternateProtocols;
+typedef base::MRUCache<HostPortPair, AlternateProtocols> AlternateProtocolMap;
typedef base::MRUCache<HostPortPair, SettingsMap> SpdySettingsMap;
typedef base::MRUCache<HostPortPair, ServerNetworkStats> ServerNetworkStatsMap;
extern const char kAlternateProtocolHeader[];
+NET_EXPORT const char* AlternateProtocolToString(AlternateProtocol protocol);
+NET_EXPORT std::string AlternateProtocolsToString(
+ const AlternateProtocols& services);
+NET_EXPORT AlternateProtocol
+AlternateProtocolFromString(const std::string& str);
+NET_EXPORT_PRIVATE AlternateProtocol
+AlternateProtocolFromNextProto(NextProto next_proto);
+
// The interface for setting/retrieving the HTTP server properties.
// Currently, this class manages servers':
// * SPDY support (based on NPN results)
@@ -190,30 +197,42 @@ class NET_EXPORT HttpServerProperties {
virtual void MaybeForceHTTP11(const HostPortPair& server,
SSLConfig* ssl_config) = 0;
- // Returns the AlternateProtocol for |server| if it has probability equal to
- // or exceeding threshold, or else the forced AlternateProtocol if there is
- // one, or else one with UNINITIALIZED_ALTERNATE_PROTOCOL.
- virtual AlternateProtocolInfo GetAlternateProtocol(
+ // Returns all alternate protocols for |server| with probability greater than
+ // or equal to the threshold, even broken ones.
+ virtual AlternateProtocols GetAlternateProtocols(
const HostPortPair& server) = 0;
- // Sets the Alternate-Protocol for |server|.
- virtual void SetAlternateProtocol(const HostPortPair& server,
+ // Adds an alternate protocol for |server|.
+ virtual void AddAlternateProtocol(const HostPortPair& server,
uint16 alternate_port,
AlternateProtocol alternate_protocol,
double probability) = 0;
- // Sets the Alternate-Protocol for |server| to be BROKEN.
- virtual void SetBrokenAlternateProtocol(const HostPortPair& server) = 0;
+ // Sets a given alternate protocol for |server| to be broken.
+ virtual void SetBrokenAlternateProtocol(
+ const HostPortPair& server,
+ const AlternateProtocolInfo& broken_alternate_protocol) = 0;
- // Returns true if Alternate-Protocol for |server| was recently BROKEN.
+ // Returns true if given alternate protocol for |server| was recently broken.
virtual bool WasAlternateProtocolRecentlyBroken(
- const HostPortPair& server) = 0;
+ const HostPortPair& server,
+ const AlternateProtocolInfo& alternate_protocol) const = 0;
+
+ // Removes given (alternate protocol, server) pair from recently broken list.
+ virtual void ConfirmAlternateProtocol(
+ const HostPortPair& server,
+ const AlternateProtocolInfo& alternate_protocol) = 0;
+
+ // Clears all alternate protocols for |server|.
+ virtual void ClearAlternateProtocols(const HostPortPair& server) = 0;
- // Confirms that Alternate-Protocol for |server| is working.
- virtual void ConfirmAlternateProtocol(const HostPortPair& server) = 0;
+ // Clears all alternate protocols that are not broken for |server|.
+ virtual void ClearNonBrokenAlternateProtocols(const HostPortPair& server) = 0;
- // Clears the Alternate-Protocol for |server|.
- virtual void ClearAlternateProtocol(const HostPortPair& server) = 0;
+ // Removes an alternate protocol for |server|.
+ virtual void RemoveAlternateProtocol(
+ const HostPortPair& server,
+ const AlternateProtocolInfo& alternate_protocol) = 0;
// Returns all Alternate-Protocol mappings.
virtual const AlternateProtocolMap& alternate_protocol_map() const = 0;
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_server_properties.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698