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

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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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>
11 #include <map> 11 #include <map>
(...skipping 27 matching lines...) Expand all
39 // somewhat arbitrary, but is reasonably small and ensures that we elicit 39 // somewhat arbitrary, but is reasonably small and ensures that we elicit
40 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). 40 // ACKs quickly from TCP (because TCP tries to only ACK every other packet).
41 const int kMss = 1430; 41 const int kMss = 1430;
42 const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::SpdyFrame::kHeaderSize; 42 const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::SpdyFrame::kHeaderSize;
43 43
44 class BoundNetLog; 44 class BoundNetLog;
45 class SpdyStream; 45 class SpdyStream;
46 class SSLInfo; 46 class SSLInfo;
47 47
48 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, 48 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>,
49 public spdy::BufferedSpdyFramerVisitorInterface { 49 public spdy::BufferedSpdyFramerVisitorInterface,
50 public LayeredPool {
50 public: 51 public:
51 // Create a new SpdySession. 52 // Create a new SpdySession.
52 // |host_port_proxy_pair| is the host/port that this session connects to, and 53 // |host_port_proxy_pair| is the host/port that this session connects to, and
53 // the proxy configuration settings that it's using. 54 // the proxy configuration settings that it's using.
54 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must 55 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must
55 // strictly be greater than |this|. 56 // strictly be greater than |this|.
56 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log 57 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log
57 // network events to. 58 // network events to.
58 SpdySession(const HostPortProxyPair& host_port_proxy_pair, 59 SpdySession(const HostPortProxyPair& host_port_proxy_pair,
59 SpdySessionPool* spdy_session_pool, 60 SpdySessionPool* spdy_session_pool,
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // Adds |alias| to set of aliases associated with this session. 276 // Adds |alias| to set of aliases associated with this session.
276 void AddPooledAlias(const HostPortProxyPair& alias); 277 void AddPooledAlias(const HostPortProxyPair& alias);
277 278
278 // Returns the set of aliases associated with this session. 279 // Returns the set of aliases associated with this session.
279 const std::set<HostPortProxyPair>& pooled_aliases() const { 280 const std::set<HostPortProxyPair>& pooled_aliases() const {
280 return pooled_aliases_; 281 return pooled_aliases_;
281 } 282 }
282 283
283 int GetProtocolVersion() const; 284 int GetProtocolVersion() const;
284 285
286 // LayeredPool implementation.
287 virtual bool CloseOneIdleConnection() OVERRIDE;
288
285 private: 289 private:
286 friend class base::RefCounted<SpdySession>; 290 friend class base::RefCounted<SpdySession>;
287 291
288 // Allow tests to access our innards for testing purposes. 292 // Allow tests to access our innards for testing purposes.
289 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); 293 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping);
290 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); 294 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing);
291 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); 295 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream);
292 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); 296 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping);
293 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); 297 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing);
294 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); 298 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream);
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 724
721 const int status_; 725 const int status_;
722 const std::string description_; 726 const std::string description_;
723 727
724 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); 728 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter);
725 }; 729 };
726 730
727 } // namespace net 731 } // namespace net
728 732
729 #endif // NET_SPDY_SPDY_SESSION_H_ 733 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698