| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // HttpAlternateProtocols is an in-memory data structure used for keeping track | 5 // HttpAlternateProtocols is an in-memory data structure used for keeping track |
| 6 // of which HTTP HostPortPairs have an alternate protocol that can be used | 6 // of which HTTP HostPortPairs have an alternate protocol that can be used |
| 7 // instead of HTTP on a different port. | 7 // instead of HTTP on a different port. |
| 8 | 8 |
| 9 #ifndef NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ | 9 #ifndef NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ |
| 10 #define NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ | 10 #define NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // SetAlternateProtocolFor() will ignore the request if the alternate protocol | 56 // SetAlternateProtocolFor() will ignore the request if the alternate protocol |
| 57 // has already been marked broken via MarkBrokenAlternateProtocolFor(). | 57 // has already been marked broken via MarkBrokenAlternateProtocolFor(). |
| 58 void SetAlternateProtocolFor(const HostPortPair& http_host_port_pair, | 58 void SetAlternateProtocolFor(const HostPortPair& http_host_port_pair, |
| 59 uint16 alternate_port, | 59 uint16 alternate_port, |
| 60 Protocol alternate_protocol); | 60 Protocol alternate_protocol); |
| 61 | 61 |
| 62 // Marks the alternate protocol as broken. Once marked broken, any further | 62 // Marks the alternate protocol as broken. Once marked broken, any further |
| 63 // attempts to set the alternate protocol for |http_host_port_pair| will fail. | 63 // attempts to set the alternate protocol for |http_host_port_pair| will fail. |
| 64 void MarkBrokenAlternateProtocolFor(const HostPortPair& http_host_port_pair); | 64 void MarkBrokenAlternateProtocolFor(const HostPortPair& http_host_port_pair); |
| 65 | 65 |
| 66 // Debugging to simulate presence of an AlternateProtocol. |
| 67 // If we don't have an alternate protocol in the map for any given host/port |
| 68 // pair, force this ProtocolPortPair. |
| 69 static void ForceAlternateProtocol(const PortProtocolPair& pair); |
| 70 static void DisableForcedAlternateProtocol(); |
| 71 |
| 66 private: | 72 private: |
| 67 typedef std::map<HostPortPair, PortProtocolPair> ProtocolMap; | 73 typedef std::map<HostPortPair, PortProtocolPair> ProtocolMap; |
| 68 | 74 |
| 69 ProtocolMap protocol_map_; | 75 ProtocolMap protocol_map_; |
| 70 | 76 |
| 77 // The forced alternate protocol. If not-null, there is a protocol being |
| 78 // forced. |
| 79 static PortProtocolPair* forced_alternate_protocol_; |
| 80 |
| 71 DISALLOW_COPY_AND_ASSIGN(HttpAlternateProtocols); | 81 DISALLOW_COPY_AND_ASSIGN(HttpAlternateProtocols); |
| 72 }; | 82 }; |
| 73 | 83 |
| 74 } // namespace net | 84 } // namespace net |
| 75 | 85 |
| 76 #endif // NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ | 86 #endif // NET_HTTP_HTTP_ALTERNATE_PROTOCOLS_H_ |
| OLD | NEW |