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

Side by Side Diff: net/spdy/chromium/spdy_session_pool.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
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_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
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 // Adds |request| to |spdy_session_request_map_| under |spdy_session_key| Key.
183 // Sets |spdy_session_key| as |request|'s SpdySessionKey.
184 void AddRequestToSpdySessionRequestMap(
185 const SpdySessionKey& spdy_session_key,
186 HttpStreamFactoryImpl::Request* request);
187
188 // Removes |request| from |spdy_session_request_map_|. No-op if |request| does
189 // not have a SpdySessionKey.
190 void RemoveRequestFromSpdySessionRequestMap(
191 HttpStreamFactoryImpl::Request* request);
192
169 private: 193 private:
170 friend class SpdySessionPoolPeer; // For testing. 194 friend class SpdySessionPoolPeer; // For testing.
171 195
196 typedef std::set<HttpStreamFactoryImpl::Request*> RequestSet;
197 typedef std::map<SpdySessionKey, RequestSet> SpdySessionRequestMap;
172 typedef std::set<SpdySession*> SessionSet; 198 typedef std::set<SpdySession*> SessionSet;
173 typedef std::vector<base::WeakPtr<SpdySession> > WeakSessionList; 199 typedef std::vector<base::WeakPtr<SpdySession> > WeakSessionList;
174 typedef std::map<SpdySessionKey, base::WeakPtr<SpdySession> > 200 typedef std::map<SpdySessionKey, base::WeakPtr<SpdySession> >
175 AvailableSessionMap; 201 AvailableSessionMap;
176 typedef std::map<IPEndPoint, SpdySessionKey> AliasMap; 202 typedef std::map<IPEndPoint, SpdySessionKey> AliasMap;
177 typedef std::map<GURL, WeakSessionList> UnclaimedPushedStreamMap; 203 typedef std::map<GURL, WeakSessionList> UnclaimedPushedStreamMap;
178 204
179 // Returns true iff |session| is in |available_sessions_|. 205 // Returns true iff |session| is in |available_sessions_|.
180 bool IsSessionAvailable(const base::WeakPtr<SpdySession>& session) const; 206 bool IsSessionAvailable(const base::WeakPtr<SpdySession>& session) const;
181 207
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 bool enable_ping_based_connection_checking_; 264 bool enable_ping_based_connection_checking_;
239 265
240 size_t session_max_recv_window_size_; 266 size_t session_max_recv_window_size_;
241 267
242 // Settings that are sent in the initial SETTINGS frame 268 // Settings that are sent in the initial SETTINGS frame
243 // (if |enable_sending_initial_data_| is true), 269 // (if |enable_sending_initial_data_| is true),
244 // and also control SpdySession parameters like initial receive window size 270 // and also control SpdySession parameters like initial receive window size
245 // and maximum HPACK dynamic table size. 271 // and maximum HPACK dynamic table size.
246 const SettingsMap initial_settings_; 272 const SettingsMap initial_settings_;
247 273
274 SpdySessionRequestMap spdy_session_request_map_;
275
248 TimeFunc time_func_; 276 TimeFunc time_func_;
249 ServerPushDelegate* push_delegate_; 277 ServerPushDelegate* push_delegate_;
250 278
251 // Determines if a proxy is a trusted SPDY proxy, which is allowed to push 279 // 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 280 // resources from origins that are different from those of their associated
253 // streams. May be nullptr. 281 // streams. May be nullptr.
254 ProxyDelegate* proxy_delegate_; 282 ProxyDelegate* proxy_delegate_;
255 283
256 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); 284 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool);
257 }; 285 };
258 286
259 } // namespace net 287 } // namespace net
260 288
261 #endif // NET_SPDY_CHROMIUM_SPDY_SESSION_POOL_H_ 289 #endif // NET_SPDY_CHROMIUM_SPDY_SESSION_POOL_H_
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job_controller.cc ('k') | net/spdy/chromium/spdy_session_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698