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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 typedef std::deque<base::WeakPtr<SpdyStreamRequest> > | 530 typedef std::deque<base::WeakPtr<SpdyStreamRequest> > |
531 PendingStreamRequestQueue; | 531 PendingStreamRequestQueue; |
532 | 532 |
533 struct ActiveStreamInfo { | 533 struct ActiveStreamInfo { |
534 ActiveStreamInfo(); | 534 ActiveStreamInfo(); |
535 explicit ActiveStreamInfo(SpdyStream* stream); | 535 explicit ActiveStreamInfo(SpdyStream* stream); |
536 ~ActiveStreamInfo(); | 536 ~ActiveStreamInfo(); |
537 | 537 |
538 SpdyStream* stream; | 538 SpdyStream* stream; |
539 bool waiting_for_syn_reply; | 539 bool waiting_for_syn_reply; |
540 bool reserved_remote; | |
Johnny
2014/06/17 04:01:33
Rather than having |reserved_remote| here, add an
baranovich
2014/06/17 21:33:43
Done.
| |
540 }; | 541 }; |
541 typedef std::map<SpdyStreamId, ActiveStreamInfo> ActiveStreamMap; | 542 typedef std::map<SpdyStreamId, ActiveStreamInfo> ActiveStreamMap; |
542 | 543 |
543 struct PushedStreamInfo { | 544 struct PushedStreamInfo { |
544 PushedStreamInfo(); | 545 PushedStreamInfo(); |
545 PushedStreamInfo(SpdyStreamId stream_id, base::TimeTicks creation_time); | 546 PushedStreamInfo(SpdyStreamId stream_id, base::TimeTicks creation_time); |
546 ~PushedStreamInfo(); | 547 ~PushedStreamInfo(); |
547 | 548 |
548 SpdyStreamId stream_id; | 549 SpdyStreamId stream_id; |
549 base::TimeTicks creation_time; | 550 base::TimeTicks creation_time; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
604 | 605 |
605 // Returns the next pending stream request to process, or NULL if | 606 // Returns the next pending stream request to process, or NULL if |
606 // there is none. | 607 // there is none. |
607 base::WeakPtr<SpdyStreamRequest> GetNextPendingStreamRequest(); | 608 base::WeakPtr<SpdyStreamRequest> GetNextPendingStreamRequest(); |
608 | 609 |
609 // Called when there is room to create more streams (e.g., a stream | 610 // Called when there is room to create more streams (e.g., a stream |
610 // was closed). Processes as many pending stream requests as | 611 // was closed). Processes as many pending stream requests as |
611 // possible. | 612 // possible. |
612 void ProcessPendingStreamRequests(); | 613 void ProcessPendingStreamRequests(); |
613 | 614 |
615 bool TryCreatePushStream(SpdyStreamId stream_id, | |
616 SpdyStreamId associated_stream_id, | |
617 SpdyPriority priority, | |
618 const SpdyHeaderBlock& headers); | |
619 void ActivateReservedStreamIterator(ActiveStreamMap::iterator it); | |
620 | |
614 // Close the stream pointed to by the given iterator. Note that that | 621 // Close the stream pointed to by the given iterator. Note that that |
615 // stream may hold the last reference to the session. | 622 // stream may hold the last reference to the session. |
616 void CloseActiveStreamIterator(ActiveStreamMap::iterator it, int status); | 623 void CloseActiveStreamIterator(ActiveStreamMap::iterator it, int status); |
617 | 624 |
618 // Close the stream pointed to by the given iterator. Note that that | 625 // Close the stream pointed to by the given iterator. Note that that |
619 // stream may hold the last reference to the session. | 626 // stream may hold the last reference to the session. |
620 void CloseCreatedStreamIterator(CreatedStreamSet::iterator it, int status); | 627 void CloseCreatedStreamIterator(CreatedStreamSet::iterator it, int status); |
621 | 628 |
622 // Calls EnqueueResetStreamFrame() and then | 629 // Calls EnqueueResetStreamFrame() and then |
623 // CloseActiveStreamIterator(). | 630 // CloseActiveStreamIterator(). |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
961 // of whether or not there is currently any ongoing IO [might be waiting for | 968 // of whether or not there is currently any ongoing IO [might be waiting for |
962 // the server to start pushing the stream]) or there are still network events | 969 // the server to start pushing the stream]) or there are still network events |
963 // incoming even though the consumer has already gone away (cancellation). | 970 // incoming even though the consumer has already gone away (cancellation). |
964 // | 971 // |
965 // |active_streams_| owns all its SpdyStream objects. | 972 // |active_streams_| owns all its SpdyStream objects. |
966 // | 973 // |
967 // TODO(willchan): Perhaps we should separate out cancelled streams and move | 974 // TODO(willchan): Perhaps we should separate out cancelled streams and move |
968 // them into a separate ActiveStreamMap, and not deliver network events to | 975 // them into a separate ActiveStreamMap, and not deliver network events to |
969 // them? | 976 // them? |
970 ActiveStreamMap active_streams_; | 977 ActiveStreamMap active_streams_; |
978 size_t reserved_remote_stream_num_; | |
Johnny
2014/06/17 04:01:33
How about |num_reserved_remote_streams_| to match
baranovich
2014/06/17 21:33:43
Done. Deleted.
| |
971 | 979 |
972 // (Bijective) map from the URL to the ID of the streams that have | 980 // (Bijective) map from the URL to the ID of the streams that have |
973 // already started to be pushed by the server, but do not have | 981 // already started to be pushed by the server, but do not have |
974 // consumers yet. Contains a subset of |active_streams_|. | 982 // consumers yet. Contains a subset of |active_streams_|. |
975 PushedStreamMap unclaimed_pushed_streams_; | 983 PushedStreamMap unclaimed_pushed_streams_; |
976 | 984 |
977 // Set of all created streams but that have not yet sent any frames. | 985 // Set of all created streams but that have not yet sent any frames. |
978 // | 986 // |
979 // |created_streams_| owns all its SpdyStream objects. | 987 // |created_streams_| owns all its SpdyStream objects. |
980 CreatedStreamSet created_streams_; | 988 CreatedStreamSet created_streams_; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1127 // Used for posting asynchronous IO tasks. We use this even though | 1135 // Used for posting asynchronous IO tasks. We use this even though |
1128 // SpdySession is refcounted because we don't need to keep the SpdySession | 1136 // SpdySession is refcounted because we don't need to keep the SpdySession |
1129 // alive if the last reference is within a RunnableMethod. Just revoke the | 1137 // alive if the last reference is within a RunnableMethod. Just revoke the |
1130 // method. | 1138 // method. |
1131 base::WeakPtrFactory<SpdySession> weak_factory_; | 1139 base::WeakPtrFactory<SpdySession> weak_factory_; |
1132 }; | 1140 }; |
1133 | 1141 |
1134 } // namespace net | 1142 } // namespace net |
1135 | 1143 |
1136 #endif // NET_SPDY_SPDY_SESSION_H_ | 1144 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |