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

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

Issue 180743026: Relanding 255326 "HttpServerProperties - Implement MRU for AlternateProtocolMap. Persist" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use Erase to fix compilation error Created 6 years, 9 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_network_transaction_unittest.cc ('k') | net/http/http_server_properties_impl.h » ('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_H_ 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_
6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/containers/mru_cache.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "net/base/host_port_pair.h" 14 #include "net/base/host_port_pair.h"
14 #include "net/base/net_export.h" 15 #include "net/base/net_export.h"
15 #include "net/http/http_pipelined_host_capability.h" 16 #include "net/http/http_pipelined_host_capability.h"
16 #include "net/socket/next_proto.h" 17 #include "net/socket/next_proto.h"
17 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this. 18 #include "net/spdy/spdy_framer.h" // TODO(willchan): Reconsider this.
18 19
19 namespace net { 20 namespace net {
20 21
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 bool Equals(const PortAlternateProtocolPair& other) const { 56 bool Equals(const PortAlternateProtocolPair& other) const {
56 return port == other.port && protocol == other.protocol; 57 return port == other.port && protocol == other.protocol;
57 } 58 }
58 59
59 std::string ToString() const; 60 std::string ToString() const;
60 61
61 uint16 port; 62 uint16 port;
62 AlternateProtocol protocol; 63 AlternateProtocol protocol;
63 }; 64 };
64 65
65 typedef std::map<HostPortPair, PortAlternateProtocolPair> AlternateProtocolMap; 66 typedef base::MRUCache<
67 HostPortPair, PortAlternateProtocolPair> AlternateProtocolMap;
66 typedef std::map<HostPortPair, SettingsMap> SpdySettingsMap; 68 typedef std::map<HostPortPair, SettingsMap> SpdySettingsMap;
67 typedef std::map<HostPortPair, 69 typedef std::map<HostPortPair,
68 HttpPipelinedHostCapability> PipelineCapabilityMap; 70 HttpPipelinedHostCapability> PipelineCapabilityMap;
69 71
70 extern const char kAlternateProtocolHeader[]; 72 extern const char kAlternateProtocolHeader[];
71 73
72 // The interface for setting/retrieving the HTTP server properties. 74 // The interface for setting/retrieving the HTTP server properties.
73 // Currently, this class manages servers': 75 // Currently, this class manages servers':
74 // * SPDY support (based on NPN results) 76 // * SPDY support (based on NPN results)
75 // * Alternate-Protocol support 77 // * Alternate-Protocol support
(...skipping 16 matching lines...) Expand all
92 94
93 // Returns true if |server| supports SPDY. 95 // Returns true if |server| supports SPDY.
94 virtual bool SupportsSpdy(const HostPortPair& server) const = 0; 96 virtual bool SupportsSpdy(const HostPortPair& server) const = 0;
95 97
96 // Add |server| into the persistent store. Should only be called from IO 98 // Add |server| into the persistent store. Should only be called from IO
97 // thread. 99 // thread.
98 virtual void SetSupportsSpdy(const HostPortPair& server, 100 virtual void SetSupportsSpdy(const HostPortPair& server,
99 bool support_spdy) = 0; 101 bool support_spdy) = 0;
100 102
101 // Returns true if |server| has an Alternate-Protocol header. 103 // Returns true if |server| has an Alternate-Protocol header.
102 virtual bool HasAlternateProtocol(const HostPortPair& server) const = 0; 104 virtual bool HasAlternateProtocol(const HostPortPair& server) = 0;
103 105
104 // Returns the Alternate-Protocol and port for |server|. 106 // Returns the Alternate-Protocol and port for |server|.
105 // HasAlternateProtocol(server) must be true. 107 // HasAlternateProtocol(server) must be true.
106 virtual PortAlternateProtocolPair GetAlternateProtocol( 108 virtual PortAlternateProtocolPair GetAlternateProtocol(
107 const HostPortPair& server) const = 0; 109 const HostPortPair& server) = 0;
108 110
109 // Sets the Alternate-Protocol for |server|. 111 // Sets the Alternate-Protocol for |server|.
110 virtual void SetAlternateProtocol(const HostPortPair& server, 112 virtual void SetAlternateProtocol(const HostPortPair& server,
111 uint16 alternate_port, 113 uint16 alternate_port,
112 AlternateProtocol alternate_protocol) = 0; 114 AlternateProtocol alternate_protocol) = 0;
113 115
114 // Sets the Alternate-Protocol for |server| to be BROKEN. 116 // Sets the Alternate-Protocol for |server| to be BROKEN.
115 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) = 0; 117 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) = 0;
116 118
117 // Clears the Alternate-Protocol for |server|. 119 // Clears the Alternate-Protocol for |server|.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 160
159 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const = 0; 161 virtual PipelineCapabilityMap GetPipelineCapabilityMap() const = 0;
160 162
161 private: 163 private:
162 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); 164 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties);
163 }; 165 };
164 166
165 } // namespace net 167 } // namespace net
166 168
167 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ 169 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_server_properties_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698