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

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

Issue 8833003: Revert 113315 (speculative revert for http://crbug.com/106657) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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) 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"
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_table_| with the servers (host/port) from 35 // Initializes |spdy_servers_table_| 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. 45 // Get the list of servers (host/port) that support SPDY.
53 void GetSpdyServerList(base::ListValue* spdy_server_list) const; 46 void GetSpdyServerList(base::ListValue* spdy_server_list) const;
54 47
55 // Returns flattened string representation of the |host_port_pair|. Used by 48 // Returns flattened string representation of the |host_port_pair|. Used by
56 // unittests. 49 // unittests.
57 static std::string GetFlattenedSpdyServer( 50 static std::string GetFlattenedSpdyServer(
58 const net::HostPortPair& host_port_pair); 51 const net::HostPortPair& host_port_pair);
59 52
60 // Debugging to simulate presence of an AlternateProtocol. 53 // Debugging to simulate presence of an AlternateProtocol.
61 // 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
62 // pair, force this ProtocolPortPair. 55 // pair, force this ProtocolPortPair.
63 static void ForceAlternateProtocol(const PortAlternateProtocolPair& pair); 56 static void ForceAlternateProtocol(const PortAlternateProtocolPair& pair);
64 static void DisableForcedAlternateProtocol(); 57 static void DisableForcedAlternateProtocol();
65 58
66 // Changes the number of host/port pairs we remember pipelining capability
67 // for. A larger number means we're more likely to be able to pipeline
68 // immediately if a host is known good, but uses more memory. This function
69 // can only be called if |pipeline_capability_map_| is empty.
70 void SetNumPipelinedHostsToRemember(int max_size);
71
72 // ----------------------------- 59 // -----------------------------
73 // HttpServerProperties methods: 60 // HttpServerProperties methods:
74 // ----------------------------- 61 // -----------------------------
75 62
76 // Deletes all data. 63 // Deletes all data.
77 virtual void Clear() OVERRIDE; 64 virtual void Clear() OVERRIDE;
78 65
79 // Returns true if |server| supports SPDY. 66 // Returns true if |server| supports SPDY.
80 virtual bool SupportsSpdy(const HostPortPair& server) const OVERRIDE; 67 virtual bool SupportsSpdy(const HostPortPair& server) const OVERRIDE;
81 68
(...skipping 30 matching lines...) Expand all
112 // persisted because |spdy_settings_map_| has been updated. 99 // persisted because |spdy_settings_map_| has been updated.
113 virtual bool SetSpdySettings(const HostPortPair& host_port_pair, 100 virtual bool SetSpdySettings(const HostPortPair& host_port_pair,
114 const spdy::SpdySettings& settings) OVERRIDE; 101 const spdy::SpdySettings& settings) OVERRIDE;
115 102
116 // Clears all spdy_settings. 103 // Clears all spdy_settings.
117 virtual void ClearSpdySettings() OVERRIDE; 104 virtual void ClearSpdySettings() OVERRIDE;
118 105
119 // Returns all persistent SpdySettings. 106 // Returns all persistent SpdySettings.
120 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; 107 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE;
121 108
122 virtual HttpPipelinedHostCapability GetPipelineCapability(
123 const HostPortPair& origin) OVERRIDE;
124
125 virtual void SetPipelineCapability(
126 const HostPortPair& origin,
127 HttpPipelinedHostCapability capability) OVERRIDE;
128
129 virtual void ClearPipelineCapabilities() OVERRIDE;
130
131 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const OVERRIDE;
132
133 private: 109 private:
134 typedef base::MRUCache<
135 HostPortPair, HttpPipelinedHostCapability> CachedPipelineCapabilityMap;
136 // |spdy_servers_table_| has flattened representation of servers (host/port 110 // |spdy_servers_table_| has flattened representation of servers (host/port
137 // pair) that either support or not support SPDY protocol. 111 // pair) that either support or not support SPDY protocol.
138 typedef base::hash_map<std::string, bool> SpdyServerHostPortTable; 112 typedef base::hash_map<std::string, bool> SpdyServerHostPortTable;
139 SpdyServerHostPortTable spdy_servers_table_; 113 SpdyServerHostPortTable spdy_servers_table_;
140 114
141 AlternateProtocolMap alternate_protocol_map_; 115 AlternateProtocolMap alternate_protocol_map_;
142 SpdySettingsMap spdy_settings_map_; 116 SpdySettingsMap spdy_settings_map_;
143 scoped_ptr<CachedPipelineCapabilityMap> pipeline_capability_map_;
144 117
145 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); 118 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl);
146 }; 119 };
147 120
148 } // namespace net 121 } // namespace net
149 122
150 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ 123 #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