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_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 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 GURL url_; | 179 GURL url_; |
180 RequestPriority priority_; | 180 RequestPriority priority_; |
181 BoundNetLog net_log_; | 181 BoundNetLog net_log_; |
182 CompletionCallback callback_; | 182 CompletionCallback callback_; |
183 | 183 |
184 DISALLOW_COPY_AND_ASSIGN(SpdyStreamRequest); | 184 DISALLOW_COPY_AND_ASSIGN(SpdyStreamRequest); |
185 }; | 185 }; |
186 | 186 |
187 class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface, | 187 class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface, |
188 public SpdyFramerDebugVisitorInterface, | 188 public SpdyFramerDebugVisitorInterface, |
189 public LayeredPool { | 189 public HigherLayeredPool { |
190 public: | 190 public: |
191 // TODO(akalin): Use base::TickClock when it becomes available. | 191 // TODO(akalin): Use base::TickClock when it becomes available. |
192 typedef base::TimeTicks (*TimeFunc)(void); | 192 typedef base::TimeTicks (*TimeFunc)(void); |
193 | 193 |
194 // How we handle flow control (version-dependent). | 194 // How we handle flow control (version-dependent). |
195 enum FlowControlState { | 195 enum FlowControlState { |
196 FLOW_CONTROL_NONE, | 196 FLOW_CONTROL_NONE, |
197 FLOW_CONTROL_STREAM, | 197 FLOW_CONTROL_STREAM, |
198 FLOW_CONTROL_STREAM_AND_SESSION | 198 FLOW_CONTROL_STREAM_AND_SESSION |
199 }; | 199 }; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 return buffered_spdy_framer_->GetFrameMaximumSize(); | 473 return buffered_spdy_framer_->GetFrameMaximumSize(); |
474 } | 474 } |
475 | 475 |
476 size_t GetDataFrameMaximumPayload() const { | 476 size_t GetDataFrameMaximumPayload() const { |
477 return buffered_spdy_framer_->GetDataFrameMaximumPayload(); | 477 return buffered_spdy_framer_->GetDataFrameMaximumPayload(); |
478 } | 478 } |
479 | 479 |
480 // Must be used only by |pool_|. | 480 // Must be used only by |pool_|. |
481 base::WeakPtr<SpdySession> GetWeakPtr(); | 481 base::WeakPtr<SpdySession> GetWeakPtr(); |
482 | 482 |
483 // LayeredPool implementation: | 483 // HigherLayeredPool implementation: |
484 virtual bool CloseOneIdleConnection() OVERRIDE; | 484 virtual bool CloseOneIdleConnection() OVERRIDE; |
485 | 485 |
486 private: | 486 private: |
487 friend class base::RefCounted<SpdySession>; | 487 friend class base::RefCounted<SpdySession>; |
488 friend class SpdyStreamRequest; | 488 friend class SpdyStreamRequest; |
489 friend class SpdySessionTest; | 489 friend class SpdySessionTest; |
490 | 490 |
491 // Allow tests to access our innards for testing purposes. | 491 // Allow tests to access our innards for testing purposes. |
492 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, ClientPing); | 492 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, ClientPing); |
493 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, FailedPing); | 493 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, FailedPing); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 void QueueSendStalledStream(const SpdyStream& stream); | 899 void QueueSendStalledStream(const SpdyStream& stream); |
900 | 900 |
901 // Go through the queue of send-stalled streams and try to resume as | 901 // Go through the queue of send-stalled streams and try to resume as |
902 // many as possible. | 902 // many as possible. |
903 void ResumeSendStalledStreams(); | 903 void ResumeSendStalledStreams(); |
904 | 904 |
905 // Returns the next stream to possibly resume, or 0 if the queue is | 905 // Returns the next stream to possibly resume, or 0 if the queue is |
906 // empty. | 906 // empty. |
907 SpdyStreamId PopStreamToPossiblyResume(); | 907 SpdyStreamId PopStreamToPossiblyResume(); |
908 | 908 |
| 909 // Closes the session if it's idle. Much like CloseOneIdleConnection, but |
| 910 // without the DCHECKs. |
| 911 void CloseIfIdle(); |
| 912 |
909 // -------------------------- | 913 // -------------------------- |
910 // Helper methods for testing | 914 // Helper methods for testing |
911 // -------------------------- | 915 // -------------------------- |
912 | 916 |
913 void set_connection_at_risk_of_loss_time(base::TimeDelta duration) { | 917 void set_connection_at_risk_of_loss_time(base::TimeDelta duration) { |
914 connection_at_risk_of_loss_time_ = duration; | 918 connection_at_risk_of_loss_time_ = duration; |
915 } | 919 } |
916 | 920 |
917 void set_hung_interval(base::TimeDelta duration) { | 921 void set_hung_interval(base::TimeDelta duration) { |
918 hung_interval_ = duration; | 922 hung_interval_ = duration; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 // This SPDY proxy is allowed to push resources from origins that are | 1138 // This SPDY proxy is allowed to push resources from origins that are |
1135 // different from those of their associated streams. | 1139 // different from those of their associated streams. |
1136 HostPortPair trusted_spdy_proxy_; | 1140 HostPortPair trusted_spdy_proxy_; |
1137 | 1141 |
1138 TimeFunc time_func_; | 1142 TimeFunc time_func_; |
1139 }; | 1143 }; |
1140 | 1144 |
1141 } // namespace net | 1145 } // namespace net |
1142 | 1146 |
1143 #endif // NET_SPDY_SPDY_SESSION_H_ | 1147 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |