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

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: Nits. Created 6 years, 1 month 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 edf598ff029c4e6f79119c702fb001c2d33913c4..56d63bb77d8c2d8761ac92bd76ce81f8e19f746e 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"
@@ -76,13 +78,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);
-
+// TODO(bnc): Rename to AlternateServiceInfo.
struct NET_EXPORT AlternateProtocolInfo {
+ AlternateProtocolInfo()
+ : port(), protocol(UNINITIALIZED_ALTERNATE_PROTOCOL), probability() {}
Ryan Hamilton 2014/11/04 18:56:22 Can you explicitly specify 0 for the numeric initi
Bence 2014/11/04 21:55:50 Done.
+
AlternateProtocolInfo(uint16 port,
AlternateProtocol protocol,
double probability)
@@ -96,6 +96,11 @@ struct NET_EXPORT AlternateProtocolInfo {
probability == other.probability;
}
+ bool EqualsModuloProbabilityAndProtocol(
+ const AlternateProtocolInfo& other) const {
+ return port == other.port;
+ }
+
std::string ToString() const;
uint16 port;
@@ -117,13 +122,24 @@ struct NET_EXPORT SupportsQuic {
std::string address;
};
-typedef base::MRUCache<
- HostPortPair, AlternateProtocolInfo> AlternateProtocolMap;
+// TODO(bnc): Rename to AlternateServices.
+typedef std::vector<AlternateProtocolInfo> AlternateProtocols;
+// TODO(bnc): Rename to AlternateServicesMap.
+typedef base::MRUCache<HostPortPair, AlternateProtocols> AlternateProtocolMap;
typedef base::MRUCache<HostPortPair, SettingsMap> SpdySettingsMap;
typedef std::map<HostPortPair, SupportsQuic> SupportsQuicMap;
extern const char kAlternateProtocolHeader[];
+NET_EXPORT const char* AlternateProtocolToString(AlternateProtocol protocol);
+// TODO(bnc): Rename to AlternateServicesToString.
+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)
@@ -154,33 +170,48 @@ class NET_EXPORT HttpServerProperties {
bool support_spdy) = 0;
// Returns true if |server| has an Alternate-Protocol header.
+ // TODO(bnc): Rename to HasAlternateService.
virtual bool HasAlternateProtocol(const HostPortPair& server) = 0;
- // Returns the Alternate-Protocol and port for |server|.
+ // Returns the Alternate-Protocols for |server|.
// HasAlternateProtocol(server) must be true.
- virtual AlternateProtocolInfo GetAlternateProtocol(
+ virtual const AlternateProtocols& GetAlternateProtocols(
const HostPortPair& server) = 0;
- // Sets the Alternate-Protocol for |server|.
- virtual void SetAlternateProtocol(const HostPortPair& server,
+ // Adds an Alternate-Protocol for |server|.
+ // TODO(bnc): Rename to AddAlternateService.
+ 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) = 0;
- // Confirms that Alternate-Protocol for |server| is working.
- virtual void ConfirmAlternateProtocol(const HostPortPair& server) = 0;
+ // Confirms that given Alternate-Protocol for |server| is working.
+ virtual void ConfirmAlternateProtocol(
+ const HostPortPair& server,
+ const AlternateProtocolInfo& alternate_protocol) = 0;
- // Clears the Alternate-Protocol for |server|.
+ // Clears all Alternate-Protocols for |server|.
+ // TODO(bnc): Rename to ClearAlternateServices.
virtual void ClearAlternateProtocol(const HostPortPair& server) = 0;
+ // Removes an Alternate-Protocol for |server|.
+ // TODO(bnc): Rename to RemoveAlternateService.
+ virtual void RemoveAlternateProtocol(
+ const HostPortPair& server,
+ const AlternateProtocolInfo& alternate_protocol) = 0;
+
// Returns all Alternate-Protocol mappings.
+ // TODO(bnc): Rename to alternate_services_map.
virtual const AlternateProtocolMap& alternate_protocol_map() const = 0;
// Sets the threshold to be used when evaluating Alternate-Protocol
« 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