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 <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
15 #include "base/memory/mru_cache.h" | |
15 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "net/base/host_port_pair.h" | 18 #include "net/base/host_port_pair.h" |
18 #include "net/base/net_export.h" | 19 #include "net/base/net_export.h" |
19 #include "net/http/http_server_properties.h" | 20 #include "net/http/http_server_properties.h" |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 class ListValue; | 23 class ListValue; |
23 } | 24 } |
24 | 25 |
(...skipping 10 matching lines...) Expand all Loading... | |
35 // Initializes |spdy_servers_table_| with the servers (host/port) from | 36 // Initializes |spdy_servers_table_| with the servers (host/port) from |
36 // |spdy_servers| that either support SPDY or not. | 37 // |spdy_servers| that either support SPDY or not. |
37 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, | 38 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, |
38 bool support_spdy); | 39 bool support_spdy); |
39 | 40 |
40 void InitializeAlternateProtocolServers( | 41 void InitializeAlternateProtocolServers( |
41 AlternateProtocolMap* alternate_protocol_servers); | 42 AlternateProtocolMap* alternate_protocol_servers); |
42 | 43 |
43 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map); | 44 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map); |
44 | 45 |
46 void InitializePipelineCapabilities( | |
mmenke
2011/12/02 21:52:10
Might be nice to have a comment to make clear that
James Simonsen
2011/12/03 03:16:00
Done.
| |
47 PipelineCapabilityMap* pipeline_capability_map); | |
mmenke
2011/12/02 21:52:10
Think you can make this argument const.
James Simonsen
2011/12/03 03:16:00
Done.
| |
48 | |
45 // Get the list of servers (host/port) that support SPDY. | 49 // Get the list of servers (host/port) that support SPDY. |
46 void GetSpdyServerList(base::ListValue* spdy_server_list) const; | 50 void GetSpdyServerList(base::ListValue* spdy_server_list) const; |
47 | 51 |
48 // Returns flattened string representation of the |host_port_pair|. Used by | 52 // Returns flattened string representation of the |host_port_pair|. Used by |
49 // unittests. | 53 // unittests. |
50 static std::string GetFlattenedSpdyServer( | 54 static std::string GetFlattenedSpdyServer( |
51 const net::HostPortPair& host_port_pair); | 55 const net::HostPortPair& host_port_pair); |
52 | 56 |
53 // Debugging to simulate presence of an AlternateProtocol. | 57 // Debugging to simulate presence of an AlternateProtocol. |
54 // If we don't have an alternate protocol in the map for any given host/port | 58 // If we don't have an alternate protocol in the map for any given host/port |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 // persisted because |spdy_settings_map_| has been updated. | 103 // persisted because |spdy_settings_map_| has been updated. |
100 virtual bool SetSpdySettings(const HostPortPair& host_port_pair, | 104 virtual bool SetSpdySettings(const HostPortPair& host_port_pair, |
101 const spdy::SpdySettings& settings) OVERRIDE; | 105 const spdy::SpdySettings& settings) OVERRIDE; |
102 | 106 |
103 // Clears all spdy_settings. | 107 // Clears all spdy_settings. |
104 virtual void ClearSpdySettings() OVERRIDE; | 108 virtual void ClearSpdySettings() OVERRIDE; |
105 | 109 |
106 // Returns all persistent SpdySettings. | 110 // Returns all persistent SpdySettings. |
107 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; | 111 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; |
108 | 112 |
113 virtual HttpPipelinedHost::Capability GetPipelineCapability( | |
114 const HostPortPair& origin) OVERRIDE; | |
115 | |
116 virtual void SetPipelineCapability( | |
117 const HostPortPair& origin, | |
118 HttpPipelinedHost::Capability capability) OVERRIDE; | |
119 | |
120 virtual void ClearPipelineCapabilities() OVERRIDE; | |
121 | |
122 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const OVERRIDE; | |
123 | |
109 private: | 124 private: |
125 typedef base::MRUCache< | |
126 HostPortPair, HttpPipelinedHost::Capability> CachedPipelineCapabilityMap; | |
110 // |spdy_servers_table_| has flattened representation of servers (host/port | 127 // |spdy_servers_table_| has flattened representation of servers (host/port |
111 // pair) that either support or not support SPDY protocol. | 128 // pair) that either support or not support SPDY protocol. |
112 typedef base::hash_map<std::string, bool> SpdyServerHostPortTable; | 129 typedef base::hash_map<std::string, bool> SpdyServerHostPortTable; |
113 SpdyServerHostPortTable spdy_servers_table_; | 130 SpdyServerHostPortTable spdy_servers_table_; |
114 | 131 |
115 AlternateProtocolMap alternate_protocol_map_; | 132 AlternateProtocolMap alternate_protocol_map_; |
116 SpdySettingsMap spdy_settings_map_; | 133 SpdySettingsMap spdy_settings_map_; |
134 CachedPipelineCapabilityMap pipeline_capability_map_; | |
117 | 135 |
118 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 136 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
119 }; | 137 }; |
120 | 138 |
121 } // namespace net | 139 } // namespace net |
122 | 140 |
123 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 141 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
OLD | NEW |