| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 420 |
| 421 // Returns true if session is not currently active | 421 // Returns true if session is not currently active |
| 422 bool is_active() const { | 422 bool is_active() const { |
| 423 return !active_streams_.empty() || !created_streams_.empty(); | 423 return !active_streams_.empty() || !created_streams_.empty(); |
| 424 } | 424 } |
| 425 | 425 |
| 426 // Access to the number of active and pending streams. These are primarily | 426 // Access to the number of active and pending streams. These are primarily |
| 427 // available for testing and diagnostics. | 427 // available for testing and diagnostics. |
| 428 size_t num_active_streams() const { return active_streams_.size(); } | 428 size_t num_active_streams() const { return active_streams_.size(); } |
| 429 size_t num_unclaimed_pushed_streams() const { | 429 size_t num_unclaimed_pushed_streams() const { |
| 430 return unclaimed_pushed_streams_.size(); | 430 return unclaimed_pushed_streams_.size(); |
| 431 } | 431 } |
| 432 size_t num_created_streams() const { return created_streams_.size(); } | 432 size_t num_created_streams() const { return created_streams_.size(); } |
| 433 | 433 |
| 434 size_t num_pushed_streams() const { return num_pushed_streams_; } | |
| 435 size_t num_active_pushed_streams() const { | |
| 436 return num_active_pushed_streams_; | |
| 437 } | |
| 438 | |
| 439 size_t pending_create_stream_queue_size(RequestPriority priority) const { | 434 size_t pending_create_stream_queue_size(RequestPriority priority) const { |
| 440 DCHECK_GE(priority, MINIMUM_PRIORITY); | 435 DCHECK_GE(priority, MINIMUM_PRIORITY); |
| 441 DCHECK_LE(priority, MAXIMUM_PRIORITY); | 436 DCHECK_LE(priority, MAXIMUM_PRIORITY); |
| 442 return pending_create_stream_queues_[priority].size(); | 437 return pending_create_stream_queues_[priority].size(); |
| 443 } | 438 } |
| 444 | 439 |
| 445 // Returns the (version-dependent) flow control state. | 440 // Returns the (version-dependent) flow control state. |
| 446 FlowControlState flow_control_state() const { | 441 FlowControlState flow_control_state() const { |
| 447 return flow_control_state_; | 442 return flow_control_state_; |
| 448 } | 443 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, ClearSettings); | 519 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, ClearSettings); |
| 525 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, AdjustRecvWindowSize); | 520 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, AdjustRecvWindowSize); |
| 526 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, AdjustSendWindowSize); | 521 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, AdjustSendWindowSize); |
| 527 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, SessionFlowControlInactiveStream); | 522 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, SessionFlowControlInactiveStream); |
| 528 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, SessionFlowControlNoReceiveLeaks); | 523 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, SessionFlowControlNoReceiveLeaks); |
| 529 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, SessionFlowControlNoSendLeaks); | 524 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, SessionFlowControlNoSendLeaks); |
| 530 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, SessionFlowControlEndToEnd); | 525 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, SessionFlowControlEndToEnd); |
| 531 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, StreamIdSpaceExhausted); | 526 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, StreamIdSpaceExhausted); |
| 532 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, UnstallRacesWithStreamCreation); | 527 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, UnstallRacesWithStreamCreation); |
| 533 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GoAwayOnSessionFlowControlError); | 528 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GoAwayOnSessionFlowControlError); |
| 534 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, | |
| 535 RejectPushedStreamExceedingConcurrencyLimit); | |
| 536 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, IgnoreReservedRemoteStreamsCount); | |
| 537 | 529 |
| 538 typedef std::deque<base::WeakPtr<SpdyStreamRequest> > | 530 typedef std::deque<base::WeakPtr<SpdyStreamRequest> > |
| 539 PendingStreamRequestQueue; | 531 PendingStreamRequestQueue; |
| 540 | 532 |
| 541 struct ActiveStreamInfo { | 533 struct ActiveStreamInfo { |
| 542 ActiveStreamInfo(); | 534 ActiveStreamInfo(); |
| 543 explicit ActiveStreamInfo(SpdyStream* stream); | 535 explicit ActiveStreamInfo(SpdyStream* stream); |
| 544 ~ActiveStreamInfo(); | 536 ~ActiveStreamInfo(); |
| 545 | 537 |
| 546 SpdyStream* stream; | 538 SpdyStream* stream; |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 // -------------------------- | 912 // -------------------------- |
| 921 | 913 |
| 922 void set_connection_at_risk_of_loss_time(base::TimeDelta duration) { | 914 void set_connection_at_risk_of_loss_time(base::TimeDelta duration) { |
| 923 connection_at_risk_of_loss_time_ = duration; | 915 connection_at_risk_of_loss_time_ = duration; |
| 924 } | 916 } |
| 925 | 917 |
| 926 void set_hung_interval(base::TimeDelta duration) { | 918 void set_hung_interval(base::TimeDelta duration) { |
| 927 hung_interval_ = duration; | 919 hung_interval_ = duration; |
| 928 } | 920 } |
| 929 | 921 |
| 930 void set_max_concurrent_pushed_streams(size_t value) { | |
| 931 max_concurrent_pushed_streams_ = value; | |
| 932 } | |
| 933 | |
| 934 int64 pings_in_flight() const { return pings_in_flight_; } | 922 int64 pings_in_flight() const { return pings_in_flight_; } |
| 935 | 923 |
| 936 uint32 next_ping_id() const { return next_ping_id_; } | 924 uint32 next_ping_id() const { return next_ping_id_; } |
| 937 | 925 |
| 938 base::TimeTicks last_activity_time() const { return last_activity_time_; } | 926 base::TimeTicks last_activity_time() const { return last_activity_time_; } |
| 939 | 927 |
| 940 bool check_ping_status_pending() const { return check_ping_status_pending_; } | 928 bool check_ping_status_pending() const { return check_ping_status_pending_; } |
| 941 | 929 |
| 942 size_t max_concurrent_streams() const { return max_concurrent_streams_; } | 930 size_t max_concurrent_streams() const { return max_concurrent_streams_; } |
| 943 | 931 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 // (Bijective) map from the URL to the ID of the streams that have | 977 // (Bijective) map from the URL to the ID of the streams that have |
| 990 // already started to be pushed by the server, but do not have | 978 // already started to be pushed by the server, but do not have |
| 991 // consumers yet. Contains a subset of |active_streams_|. | 979 // consumers yet. Contains a subset of |active_streams_|. |
| 992 PushedStreamMap unclaimed_pushed_streams_; | 980 PushedStreamMap unclaimed_pushed_streams_; |
| 993 | 981 |
| 994 // Set of all created streams but that have not yet sent any frames. | 982 // Set of all created streams but that have not yet sent any frames. |
| 995 // | 983 // |
| 996 // |created_streams_| owns all its SpdyStream objects. | 984 // |created_streams_| owns all its SpdyStream objects. |
| 997 CreatedStreamSet created_streams_; | 985 CreatedStreamSet created_streams_; |
| 998 | 986 |
| 999 // Number of pushed streams. All active streams are stored in | |
| 1000 // |active_streams_|, but it's better to know the number of push streams | |
| 1001 // without traversing the whole collection. | |
| 1002 size_t num_pushed_streams_; | |
| 1003 | |
| 1004 // Number of active pushed streams in |active_streams_|, i.e. not in reserved | |
| 1005 // remote state. Streams in reserved state are not counted towards any | |
| 1006 // concurrency limits. | |
| 1007 size_t num_active_pushed_streams_; | |
| 1008 | |
| 1009 // The write queue. | 987 // The write queue. |
| 1010 SpdyWriteQueue write_queue_; | 988 SpdyWriteQueue write_queue_; |
| 1011 | 989 |
| 1012 // Data for the frame we are currently sending. | 990 // Data for the frame we are currently sending. |
| 1013 | 991 |
| 1014 // The buffer we're currently writing. | 992 // The buffer we're currently writing. |
| 1015 scoped_ptr<SpdyBuffer> in_flight_write_; | 993 scoped_ptr<SpdyBuffer> in_flight_write_; |
| 1016 // The type of the frame in |in_flight_write_|. | 994 // The type of the frame in |in_flight_write_|. |
| 1017 SpdyFrameType in_flight_write_frame_type_; | 995 SpdyFrameType in_flight_write_frame_type_; |
| 1018 // The size of the frame in |in_flight_write_|. | 996 // The size of the frame in |in_flight_write_|. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1037 | 1015 |
| 1038 // If the session is closing (i.e., |availability_state_| is STATE_DRAINING), | 1016 // If the session is closing (i.e., |availability_state_| is STATE_DRAINING), |
| 1039 // then |error_on_close_| holds the error with which it was closed, which | 1017 // then |error_on_close_| holds the error with which it was closed, which |
| 1040 // may be OK (upon a polite GOAWAY) or an error < ERR_IO_PENDING otherwise. | 1018 // may be OK (upon a polite GOAWAY) or an error < ERR_IO_PENDING otherwise. |
| 1041 // Initialized to OK. | 1019 // Initialized to OK. |
| 1042 Error error_on_close_; | 1020 Error error_on_close_; |
| 1043 | 1021 |
| 1044 // Limits | 1022 // Limits |
| 1045 size_t max_concurrent_streams_; // 0 if no limit | 1023 size_t max_concurrent_streams_; // 0 if no limit |
| 1046 size_t max_concurrent_streams_limit_; | 1024 size_t max_concurrent_streams_limit_; |
| 1047 size_t max_concurrent_pushed_streams_; | |
| 1048 | 1025 |
| 1049 // Some statistics counters for the session. | 1026 // Some statistics counters for the session. |
| 1050 int streams_initiated_count_; | 1027 int streams_initiated_count_; |
| 1051 int streams_pushed_count_; | 1028 int streams_pushed_count_; |
| 1052 int streams_pushed_and_claimed_count_; | 1029 int streams_pushed_and_claimed_count_; |
| 1053 int streams_abandoned_count_; | 1030 int streams_abandoned_count_; |
| 1054 | 1031 |
| 1055 // |total_bytes_received_| keeps track of all the bytes read by the | 1032 // |total_bytes_received_| keeps track of all the bytes read by the |
| 1056 // SpdySession. It is used by the |Net.SpdySettingsCwnd...| histograms. | 1033 // SpdySession. It is used by the |Net.SpdySettingsCwnd...| histograms. |
| 1057 int total_bytes_received_; | 1034 int total_bytes_received_; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 // Used for posting asynchronous IO tasks. We use this even though | 1132 // Used for posting asynchronous IO tasks. We use this even though |
| 1156 // SpdySession is refcounted because we don't need to keep the SpdySession | 1133 // SpdySession is refcounted because we don't need to keep the SpdySession |
| 1157 // alive if the last reference is within a RunnableMethod. Just revoke the | 1134 // alive if the last reference is within a RunnableMethod. Just revoke the |
| 1158 // method. | 1135 // method. |
| 1159 base::WeakPtrFactory<SpdySession> weak_factory_; | 1136 base::WeakPtrFactory<SpdySession> weak_factory_; |
| 1160 }; | 1137 }; |
| 1161 | 1138 |
| 1162 } // namespace net | 1139 } // namespace net |
| 1163 | 1140 |
| 1164 #endif // NET_SPDY_SPDY_SESSION_H_ | 1141 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |