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

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: Merge Created 6 years, 7 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
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 // Changes the number of host/port pairs we remember pipelining capability
69 // for. A larger number means we're more likely to be able to pipeline
70 // immediately if a host is known good, but uses more memory. This function
71 // can only be called if |pipeline_capability_map_| is empty.
72 void SetNumPipelinedHostsToRemember(int max_size);
73
74 // ----------------------------- 61 // -----------------------------
75 // HttpServerProperties methods: 62 // HttpServerProperties methods:
76 // ----------------------------- 63 // -----------------------------
77 64
78 // Gets a weak pointer for this object. 65 // Gets a weak pointer for this object.
79 virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() OVERRIDE; 66 virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() OVERRIDE;
80 67
81 // Deletes all data. 68 // Deletes all data.
82 virtual void Clear() OVERRIDE; 69 virtual void Clear() OVERRIDE;
83 70
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 125
139 // Returns all persistent SPDY settings. 126 // Returns all persistent SPDY settings.
140 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; 127 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE;
141 128
142 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, 129 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair,
143 NetworkStats stats) OVERRIDE; 130 NetworkStats stats) OVERRIDE;
144 131
145 virtual const NetworkStats* GetServerNetworkStats( 132 virtual const NetworkStats* GetServerNetworkStats(
146 const HostPortPair& host_port_pair) const OVERRIDE; 133 const HostPortPair& host_port_pair) const OVERRIDE;
147 134
148 virtual HttpPipelinedHostCapability GetPipelineCapability(
149 const HostPortPair& origin) OVERRIDE;
150
151 virtual void SetPipelineCapability(
152 const HostPortPair& origin,
153 HttpPipelinedHostCapability capability) OVERRIDE;
154
155 virtual void ClearPipelineCapabilities() OVERRIDE;
156
157 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const OVERRIDE;
158
159 private: 135 private:
160 typedef base::MRUCache<
161 HostPortPair, HttpPipelinedHostCapability> CachedPipelineCapabilityMap;
162 // |spdy_servers_map_| has flattened representation of servers (host, port) 136 // |spdy_servers_map_| has flattened representation of servers (host, port)
163 // that either support or not support SPDY protocol. 137 // that either support or not support SPDY protocol.
164 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; 138 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap;
165 typedef std::map<HostPortPair, NetworkStats> ServerNetworkStatsMap; 139 typedef std::map<HostPortPair, NetworkStats> ServerNetworkStatsMap;
166 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; 140 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap;
167 typedef std::vector<std::string> CanonicalSufficList; 141 typedef std::vector<std::string> CanonicalSufficList;
168 // List of broken host:ports and the times when they can be expired. 142 // List of broken host:ports and the times when they can be expired.
169 struct BrokenAlternateProtocolEntry { 143 struct BrokenAlternateProtocolEntry {
170 HostPortPair server; 144 HostPortPair server;
171 base::TimeTicks when; 145 base::TimeTicks when;
(...skipping 11 matching lines...) Expand all
183 void ScheduleBrokenAlternateProtocolMappingsExpiration(); 157 void ScheduleBrokenAlternateProtocolMappingsExpiration();
184 158
185 SpdyServerHostPortMap spdy_servers_map_; 159 SpdyServerHostPortMap spdy_servers_map_;
186 160
187 AlternateProtocolMap alternate_protocol_map_; 161 AlternateProtocolMap alternate_protocol_map_;
188 BrokenAlternateProtocolList broken_alternate_protocol_list_; 162 BrokenAlternateProtocolList broken_alternate_protocol_list_;
189 BrokenAlternateProtocolMap broken_alternate_protocol_map_; 163 BrokenAlternateProtocolMap broken_alternate_protocol_map_;
190 164
191 SpdySettingsMap spdy_settings_map_; 165 SpdySettingsMap spdy_settings_map_;
192 ServerNetworkStatsMap server_network_stats_map_; 166 ServerNetworkStatsMap server_network_stats_map_;
193 scoped_ptr<CachedPipelineCapabilityMap> pipeline_capability_map_;
194 // Contains a map of servers which could share the same alternate protocol. 167 // Contains a map of servers which could share the same alternate protocol.
195 // Map from a Canonical host/port (host is some postfix of host names) to an 168 // Map from a Canonical host/port (host is some postfix of host names) to an
196 // actual origin, which has a plausible alternate protocol mapping. 169 // actual origin, which has a plausible alternate protocol mapping.
197 CanonicalHostMap canonical_host_to_origin_map_; 170 CanonicalHostMap canonical_host_to_origin_map_;
198 // Contains list of suffixes (for exmaple ".c.youtube.com", 171 // Contains list of suffixes (for exmaple ".c.youtube.com",
199 // ".googlevideo.com") of canoncial hostnames. 172 // ".googlevideo.com") of canoncial hostnames.
200 CanonicalSufficList canoncial_suffixes_; 173 CanonicalSufficList canoncial_suffixes_;
201 174
202 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; 175 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_;
203 176
204 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); 177 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl);
205 }; 178 };
206 179
207 } // namespace net 180 } // namespace net
208 181
209 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ 182 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698