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

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

Issue 2928763002: Move SpdySessionRequestMap to SpdySessionPool (Closed)
Patch Set: address comment Created 3 years, 6 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
« no previous file with comments | « no previous file | net/http/http_stream_factory_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) 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_STREAM_FACTORY_IMPL_H_ 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 10 matching lines...) Expand all
21 #include "net/http/http_stream_factory.h" 21 #include "net/http/http_stream_factory.h"
22 #include "net/log/net_log_source.h" 22 #include "net/log/net_log_source.h"
23 #include "net/proxy/proxy_server.h" 23 #include "net/proxy/proxy_server.h"
24 #include "net/socket/ssl_client_socket.h" 24 #include "net/socket/ssl_client_socket.h"
25 #include "net/spdy/chromium/spdy_session_key.h" 25 #include "net/spdy/chromium/spdy_session_key.h"
26 26
27 namespace net { 27 namespace net {
28 28
29 class HttpNetworkSession; 29 class HttpNetworkSession;
30 class ProxyInfo; 30 class ProxyInfo;
31 class SpdySession;
32 class NetLogWithSource; 31 class NetLogWithSource;
33 32
34 class NET_EXPORT_PRIVATE HttpStreamFactoryImpl : public HttpStreamFactory { 33 class NET_EXPORT_PRIVATE HttpStreamFactoryImpl : public HttpStreamFactory {
35 public: 34 public:
36 class NET_EXPORT_PRIVATE Job; 35 class NET_EXPORT_PRIVATE Job;
37 class NET_EXPORT_PRIVATE JobController; 36 class NET_EXPORT_PRIVATE JobController;
38 class NET_EXPORT_PRIVATE JobFactory; 37 class NET_EXPORT_PRIVATE JobFactory;
39 class NET_EXPORT_PRIVATE Request; 38 class NET_EXPORT_PRIVATE Request;
40 // RequestStream may only be called if |for_websockets| is false. 39 // RequestStream may only be called if |for_websockets| is false.
41 // RequestWebSocketHandshakeStream may only be called if |for_websockets| 40 // RequestWebSocketHandshakeStream may only be called if |for_websockets|
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 ALTERNATIVE, 84 ALTERNATIVE,
86 PRECONNECT, 85 PRECONNECT,
87 }; 86 };
88 87
89 private: 88 private:
90 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, SetPriority); 89 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, SetPriority);
91 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, DelayMainJob); 90 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, DelayMainJob);
92 91
93 friend class HttpStreamFactoryImplPeer; 92 friend class HttpStreamFactoryImplPeer;
94 93
95 typedef std::set<Request*> RequestSet;
96 typedef std::map<SpdySessionKey, RequestSet> SpdySessionRequestMap;
97 typedef std::set<std::unique_ptr<JobController>> JobControllerSet; 94 typedef std::set<std::unique_ptr<JobController>> JobControllerSet;
98 95
99 // |PreconnectingProxyServer| holds information of a connection to a single 96 // |PreconnectingProxyServer| holds information of a connection to a single
100 // proxy server. 97 // proxy server.
101 struct PreconnectingProxyServer { 98 struct PreconnectingProxyServer {
102 PreconnectingProxyServer(ProxyServer proxy_server, 99 PreconnectingProxyServer(ProxyServer proxy_server,
103 PrivacyMode privacy_mode); 100 PrivacyMode privacy_mode);
104 101
105 // Needed to be an element of std::set. 102 // Needed to be an element of std::set.
106 bool operator<(const PreconnectingProxyServer& other) const; 103 bool operator<(const PreconnectingProxyServer& other) const;
(...skipping 19 matching lines...) Expand all
126 RequestPriority priority, 123 RequestPriority priority,
127 const SSLConfig& server_ssl_config, 124 const SSLConfig& server_ssl_config,
128 const SSLConfig& proxy_ssl_config, 125 const SSLConfig& proxy_ssl_config,
129 HttpStreamRequest::Delegate* delegate, 126 HttpStreamRequest::Delegate* delegate,
130 WebSocketHandshakeStreamBase::CreateHelper* create_helper, 127 WebSocketHandshakeStreamBase::CreateHelper* create_helper,
131 HttpStreamRequest::StreamType stream_type, 128 HttpStreamRequest::StreamType stream_type,
132 bool enable_ip_based_pooling, 129 bool enable_ip_based_pooling,
133 bool enable_alternative_services, 130 bool enable_alternative_services,
134 const NetLogWithSource& net_log); 131 const NetLogWithSource& net_log);
135 132
136 // Called when a SpdySession is ready. It will find appropriate Requests and
137 // fulfill them. |direct| indicates whether or not |spdy_session| uses a
138 // proxy.
139 void OnNewSpdySessionReady(const base::WeakPtr<SpdySession>& spdy_session,
140 bool direct,
141 const SSLConfig& used_ssl_config,
142 const ProxyInfo& used_proxy_info,
143 bool was_alpn_negotiated,
144 NextProto negotiated_protocol,
145 bool using_spdy,
146 NetLogSource source_dependency);
147
148 // Called when the Job detects that the endpoint indicated by the 133 // Called when the Job detects that the endpoint indicated by the
149 // Alternate-Protocol does not work. Lets the factory update 134 // Alternate-Protocol does not work. Lets the factory update
150 // HttpAlternateProtocols with the failure and resets the SPDY session key. 135 // HttpAlternateProtocols with the failure and resets the SPDY session key.
151 void OnBrokenAlternateProtocol(const Job*, const HostPortPair& origin); 136 void OnBrokenAlternateProtocol(const Job*, const HostPortPair& origin);
152 137
153 // Called when the Preconnect completes. Used for testing. 138 // Called when the Preconnect completes. Used for testing.
154 virtual void OnPreconnectsCompleteInternal() {} 139 virtual void OnPreconnectsCompleteInternal() {}
155 140
156 // Called when the JobController finishes service. Delete the JobController 141 // Called when the JobController finishes service. Delete the JobController
157 // from |job_controller_set_|. 142 // from |job_controller_set_|.
(...skipping 28 matching lines...) Expand all
186 // its work. 171 // its work.
187 JobControllerSet job_controller_set_; 172 JobControllerSet job_controller_set_;
188 173
189 // Factory used by job controllers for creating jobs. 174 // Factory used by job controllers for creating jobs.
190 std::unique_ptr<JobFactory> job_factory_; 175 std::unique_ptr<JobFactory> job_factory_;
191 176
192 // Set of proxy servers that support request priorities to which subsequent 177 // Set of proxy servers that support request priorities to which subsequent
193 // preconnects should be skipped. 178 // preconnects should be skipped.
194 std::set<PreconnectingProxyServer> preconnecting_proxy_servers_; 179 std::set<PreconnectingProxyServer> preconnecting_proxy_servers_;
195 180
196 SpdySessionRequestMap spdy_session_request_map_;
197
198 const bool for_websockets_; 181 const bool for_websockets_;
199 182
200 // The count of JobControllers that was most recently logged to histograms. 183 // The count of JobControllers that was most recently logged to histograms.
201 size_t last_logged_job_controller_count_; 184 size_t last_logged_job_controller_count_;
202 185
203 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImpl); 186 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImpl);
204 }; 187 };
205 188
206 } // namespace net 189 } // namespace net
207 190
208 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ 191 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | net/http/http_stream_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698