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

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

Issue 2932953002: Persist broken and recently-broken alt-svcs to prefs in HttpServerPropertiesManager (Closed)
Patch Set: More cleanup Created 3 years, 5 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
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <deque> 11 #include <deque>
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/threading/thread_checker.h" 19 #include "base/threading/thread_checker.h"
20 #include "base/time/default_tick_clock.h"
21 #include "base/values.h" 20 #include "base/values.h"
22 #include "net/base/host_port_pair.h" 21 #include "net/base/host_port_pair.h"
23 #include "net/base/ip_address.h" 22 #include "net/base/ip_address.h"
24 #include "net/base/linked_hash_map.h" 23 #include "net/base/linked_hash_map.h"
25 #include "net/base/net_export.h" 24 #include "net/base/net_export.h"
26 #include "net/http/broken_alternative_services.h" 25 #include "net/http/broken_alternative_services.h"
27 #include "net/http/http_server_properties.h" 26 #include "net/http/http_server_properties.h"
28 27
28 namespace base {
29 class TickClock;
30 }
31
29 namespace net { 32 namespace net {
30 33
31 // The implementation for setting/retrieving the HTTP server properties. 34 // The implementation for setting/retrieving the HTTP server properties.
32 class NET_EXPORT HttpServerPropertiesImpl 35 class NET_EXPORT HttpServerPropertiesImpl
33 : public HttpServerProperties, 36 : public HttpServerProperties,
34 public BrokenAlternativeServices::Delegate { 37 public BrokenAlternativeServices::Delegate {
35 public: 38 public:
39 // |clock| is used for setting expiration times and scheduling the
40 // expiration of broken alternative services. It must not be null.
41 explicit HttpServerPropertiesImpl(base::TickClock* clock);
42
43 // Default clock will be used.
36 HttpServerPropertiesImpl(); 44 HttpServerPropertiesImpl();
37 explicit HttpServerPropertiesImpl( 45
38 base::TickClock* broken_alternative_services_clock);
39 ~HttpServerPropertiesImpl() override; 46 ~HttpServerPropertiesImpl() override;
40 47
41 // Sets |spdy_servers_map_| with the servers (host/port) from 48 // Sets |spdy_servers_map_| with the servers (host/port) from
42 // |spdy_servers| that either support SPDY or not. 49 // |spdy_servers| that either support SPDY or not.
43 void SetSpdyServers(std::unique_ptr<SpdyServersMap> spdy_servers_map); 50 void SetSpdyServers(std::unique_ptr<SpdyServersMap> spdy_servers_map);
44 51
45 void SetAlternativeServiceServers( 52 void SetAlternativeServiceServers(
46 std::unique_ptr<AlternativeServiceMap> alternate_protocol_servers); 53 std::unique_ptr<AlternativeServiceMap> alternate_protocol_servers);
47 54
48 void SetSupportsQuic(const IPAddress& last_address); 55 void SetSupportsQuic(const IPAddress& last_address);
49 56
50 void SetServerNetworkStats( 57 void SetServerNetworkStats(
51 std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map); 58 std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map);
52 59
53 void SetQuicServerInfoMap( 60 void SetQuicServerInfoMap(
54 std::unique_ptr<QuicServerInfoMap> quic_server_info_map); 61 std::unique_ptr<QuicServerInfoMap> quic_server_info_map);
55 62
56 // Get the list of servers (host/port) that support SPDY. The max_size is the 63 // Get the list of servers (host/port) that support SPDY. The max_size is the
57 // number of MRU servers that support SPDY that are to be returned. 64 // number of MRU servers that support SPDY that are to be returned.
58 void GetSpdyServerList(std::vector<std::string>* spdy_servers, 65 void GetSpdyServerList(std::vector<std::string>* spdy_servers,
59 size_t max_size) const; 66 size_t max_size) const;
60 67
68 void SetBrokenAndRecentlyBrokenAlternativeServices(
69 std::unique_ptr<BrokenAlternativeServiceList>
70 broken_alternative_service_list,
71 std::unique_ptr<RecentlyBrokenAlternativeServices>
72 recently_broken_alternative_services);
73
74 const BrokenAlternativeServiceList& broken_alternative_service_list() const;
75
76 const RecentlyBrokenAlternativeServices&
77 recently_broken_alternative_services() const;
78
61 // Returns flattened string representation of the |host_port_pair|. Used by 79 // Returns flattened string representation of the |host_port_pair|. Used by
62 // unittests. 80 // unittests.
63 static std::string GetFlattenedSpdyServer(const HostPortPair& host_port_pair); 81 static std::string GetFlattenedSpdyServer(const HostPortPair& host_port_pair);
64 82
65 // Returns the canonical host suffix for |host|, or nullptr if none 83 // Returns the canonical host suffix for |host|, or nullptr if none
66 // exists. 84 // exists.
67 const std::string* GetCanonicalSuffix(const std::string& host) const; 85 const std::string* GetCanonicalSuffix(const std::string& host) const;
68 86
69 // ----------------------------- 87 // -----------------------------
70 // HttpServerProperties methods: 88 // HttpServerProperties methods:
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 AlternativeServiceMap::const_iterator GetAlternateProtocolIterator( 152 AlternativeServiceMap::const_iterator GetAlternateProtocolIterator(
135 const url::SchemeHostPort& server); 153 const url::SchemeHostPort& server);
136 154
137 // Return the canonical host for |server|, or end if none exists. 155 // Return the canonical host for |server|, or end if none exists.
138 CanonicalHostMap::const_iterator GetCanonicalHost( 156 CanonicalHostMap::const_iterator GetCanonicalHost(
139 const url::SchemeHostPort& server) const; 157 const url::SchemeHostPort& server) const;
140 158
141 // Remove the cononical host for |server|. 159 // Remove the cononical host for |server|.
142 void RemoveCanonicalHost(const url::SchemeHostPort& server); 160 void RemoveCanonicalHost(const url::SchemeHostPort& server);
143 161
144 base::DefaultTickClock broken_alternative_services_clock_; 162 base::DefaultTickClock default_clock_;
145 BrokenAlternativeServices broken_alternative_services_;
146 163
147 SpdyServersMap spdy_servers_map_; 164 SpdyServersMap spdy_servers_map_;
148 Http11ServerHostPortSet http11_servers_; 165 Http11ServerHostPortSet http11_servers_;
149 166
150 AlternativeServiceMap alternative_service_map_; 167 AlternativeServiceMap alternative_service_map_;
151 168
169 BrokenAlternativeServices broken_alternative_services_;
170
152 IPAddress last_quic_address_; 171 IPAddress last_quic_address_;
153 ServerNetworkStatsMap server_network_stats_map_; 172 ServerNetworkStatsMap server_network_stats_map_;
154 // Contains a map of servers which could share the same alternate protocol. 173 // Contains a map of servers which could share the same alternate protocol.
155 // Map from a Canonical scheme/host/port (host is some postfix of host names) 174 // Map from a Canonical scheme/host/port (host is some postfix of host names)
156 // to an actual origin, which has a plausible alternate protocol mapping. 175 // to an actual origin, which has a plausible alternate protocol mapping.
157 CanonicalHostMap canonical_host_to_origin_map_; 176 CanonicalHostMap canonical_host_to_origin_map_;
158 // Contains list of suffixes (for exmaple ".c.youtube.com", 177 // Contains list of suffixes (for exmaple ".c.youtube.com",
159 // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames. 178 // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames.
160 CanonicalSufficList canonical_suffixes_; 179 CanonicalSufficList canonical_suffixes_;
161 180
162 QuicServerInfoMap quic_server_info_map_; 181 QuicServerInfoMap quic_server_info_map_;
163 size_t max_server_configs_stored_in_properties_; 182 size_t max_server_configs_stored_in_properties_;
164 183
165 THREAD_CHECKER(thread_checker_); 184 THREAD_CHECKER(thread_checker_);
166 185
167 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); 186 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl);
168 }; 187 };
169 188
170 } // namespace net 189 } // namespace net
171 190
172 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ 191 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698