| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/containers/mru_cache.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #include "net/base/host_port_pair.h" | 14 #include "net/base/host_port_pair.h" |
| 14 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
| 15 #include "net/http/http_pipelined_host_capability.h" | 16 #include "net/http/http_pipelined_host_capability.h" |
| 16 #include "net/socket/next_proto.h" | 17 #include "net/socket/next_proto.h" |
| 17 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. | 18 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 | 21 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 bool Equals(const PortAlternateProtocolPair& other) const { | 56 bool Equals(const PortAlternateProtocolPair& other) const { |
| 56 return port == other.port && protocol == other.protocol; | 57 return port == other.port && protocol == other.protocol; |
| 57 } | 58 } |
| 58 | 59 |
| 59 std::string ToString() const; | 60 std::string ToString() const; |
| 60 | 61 |
| 61 uint16 port; | 62 uint16 port; |
| 62 AlternateProtocol protocol; | 63 AlternateProtocol protocol; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 typedef std::map<HostPortPair, PortAlternateProtocolPair> AlternateProtocolMap; | 66 typedef base::MRUCache< |
| 67 HostPortPair, PortAlternateProtocolPair> AlternateProtocolMap; |
| 66 typedef std::map<HostPortPair, SettingsMap> SpdySettingsMap; | 68 typedef std::map<HostPortPair, SettingsMap> SpdySettingsMap; |
| 67 typedef std::map<HostPortPair, | 69 typedef std::map<HostPortPair, |
| 68 HttpPipelinedHostCapability> PipelineCapabilityMap; | 70 HttpPipelinedHostCapability> PipelineCapabilityMap; |
| 69 | 71 |
| 70 extern const char kAlternateProtocolHeader[]; | 72 extern const char kAlternateProtocolHeader[]; |
| 71 | 73 |
| 72 // The interface for setting/retrieving the HTTP server properties. | 74 // The interface for setting/retrieving the HTTP server properties. |
| 73 // Currently, this class manages servers': | 75 // Currently, this class manages servers': |
| 74 // * SPDY support (based on NPN results) | 76 // * SPDY support (based on NPN results) |
| 75 // * Alternate-Protocol support | 77 // * Alternate-Protocol support |
| (...skipping 16 matching lines...) Expand all Loading... |
| 92 | 94 |
| 93 // Returns true if |server| supports SPDY. | 95 // Returns true if |server| supports SPDY. |
| 94 virtual bool SupportsSpdy(const HostPortPair& server) const = 0; | 96 virtual bool SupportsSpdy(const HostPortPair& server) const = 0; |
| 95 | 97 |
| 96 // Add |server| into the persistent store. Should only be called from IO | 98 // Add |server| into the persistent store. Should only be called from IO |
| 97 // thread. | 99 // thread. |
| 98 virtual void SetSupportsSpdy(const HostPortPair& server, | 100 virtual void SetSupportsSpdy(const HostPortPair& server, |
| 99 bool support_spdy) = 0; | 101 bool support_spdy) = 0; |
| 100 | 102 |
| 101 // Returns true if |server| has an Alternate-Protocol header. | 103 // Returns true if |server| has an Alternate-Protocol header. |
| 102 virtual bool HasAlternateProtocol(const HostPortPair& server) const = 0; | 104 virtual bool HasAlternateProtocol(const HostPortPair& server) = 0; |
| 103 | 105 |
| 104 // Returns the Alternate-Protocol and port for |server|. | 106 // Returns the Alternate-Protocol and port for |server|. |
| 105 // HasAlternateProtocol(server) must be true. | 107 // HasAlternateProtocol(server) must be true. |
| 106 virtual PortAlternateProtocolPair GetAlternateProtocol( | 108 virtual PortAlternateProtocolPair GetAlternateProtocol( |
| 107 const HostPortPair& server) const = 0; | 109 const HostPortPair& server) = 0; |
| 108 | 110 |
| 109 // Sets the Alternate-Protocol for |server|. | 111 // Sets the Alternate-Protocol for |server|. |
| 110 virtual void SetAlternateProtocol(const HostPortPair& server, | 112 virtual void SetAlternateProtocol(const HostPortPair& server, |
| 111 uint16 alternate_port, | 113 uint16 alternate_port, |
| 112 AlternateProtocol alternate_protocol) = 0; | 114 AlternateProtocol alternate_protocol) = 0; |
| 113 | 115 |
| 114 // Sets the Alternate-Protocol for |server| to be BROKEN. | 116 // Sets the Alternate-Protocol for |server| to be BROKEN. |
| 115 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) = 0; | 117 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) = 0; |
| 116 | 118 |
| 117 // Returns all Alternate-Protocol mappings. | 119 // Returns all Alternate-Protocol mappings. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 157 |
| 156 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const = 0; | 158 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const = 0; |
| 157 | 159 |
| 158 private: | 160 private: |
| 159 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 161 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
| 160 }; | 162 }; |
| 161 | 163 |
| 162 } // namespace net | 164 } // namespace net |
| 163 | 165 |
| 164 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 166 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| OLD | NEW |