Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" | 20 #include "base/time/default_tick_clock.h" |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "net/base/host_port_pair.h" | 22 #include "net/base/host_port_pair.h" |
| 23 #include "net/base/ip_address.h" | 23 #include "net/base/ip_address.h" |
| 24 #include "net/base/linked_hash_map.h" | 24 #include "net/base/linked_hash_map.h" |
| 25 #include "net/base/net_export.h" | 25 #include "net/base/net_export.h" |
| 26 #include "net/http/broken_alternative_services.h" | 26 #include "net/http/broken_alternative_services.h" |
| 27 #include "net/http/http_server_properties.h" | 27 #include "net/http/http_server_properties.h" |
| 28 | 28 |
| 29 namespace base { | |
| 30 class ListValue; | |
| 31 } | |
| 32 | |
| 33 namespace net { | 29 namespace net { |
| 34 | 30 |
| 35 // The implementation for setting/retrieving the HTTP server properties. | 31 // The implementation for setting/retrieving the HTTP server properties. |
| 36 class NET_EXPORT HttpServerPropertiesImpl | 32 class NET_EXPORT HttpServerPropertiesImpl |
| 37 : public HttpServerProperties, | 33 : public HttpServerProperties, |
| 38 public BrokenAlternativeServices::Delegate { | 34 public BrokenAlternativeServices::Delegate { |
| 39 public: | 35 public: |
| 40 HttpServerPropertiesImpl(); | 36 HttpServerPropertiesImpl(); |
| 41 explicit HttpServerPropertiesImpl( | 37 explicit HttpServerPropertiesImpl( |
| 42 base::TickClock* broken_alternative_services_clock); | 38 base::TickClock* broken_alternative_services_clock); |
| 43 ~HttpServerPropertiesImpl() override; | 39 ~HttpServerPropertiesImpl() override; |
| 44 | 40 |
| 45 // Sets |spdy_servers_map_| with the servers (host/port) from | 41 // Sets |spdy_servers_map_| with the servers (host/port) from |
| 46 // |spdy_servers| that either support SPDY or not. | 42 // |spdy_servers| that either support SPDY or not. |
| 47 void SetSpdyServers(std::vector<std::string>* spdy_servers, | 43 void SetSpdyServers(const std::vector<std::string>* spdy_servers, |
|
Ryan Hamilton
2017/06/20 18:25:56
Can this be a const&?
wangyix1
2017/06/21 18:45:33
The unit-test SpdyServerPropertiesTest.Set tests t
Ryan Hamilton
2017/06/22 02:45:52
This is now a unique_ptr not a const&. Is that to
wangyix1
2017/06/22 17:45:09
Yes, it's now a unique_ptr<SpdyServersMap> instead
| |
| 48 bool support_spdy); | 44 bool support_spdy); |
| 49 | 45 |
| 50 void SetAlternativeServiceServers( | 46 void SetAlternativeServiceServers( |
| 51 AlternativeServiceMap* alternate_protocol_servers); | 47 std::unique_ptr<AlternativeServiceMap> alternate_protocol_servers); |
| 52 | 48 |
| 53 void SetSupportsQuic(IPAddress* last_address); | 49 void SetSupportsQuic(const IPAddress* last_address); |
|
Ryan Hamilton
2017/06/20 18:25:56
ditto
wangyix1
2017/06/21 18:45:33
Done.
| |
| 54 | 50 |
| 55 void SetServerNetworkStats(ServerNetworkStatsMap* server_network_stats_map); | 51 void SetServerNetworkStats( |
| 52 std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map); | |
| 56 | 53 |
| 57 void SetQuicServerInfoMap(QuicServerInfoMap* quic_server_info_map); | 54 void SetQuicServerInfoMap( |
| 55 std::unique_ptr<QuicServerInfoMap> quic_server_info_map); | |
| 58 | 56 |
| 59 // Get the list of servers (host/port) that support SPDY. The max_size is the | 57 // Get the list of servers (host/port) that support SPDY. The max_size is the |
| 60 // number of MRU servers that support SPDY that are to be returned. | 58 // number of MRU servers that support SPDY that are to be returned. |
| 61 void GetSpdyServerList(base::ListValue* spdy_server_list, | 59 void GetSpdyServers(std::vector<std::string>* spdy_servers, |
| 62 size_t max_size) const; | 60 size_t max_size) const; |
| 63 | 61 |
| 64 // Returns flattened string representation of the |host_port_pair|. Used by | 62 // Returns flattened string representation of the |host_port_pair|. Used by |
| 65 // unittests. | 63 // unittests. |
| 66 static std::string GetFlattenedSpdyServer(const HostPortPair& host_port_pair); | 64 static std::string GetFlattenedSpdyServer(const HostPortPair& host_port_pair); |
| 67 | 65 |
| 68 // Returns the canonical host suffix for |host|, or nullptr if none | 66 // Returns the canonical host suffix for |host|, or nullptr if none |
| 69 // exists. | 67 // exists. |
| 70 const std::string* GetCanonicalSuffix(const std::string& host) const; | 68 const std::string* GetCanonicalSuffix(const std::string& host) const; |
| 71 | 69 |
| 72 // ----------------------------- | 70 // ----------------------------- |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 size_t max_server_configs_stored_in_properties_; | 167 size_t max_server_configs_stored_in_properties_; |
| 170 | 168 |
| 171 THREAD_CHECKER(thread_checker_); | 169 THREAD_CHECKER(thread_checker_); |
| 172 | 170 |
| 173 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 171 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
| 174 }; | 172 }; |
| 175 | 173 |
| 176 } // namespace net | 174 } // namespace net |
| 177 | 175 |
| 178 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 176 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| OLD | NEW |