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_SPDY_CHROMIUM_SPDY_SESSION_POOL_H_ | 5 #ifndef NET_SPDY_CHROMIUM_SPDY_SESSION_POOL_H_ |
6 #define NET_SPDY_CHROMIUM_SPDY_SESSION_POOL_H_ | 6 #define NET_SPDY_CHROMIUM_SPDY_SESSION_POOL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "net/base/host_port_pair.h" | 18 #include "net/base/host_port_pair.h" |
19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
21 #include "net/base/net_export.h" | 21 #include "net/base/net_export.h" |
22 #include "net/base/network_change_notifier.h" | 22 #include "net/base/network_change_notifier.h" |
23 #include "net/cert/cert_database.h" | 23 #include "net/cert/cert_database.h" |
24 #include "net/http/http_stream_factory_impl_request.h" | |
24 #include "net/proxy/proxy_config.h" | 25 #include "net/proxy/proxy_config.h" |
25 #include "net/proxy/proxy_server.h" | 26 #include "net/proxy/proxy_server.h" |
26 #include "net/spdy/chromium/server_push_delegate.h" | 27 #include "net/spdy/chromium/server_push_delegate.h" |
27 #include "net/spdy/chromium/spdy_session_key.h" | 28 #include "net/spdy/chromium/spdy_session_key.h" |
28 #include "net/spdy/core/spdy_protocol.h" | 29 #include "net/spdy/core/spdy_protocol.h" |
29 #include "net/spdy/platform/api/spdy_string.h" | 30 #include "net/spdy/platform/api/spdy_string.h" |
30 #include "net/ssl/ssl_config_service.h" | 31 #include "net/ssl/ssl_config_service.h" |
31 | 32 |
32 namespace base { | 33 namespace base { |
33 namespace trace_event { | 34 namespace trace_event { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 | 160 |
160 // CertDatabase::Observer methods: | 161 // CertDatabase::Observer methods: |
161 | 162 |
162 // We perform the same flushing as described above when certificate database | 163 // We perform the same flushing as described above when certificate database |
163 // is changed. | 164 // is changed. |
164 void OnCertDBChanged() override; | 165 void OnCertDBChanged() override; |
165 | 166 |
166 void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd, | 167 void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd, |
167 const SpdyString& parent_dump_absolute_name) const; | 168 const SpdyString& parent_dump_absolute_name) const; |
168 | 169 |
170 // Called when a SpdySession is ready. It will find appropriate Requests and | |
171 // fulfill them. |direct| indicates whether or not |spdy_session| uses a | |
172 // proxy. | |
173 void OnNewSpdySessionReady(const base::WeakPtr<SpdySession>& spdy_session, | |
174 bool direct, | |
175 const SSLConfig& used_ssl_config, | |
176 const ProxyInfo& used_proxy_info, | |
177 bool was_alpn_negotiated, | |
178 NextProto negotiated_protocol, | |
179 bool using_spdy, | |
180 NetLogSource source_dependency); | |
181 | |
182 void RemoveRequestFromSpdySessionRequestMap( | |
Bence
2017/06/07 17:41:43
Please add comments for all public methods.
Bence
2017/06/07 17:41:43
Optional: You could list "Add" before "Remove", th
xunjieli
2017/06/07 21:55:56
Done.
xunjieli
2017/06/07 21:55:56
Done.
| |
183 HttpStreamFactoryImpl::Request* request); | |
184 | |
185 void AddRequestToSpdySessionRequestMap( | |
186 const SpdySessionKey& spdy_session_key, | |
187 HttpStreamFactoryImpl::Request* request); | |
188 | |
169 private: | 189 private: |
170 friend class SpdySessionPoolPeer; // For testing. | 190 friend class SpdySessionPoolPeer; // For testing. |
171 | 191 |
192 typedef std::set<HttpStreamFactoryImpl::Request*> RequestSet; | |
193 typedef std::map<SpdySessionKey, RequestSet> SpdySessionRequestMap; | |
172 typedef std::set<SpdySession*> SessionSet; | 194 typedef std::set<SpdySession*> SessionSet; |
173 typedef std::vector<base::WeakPtr<SpdySession> > WeakSessionList; | 195 typedef std::vector<base::WeakPtr<SpdySession> > WeakSessionList; |
174 typedef std::map<SpdySessionKey, base::WeakPtr<SpdySession> > | 196 typedef std::map<SpdySessionKey, base::WeakPtr<SpdySession> > |
175 AvailableSessionMap; | 197 AvailableSessionMap; |
176 typedef std::map<IPEndPoint, SpdySessionKey> AliasMap; | 198 typedef std::map<IPEndPoint, SpdySessionKey> AliasMap; |
177 typedef std::map<GURL, WeakSessionList> UnclaimedPushedStreamMap; | 199 typedef std::map<GURL, WeakSessionList> UnclaimedPushedStreamMap; |
178 | 200 |
179 // Returns true iff |session| is in |available_sessions_|. | 201 // Returns true iff |session| is in |available_sessions_|. |
180 bool IsSessionAvailable(const base::WeakPtr<SpdySession>& session) const; | 202 bool IsSessionAvailable(const base::WeakPtr<SpdySession>& session) const; |
181 | 203 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 bool enable_ping_based_connection_checking_; | 260 bool enable_ping_based_connection_checking_; |
239 | 261 |
240 size_t session_max_recv_window_size_; | 262 size_t session_max_recv_window_size_; |
241 | 263 |
242 // Settings that are sent in the initial SETTINGS frame | 264 // Settings that are sent in the initial SETTINGS frame |
243 // (if |enable_sending_initial_data_| is true), | 265 // (if |enable_sending_initial_data_| is true), |
244 // and also control SpdySession parameters like initial receive window size | 266 // and also control SpdySession parameters like initial receive window size |
245 // and maximum HPACK dynamic table size. | 267 // and maximum HPACK dynamic table size. |
246 const SettingsMap initial_settings_; | 268 const SettingsMap initial_settings_; |
247 | 269 |
270 SpdySessionRequestMap spdy_session_request_map_; | |
271 | |
248 TimeFunc time_func_; | 272 TimeFunc time_func_; |
249 ServerPushDelegate* push_delegate_; | 273 ServerPushDelegate* push_delegate_; |
250 | 274 |
251 // Determines if a proxy is a trusted SPDY proxy, which is allowed to push | 275 // Determines if a proxy is a trusted SPDY proxy, which is allowed to push |
252 // resources from origins that are different from those of their associated | 276 // resources from origins that are different from those of their associated |
253 // streams. May be nullptr. | 277 // streams. May be nullptr. |
254 ProxyDelegate* proxy_delegate_; | 278 ProxyDelegate* proxy_delegate_; |
255 | 279 |
256 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); | 280 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); |
257 }; | 281 }; |
258 | 282 |
259 } // namespace net | 283 } // namespace net |
260 | 284 |
261 #endif // NET_SPDY_CHROMIUM_SPDY_SESSION_POOL_H_ | 285 #endif // NET_SPDY_CHROMIUM_SPDY_SESSION_POOL_H_ |
OLD | NEW |