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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 bool enable_compression, | 243 bool enable_compression, |
244 bool enable_ping_based_connection_checking, | 244 bool enable_ping_based_connection_checking, |
245 NextProto default_protocol, | 245 NextProto default_protocol, |
246 size_t stream_initial_recv_window_size, | 246 size_t stream_initial_recv_window_size, |
247 size_t initial_max_concurrent_streams, | 247 size_t initial_max_concurrent_streams, |
248 size_t max_concurrent_streams_limit, | 248 size_t max_concurrent_streams_limit, |
249 TimeFunc time_func, | 249 TimeFunc time_func, |
250 const HostPortPair& trusted_spdy_proxy, | 250 const HostPortPair& trusted_spdy_proxy, |
251 NetLog* net_log); | 251 NetLog* net_log); |
252 | 252 |
253 virtual ~SpdySession(); | 253 ~SpdySession() override; |
254 | 254 |
255 const HostPortPair& host_port_pair() const { | 255 const HostPortPair& host_port_pair() const { |
256 return spdy_session_key_.host_port_proxy_pair().first; | 256 return spdy_session_key_.host_port_proxy_pair().first; |
257 } | 257 } |
258 const HostPortProxyPair& host_port_proxy_pair() const { | 258 const HostPortProxyPair& host_port_proxy_pair() const { |
259 return spdy_session_key_.host_port_proxy_pair(); | 259 return spdy_session_key_.host_port_proxy_pair(); |
260 } | 260 } |
261 const SpdySessionKey& spdy_session_key() const { | 261 const SpdySessionKey& spdy_session_key() const { |
262 return spdy_session_key_; | 262 return spdy_session_key_; |
263 } | 263 } |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 } | 510 } |
511 | 511 |
512 // https://http2.github.io/http2-spec/#TLSUsage mandates minimum security | 512 // https://http2.github.io/http2-spec/#TLSUsage mandates minimum security |
513 // standards for TLS. | 513 // standards for TLS. |
514 bool HasAcceptableTransportSecurity() const; | 514 bool HasAcceptableTransportSecurity() const; |
515 | 515 |
516 // Must be used only by |pool_|. | 516 // Must be used only by |pool_|. |
517 base::WeakPtr<SpdySession> GetWeakPtr(); | 517 base::WeakPtr<SpdySession> GetWeakPtr(); |
518 | 518 |
519 // HigherLayeredPool implementation: | 519 // HigherLayeredPool implementation: |
520 virtual bool CloseOneIdleConnection() override; | 520 bool CloseOneIdleConnection() override; |
521 | 521 |
522 private: | 522 private: |
523 friend class base::RefCounted<SpdySession>; | 523 friend class base::RefCounted<SpdySession>; |
524 friend class SpdyStreamRequest; | 524 friend class SpdyStreamRequest; |
525 friend class SpdySessionTest; | 525 friend class SpdySessionTest; |
526 | 526 |
527 // Allow tests to access our innards for testing purposes. | 527 // Allow tests to access our innards for testing purposes. |
528 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, ClientPing); | 528 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, ClientPing); |
529 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, FailedPing); | 529 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, FailedPing); |
530 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); | 530 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 | 806 |
807 // Invokes a user callback for stream creation. We provide this method so it | 807 // Invokes a user callback for stream creation. We provide this method so it |
808 // can be deferred to the MessageLoop, so we avoid re-entrancy problems. | 808 // can be deferred to the MessageLoop, so we avoid re-entrancy problems. |
809 void CompleteStreamRequest( | 809 void CompleteStreamRequest( |
810 const base::WeakPtr<SpdyStreamRequest>& pending_request); | 810 const base::WeakPtr<SpdyStreamRequest>& pending_request); |
811 | 811 |
812 // Remove old unclaimed pushed streams. | 812 // Remove old unclaimed pushed streams. |
813 void DeleteExpiredPushedStreams(); | 813 void DeleteExpiredPushedStreams(); |
814 | 814 |
815 // BufferedSpdyFramerVisitorInterface: | 815 // BufferedSpdyFramerVisitorInterface: |
816 virtual void OnError(SpdyFramer::SpdyError error_code) override; | 816 void OnError(SpdyFramer::SpdyError error_code) override; |
817 virtual void OnStreamError(SpdyStreamId stream_id, | 817 void OnStreamError(SpdyStreamId stream_id, |
818 const std::string& description) override; | 818 const std::string& description) override; |
819 virtual void OnPing(SpdyPingId unique_id, bool is_ack) override; | 819 void OnPing(SpdyPingId unique_id, bool is_ack) override; |
820 virtual void OnRstStream(SpdyStreamId stream_id, | 820 void OnRstStream(SpdyStreamId stream_id, SpdyRstStreamStatus status) override; |
821 SpdyRstStreamStatus status) override; | 821 void OnGoAway(SpdyStreamId last_accepted_stream_id, |
822 virtual void OnGoAway(SpdyStreamId last_accepted_stream_id, | 822 SpdyGoAwayStatus status) override; |
823 SpdyGoAwayStatus status) override; | 823 void OnDataFrameHeader(SpdyStreamId stream_id, |
824 virtual void OnDataFrameHeader(SpdyStreamId stream_id, | 824 size_t length, |
825 size_t length, | 825 bool fin) override; |
826 bool fin) override; | 826 void OnStreamFrameData(SpdyStreamId stream_id, |
827 virtual void OnStreamFrameData(SpdyStreamId stream_id, | 827 const char* data, |
828 const char* data, | 828 size_t len, |
829 size_t len, | 829 bool fin) override; |
830 bool fin) override; | 830 void OnSettings(bool clear_persisted) override; |
831 virtual void OnSettings(bool clear_persisted) override; | 831 void OnSetting(SpdySettingsIds id, uint8 flags, uint32 value) override; |
832 virtual void OnSetting( | 832 void OnWindowUpdate(SpdyStreamId stream_id, |
833 SpdySettingsIds id, uint8 flags, uint32 value) override; | 833 uint32 delta_window_size) override; |
834 virtual void OnWindowUpdate(SpdyStreamId stream_id, | 834 void OnPushPromise(SpdyStreamId stream_id, |
835 uint32 delta_window_size) override; | 835 SpdyStreamId promised_stream_id, |
836 virtual void OnPushPromise(SpdyStreamId stream_id, | 836 const SpdyHeaderBlock& headers) override; |
837 SpdyStreamId promised_stream_id, | 837 void OnSynStream(SpdyStreamId stream_id, |
838 const SpdyHeaderBlock& headers) override; | 838 SpdyStreamId associated_stream_id, |
839 virtual void OnSynStream(SpdyStreamId stream_id, | 839 SpdyPriority priority, |
840 SpdyStreamId associated_stream_id, | 840 bool fin, |
841 SpdyPriority priority, | 841 bool unidirectional, |
842 bool fin, | 842 const SpdyHeaderBlock& headers) override; |
843 bool unidirectional, | 843 void OnSynReply(SpdyStreamId stream_id, |
844 const SpdyHeaderBlock& headers) override; | 844 bool fin, |
845 virtual void OnSynReply( | 845 const SpdyHeaderBlock& headers) override; |
846 SpdyStreamId stream_id, | 846 void OnHeaders(SpdyStreamId stream_id, |
847 bool fin, | 847 bool fin, |
848 const SpdyHeaderBlock& headers) override; | 848 const SpdyHeaderBlock& headers) override; |
849 virtual void OnHeaders( | 849 bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override; |
850 SpdyStreamId stream_id, | |
851 bool fin, | |
852 const SpdyHeaderBlock& headers) override; | |
853 virtual bool OnUnknownFrame(SpdyStreamId stream_id, int frame_type) override; | |
854 | 850 |
855 // SpdyFramerDebugVisitorInterface | 851 // SpdyFramerDebugVisitorInterface |
856 virtual void OnSendCompressedFrame( | 852 void OnSendCompressedFrame(SpdyStreamId stream_id, |
857 SpdyStreamId stream_id, | 853 SpdyFrameType type, |
858 SpdyFrameType type, | 854 size_t payload_len, |
859 size_t payload_len, | 855 size_t frame_len) override; |
860 size_t frame_len) override; | 856 void OnReceiveCompressedFrame(SpdyStreamId stream_id, |
861 virtual void OnReceiveCompressedFrame( | 857 SpdyFrameType type, |
862 SpdyStreamId stream_id, | 858 size_t frame_len) override; |
863 SpdyFrameType type, | |
864 size_t frame_len) override; | |
865 | 859 |
866 // Called when bytes are consumed from a SpdyBuffer for a DATA frame | 860 // Called when bytes are consumed from a SpdyBuffer for a DATA frame |
867 // that is to be written or is being written. Increases the send | 861 // that is to be written or is being written. Increases the send |
868 // window size accordingly if some or all of the SpdyBuffer is being | 862 // window size accordingly if some or all of the SpdyBuffer is being |
869 // discarded. | 863 // discarded. |
870 // | 864 // |
871 // If session flow control is turned off, this must not be called. | 865 // If session flow control is turned off, this must not be called. |
872 void OnWriteBufferConsumed(size_t frame_payload_size, | 866 void OnWriteBufferConsumed(size_t frame_payload_size, |
873 size_t consume_size, | 867 size_t consume_size, |
874 SpdyBuffer::ConsumeSource consume_source); | 868 SpdyBuffer::ConsumeSource consume_source); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 // Used for posting asynchronous IO tasks. We use this even though | 1167 // Used for posting asynchronous IO tasks. We use this even though |
1174 // SpdySession is refcounted because we don't need to keep the SpdySession | 1168 // SpdySession is refcounted because we don't need to keep the SpdySession |
1175 // alive if the last reference is within a RunnableMethod. Just revoke the | 1169 // alive if the last reference is within a RunnableMethod. Just revoke the |
1176 // method. | 1170 // method. |
1177 base::WeakPtrFactory<SpdySession> weak_factory_; | 1171 base::WeakPtrFactory<SpdySession> weak_factory_; |
1178 }; | 1172 }; |
1179 | 1173 |
1180 } // namespace net | 1174 } // namespace net |
1181 | 1175 |
1182 #endif // NET_SPDY_SPDY_SESSION_H_ | 1176 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |