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

Side by Side Diff: net/spdy/spdy_session.h

Issue 9667016: Close idle connections / SPDY sessions when needed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/transport_client_socket_pool.cc ('k') | net/spdy/spdy_session.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_SPDY_SPDY_SESSION_H_ 5 #ifndef NET_SPDY_SPDY_SESSION_H_
6 #define NET_SPDY_SPDY_SESSION_H_ 6 #define NET_SPDY_SPDY_SESSION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // somewhat arbitrary, but is reasonably small and ensures that we elicit 43 // somewhat arbitrary, but is reasonably small and ensures that we elicit
44 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). 44 // ACKs quickly from TCP (because TCP tries to only ACK every other packet).
45 const int kMss = 1430; 45 const int kMss = 1430;
46 const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::SpdyFrame::kHeaderSize; 46 const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::SpdyFrame::kHeaderSize;
47 47
48 class BoundNetLog; 48 class BoundNetLog;
49 class SpdyStream; 49 class SpdyStream;
50 class SSLInfo; 50 class SSLInfo;
51 51
52 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, 52 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
53 public spdy::BufferedSpdyFramerVisitorInterface { 53 public spdy::BufferedSpdyFramerVisitorInterface,
54 public LayeredPool {
54 public: 55 public:
55 // Create a new SpdySession. 56 // Create a new SpdySession.
56 // |host_port_proxy_pair| is the host/port that this session connects to, and 57 // |host_port_proxy_pair| is the host/port that this session connects to, and
57 // the proxy configuration settings that it's using. 58 // the proxy configuration settings that it's using.
58 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must 59 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must
59 // strictly be greater than |this|. 60 // strictly be greater than |this|.
60 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log 61 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log
61 // network events to. 62 // network events to.
62 SpdySession(const HostPortProxyPair& host_port_proxy_pair, 63 SpdySession(const HostPortProxyPair& host_port_proxy_pair,
63 SpdySessionPool* spdy_session_pool, 64 SpdySessionPool* spdy_session_pool,
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // Adds |alias| to set of aliases associated with this session. 260 // Adds |alias| to set of aliases associated with this session.
260 void AddPooledAlias(const HostPortProxyPair& alias); 261 void AddPooledAlias(const HostPortProxyPair& alias);
261 262
262 // Returns the set of aliases associated with this session. 263 // Returns the set of aliases associated with this session.
263 const std::set<HostPortProxyPair>& pooled_aliases() const { 264 const std::set<HostPortProxyPair>& pooled_aliases() const {
264 return pooled_aliases_; 265 return pooled_aliases_;
265 } 266 }
266 267
267 int GetProtocolVersion() const; 268 int GetProtocolVersion() const;
268 269
270 // LayeredPool implementation.
271 virtual bool CloseOneIdleConnection() OVERRIDE;
272
269 private: 273 private:
270 friend class base::RefCounted<SpdySession>; 274 friend class base::RefCounted<SpdySession>;
271 275
272 // Allow tests to access our innards for testing purposes. 276 // Allow tests to access our innards for testing purposes.
273 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); 277 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping);
274 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); 278 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing);
275 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); 279 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream);
280 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, CloseOneIdleConnection);
276 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); 281 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping);
277 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); 282 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing);
278 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); 283 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream);
284 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, CloseOneIdleConnection);
279 285
280 struct PendingCreateStream { 286 struct PendingCreateStream {
281 PendingCreateStream(const GURL& url, RequestPriority priority, 287 PendingCreateStream(const GURL& url, RequestPriority priority,
282 scoped_refptr<SpdyStream>* spdy_stream, 288 scoped_refptr<SpdyStream>* spdy_stream,
283 const BoundNetLog& stream_net_log, 289 const BoundNetLog& stream_net_log,
284 const CompletionCallback& callback) 290 const CompletionCallback& callback)
285 : url(&url), 291 : url(&url),
286 priority(priority), 292 priority(priority),
287 spdy_stream(spdy_stream), 293 spdy_stream(spdy_stream),
288 stream_net_log(&stream_net_log), 294 stream_net_log(&stream_net_log),
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 693
688 const int status_; 694 const int status_;
689 const std::string description_; 695 const std::string description_;
690 696
691 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); 697 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter);
692 }; 698 };
693 699
694 } // namespace net 700 } // namespace net
695 701
696 #endif // NET_SPDY_SPDY_SESSION_H_ 702 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW
« no previous file with comments | « net/socket/transport_client_socket_pool.cc ('k') | net/spdy/spdy_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698