OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_IMPL_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
7 | 7 |
| 8 #include <map> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
13 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
14 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
15 #include "base/values.h" | 16 #include "base/values.h" |
16 #include "net/base/host_port_pair.h" | 17 #include "net/base/host_port_pair.h" |
17 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
(...skipping 14 matching lines...) Expand all Loading... |
32 virtual ~HttpServerPropertiesImpl(); | 33 virtual ~HttpServerPropertiesImpl(); |
33 | 34 |
34 // Initializes |spdy_servers_table_| with the servers (host/port) from | 35 // Initializes |spdy_servers_table_| with the servers (host/port) from |
35 // |spdy_servers| that either support SPDY or not. | 36 // |spdy_servers| that either support SPDY or not. |
36 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, | 37 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, |
37 bool support_spdy); | 38 bool support_spdy); |
38 | 39 |
39 void InitializeAlternateProtocolServers( | 40 void InitializeAlternateProtocolServers( |
40 AlternateProtocolMap* alternate_protocol_servers); | 41 AlternateProtocolMap* alternate_protocol_servers); |
41 | 42 |
| 43 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map); |
| 44 |
42 // Get the list of servers (host/port) that support SPDY. | 45 // Get the list of servers (host/port) that support SPDY. |
43 void GetSpdyServerList(base::ListValue* spdy_server_list) const; | 46 void GetSpdyServerList(base::ListValue* spdy_server_list) const; |
44 | 47 |
45 // Returns flattened string representation of the |host_port_pair|. Used by | 48 // Returns flattened string representation of the |host_port_pair|. Used by |
46 // unittests. | 49 // unittests. |
47 static std::string GetFlattenedSpdyServer( | 50 static std::string GetFlattenedSpdyServer( |
48 const net::HostPortPair& host_port_pair); | 51 const net::HostPortPair& host_port_pair); |
49 | 52 |
50 // Debugging to simulate presence of an AlternateProtocol. | 53 // Debugging to simulate presence of an AlternateProtocol. |
51 // If we don't have an alternate protocol in the map for any given host/port | 54 // If we don't have an alternate protocol in the map for any given host/port |
(...skipping 28 matching lines...) Expand all Loading... |
80 const HostPortPair& server, | 83 const HostPortPair& server, |
81 uint16 alternate_port, | 84 uint16 alternate_port, |
82 AlternateProtocol alternate_protocol) OVERRIDE; | 85 AlternateProtocol alternate_protocol) OVERRIDE; |
83 | 86 |
84 // Sets the Alternate-Protocol for |server| to be BROKEN. | 87 // Sets the Alternate-Protocol for |server| to be BROKEN. |
85 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) OVERRIDE; | 88 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) OVERRIDE; |
86 | 89 |
87 // Returns all Alternate-Protocol mappings. | 90 // Returns all Alternate-Protocol mappings. |
88 virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE; | 91 virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE; |
89 | 92 |
| 93 // Gets a reference to the SpdySettings stored for a host. |
| 94 // If no settings are stored, returns an empty set of settings. |
| 95 virtual const spdy::SpdySettings& GetSpdySettings( |
| 96 const HostPortPair& host_port_pair) const OVERRIDE; |
| 97 |
| 98 // Saves settings for a host. Returns true if SpdySettings are to be |
| 99 // persisted because |spdy_settings_map_| has been updated. |
| 100 virtual bool SetSpdySettings(const HostPortPair& host_port_pair, |
| 101 const spdy::SpdySettings& settings) OVERRIDE; |
| 102 |
| 103 // Clears all spdy_settings. |
| 104 virtual void ClearSpdySettings() OVERRIDE; |
| 105 |
| 106 // Returns all persistent SpdySettings. |
| 107 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; |
| 108 |
90 private: | 109 private: |
91 // |spdy_servers_table_| has flattened representation of servers (host/port | 110 // |spdy_servers_table_| has flattened representation of servers (host/port |
92 // pair) that either support or not support SPDY protocol. | 111 // pair) that either support or not support SPDY protocol. |
93 typedef base::hash_map<std::string, bool> SpdyServerHostPortTable; | 112 typedef base::hash_map<std::string, bool> SpdyServerHostPortTable; |
94 SpdyServerHostPortTable spdy_servers_table_; | 113 SpdyServerHostPortTable spdy_servers_table_; |
95 | 114 |
96 AlternateProtocolMap alternate_protocol_map_; | 115 AlternateProtocolMap alternate_protocol_map_; |
| 116 SpdySettingsMap spdy_settings_map_; |
97 | 117 |
98 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 118 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
99 }; | 119 }; |
100 | 120 |
101 } // namespace net | 121 } // namespace net |
102 | 122 |
103 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 123 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
OLD | NEW |