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

Side by Side Diff: net/http/http_server_properties_impl.h

Issue 275953002: Remove HTTP pipelining support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix line endings Created 6 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_server_properties.h ('k') | net/http/http_server_properties_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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/containers/hash_tables.h" 13 #include "base/containers/hash_tables.h"
14 #include "base/containers/mru_cache.h"
15 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
16 #include "base/threading/non_thread_safe.h" 15 #include "base/threading/non_thread_safe.h"
17 #include "base/values.h" 16 #include "base/values.h"
18 #include "net/base/host_port_pair.h" 17 #include "net/base/host_port_pair.h"
19 #include "net/base/net_export.h" 18 #include "net/base/net_export.h"
20 #include "net/http/http_pipelined_host_capability.h"
21 #include "net/http/http_server_properties.h" 19 #include "net/http/http_server_properties.h"
22 20
23 namespace base { 21 namespace base {
24 class ListValue; 22 class ListValue;
25 } 23 }
26 24
27 namespace net { 25 namespace net {
28 26
29 // The implementation for setting/retrieving the HTTP server properties. 27 // The implementation for setting/retrieving the HTTP server properties.
30 class NET_EXPORT HttpServerPropertiesImpl 28 class NET_EXPORT HttpServerPropertiesImpl
31 : public HttpServerProperties, 29 : public HttpServerProperties,
32 NON_EXPORTED_BASE(public base::NonThreadSafe) { 30 NON_EXPORTED_BASE(public base::NonThreadSafe) {
33 public: 31 public:
34 HttpServerPropertiesImpl(); 32 HttpServerPropertiesImpl();
35 virtual ~HttpServerPropertiesImpl(); 33 virtual ~HttpServerPropertiesImpl();
36 34
37 // Initializes |spdy_servers_map_| with the servers (host/port) from 35 // Initializes |spdy_servers_map_| with the servers (host/port) from
38 // |spdy_servers| that either support SPDY or not. 36 // |spdy_servers| that either support SPDY or not.
39 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, 37 void InitializeSpdyServers(std::vector<std::string>* spdy_servers,
40 bool support_spdy); 38 bool support_spdy);
41 39
42 void InitializeAlternateProtocolServers( 40 void InitializeAlternateProtocolServers(
43 AlternateProtocolMap* alternate_protocol_servers); 41 AlternateProtocolMap* alternate_protocol_servers);
44 42
45 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map); 43 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map);
46 44
47 // Initializes |pipeline_capability_map_| with the servers (host/port) from
48 // |pipeline_capability_map| that either support HTTP pipelining or not.
49 void InitializePipelineCapabilities(
50 const PipelineCapabilityMap* pipeline_capability_map);
51
52 // Get the list of servers (host/port) that support SPDY. The max_size is the 45 // Get the list of servers (host/port) that support SPDY. The max_size is the
53 // number of MRU servers that support SPDY that are to be returned. 46 // number of MRU servers that support SPDY that are to be returned.
54 void GetSpdyServerList(base::ListValue* spdy_server_list, 47 void GetSpdyServerList(base::ListValue* spdy_server_list,
55 size_t max_size) const; 48 size_t max_size) const;
56 49
57 // Returns flattened string representation of the |host_port_pair|. Used by 50 // Returns flattened string representation of the |host_port_pair|. Used by
58 // unittests. 51 // unittests.
59 static std::string GetFlattenedSpdyServer( 52 static std::string GetFlattenedSpdyServer(
60 const net::HostPortPair& host_port_pair); 53 const net::HostPortPair& host_port_pair);
61 54
62 // Debugging to simulate presence of an AlternateProtocol. 55 // Debugging to simulate presence of an AlternateProtocol.
63 // If we don't have an alternate protocol in the map for any given host/port 56 // If we don't have an alternate protocol in the map for any given host/port
64 // pair, force this ProtocolPortPair. 57 // pair, force this ProtocolPortPair.
65 static void ForceAlternateProtocol(const PortAlternateProtocolPair& pair); 58 static void ForceAlternateProtocol(const PortAlternateProtocolPair& pair);
66 static void DisableForcedAlternateProtocol(); 59 static void DisableForcedAlternateProtocol();
67 60
68 // Returns the canonical host suffix for |server|, or std::string() if none 61 // Returns the canonical host suffix for |server|, or std::string() if none
69 // exists. 62 // exists.
70 std::string GetCanonicalSuffix(const net::HostPortPair& server); 63 std::string GetCanonicalSuffix(const net::HostPortPair& server);
71 64
72 // Changes the number of host/port pairs we remember pipelining capability
73 // for. A larger number means we're more likely to be able to pipeline
74 // immediately if a host is known good, but uses more memory. This function
75 // can only be called if |pipeline_capability_map_| is empty.
76 void SetNumPipelinedHostsToRemember(int max_size);
77
78 // ----------------------------- 65 // -----------------------------
79 // HttpServerProperties methods: 66 // HttpServerProperties methods:
80 // ----------------------------- 67 // -----------------------------
81 68
82 // Gets a weak pointer for this object. 69 // Gets a weak pointer for this object.
83 virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() OVERRIDE; 70 virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() OVERRIDE;
84 71
85 // Deletes all data. 72 // Deletes all data.
86 virtual void Clear() OVERRIDE; 73 virtual void Clear() OVERRIDE;
87 74
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 135
149 // Returns all persistent SPDY settings. 136 // Returns all persistent SPDY settings.
150 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; 137 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE;
151 138
152 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, 139 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair,
153 NetworkStats stats) OVERRIDE; 140 NetworkStats stats) OVERRIDE;
154 141
155 virtual const NetworkStats* GetServerNetworkStats( 142 virtual const NetworkStats* GetServerNetworkStats(
156 const HostPortPair& host_port_pair) const OVERRIDE; 143 const HostPortPair& host_port_pair) const OVERRIDE;
157 144
158 virtual HttpPipelinedHostCapability GetPipelineCapability(
159 const HostPortPair& origin) OVERRIDE;
160
161 virtual void SetPipelineCapability(
162 const HostPortPair& origin,
163 HttpPipelinedHostCapability capability) OVERRIDE;
164
165 virtual void ClearPipelineCapabilities() OVERRIDE;
166
167 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const OVERRIDE;
168
169 private: 145 private:
170 typedef base::MRUCache<
171 HostPortPair, HttpPipelinedHostCapability> CachedPipelineCapabilityMap;
172 // |spdy_servers_map_| has flattened representation of servers (host, port) 146 // |spdy_servers_map_| has flattened representation of servers (host, port)
173 // that either support or not support SPDY protocol. 147 // that either support or not support SPDY protocol.
174 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; 148 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap;
175 typedef std::map<HostPortPair, NetworkStats> ServerNetworkStatsMap; 149 typedef std::map<HostPortPair, NetworkStats> ServerNetworkStatsMap;
176 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; 150 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap;
177 typedef std::vector<std::string> CanonicalSufficList; 151 typedef std::vector<std::string> CanonicalSufficList;
178 // List of broken host:ports and the times when they can be expired. 152 // List of broken host:ports and the times when they can be expired.
179 struct BrokenAlternateProtocolEntry { 153 struct BrokenAlternateProtocolEntry {
180 HostPortPair server; 154 HostPortPair server;
181 base::TimeTicks when; 155 base::TimeTicks when;
(...skipping 12 matching lines...) Expand all
194 168
195 SpdyServerHostPortMap spdy_servers_map_; 169 SpdyServerHostPortMap spdy_servers_map_;
196 170
197 AlternateProtocolMap alternate_protocol_map_; 171 AlternateProtocolMap alternate_protocol_map_;
198 BrokenAlternateProtocolList broken_alternate_protocol_list_; 172 BrokenAlternateProtocolList broken_alternate_protocol_list_;
199 BrokenAlternateProtocolMap broken_alternate_protocol_map_; 173 BrokenAlternateProtocolMap broken_alternate_protocol_map_;
200 AlternateProtocolExperiment alternate_protocol_experiment_; 174 AlternateProtocolExperiment alternate_protocol_experiment_;
201 175
202 SpdySettingsMap spdy_settings_map_; 176 SpdySettingsMap spdy_settings_map_;
203 ServerNetworkStatsMap server_network_stats_map_; 177 ServerNetworkStatsMap server_network_stats_map_;
204 scoped_ptr<CachedPipelineCapabilityMap> pipeline_capability_map_;
205 // Contains a map of servers which could share the same alternate protocol. 178 // Contains a map of servers which could share the same alternate protocol.
206 // Map from a Canonical host/port (host is some postfix of host names) to an 179 // Map from a Canonical host/port (host is some postfix of host names) to an
207 // actual origin, which has a plausible alternate protocol mapping. 180 // actual origin, which has a plausible alternate protocol mapping.
208 CanonicalHostMap canonical_host_to_origin_map_; 181 CanonicalHostMap canonical_host_to_origin_map_;
209 // Contains list of suffixes (for exmaple ".c.youtube.com", 182 // Contains list of suffixes (for exmaple ".c.youtube.com",
210 // ".googlevideo.com") of canoncial hostnames. 183 // ".googlevideo.com") of canoncial hostnames.
211 CanonicalSufficList canoncial_suffixes_; 184 CanonicalSufficList canoncial_suffixes_;
212 185
213 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; 186 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_;
214 187
215 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); 188 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl);
216 }; 189 };
217 190
218 } // namespace net 191 } // namespace net
219 192
220 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ 193 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_
OLDNEW
« no previous file with comments | « net/http/http_server_properties.h ('k') | net/http/http_server_properties_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698