Chromium Code Reviews| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 return spdy_session_key_; | 324 return spdy_session_key_; |
| 325 } | 325 } |
| 326 // Get a pushed stream for a given |url|. If the server initiates a | 326 // Get a pushed stream for a given |url|. If the server initiates a |
| 327 // stream, it might already exist for a given path. The server | 327 // stream, it might already exist for a given path. The server |
| 328 // might also not have initiated the stream yet, but indicated it | 328 // might also not have initiated the stream yet, but indicated it |
| 329 // will via X-Associated-Content. Returns OK if a stream was found | 329 // will via X-Associated-Content. Returns OK if a stream was found |
| 330 // and put into |spdy_stream|, or if one was not found but it is | 330 // and put into |spdy_stream|, or if one was not found but it is |
| 331 // okay to create a new stream (in which case |spdy_stream| is | 331 // okay to create a new stream (in which case |spdy_stream| is |
| 332 // reset). Returns an error (not ERR_IO_PENDING) otherwise, and | 332 // reset). Returns an error (not ERR_IO_PENDING) otherwise, and |
| 333 // resets |spdy_stream|. | 333 // resets |spdy_stream|. |
| 334 // | |
| 335 // If a stream was found and the stream is still open, the priority | |
| 336 // of that stream is updated to match |priority|. | |
| 334 int GetPushStream(const GURL& url, | 337 int GetPushStream(const GURL& url, |
| 338 RequestPriority priority, | |
| 335 base::WeakPtr<SpdyStream>* spdy_stream, | 339 base::WeakPtr<SpdyStream>* spdy_stream, |
| 336 const NetLogWithSource& stream_net_log); | 340 const NetLogWithSource& stream_net_log); |
| 337 | 341 |
| 338 void set_push_delegate(ServerPushDelegate* push_delegate) { | 342 void set_push_delegate(ServerPushDelegate* push_delegate) { |
| 339 push_delegate_ = push_delegate; | 343 push_delegate_ = push_delegate; |
| 340 } | 344 } |
| 341 | 345 |
| 342 // Called when the pushed stream should be cancelled. If the pushed stream is | 346 // Called when the pushed stream should be cancelled. If the pushed stream is |
| 343 // not claimed and active, sends RST to the server to cancel the stream. | 347 // not claimed and active, sends RST to the server to cancel the stream. |
| 344 void CancelPush(const GURL& url); | 348 void CancelPush(const GURL& url); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 677 // there is none. | 681 // there is none. |
| 678 base::WeakPtr<SpdyStreamRequest> GetNextPendingStreamRequest(); | 682 base::WeakPtr<SpdyStreamRequest> GetNextPendingStreamRequest(); |
| 679 | 683 |
| 680 // Called when there is room to create more streams (e.g., a stream | 684 // Called when there is room to create more streams (e.g., a stream |
| 681 // was closed). Processes as many pending stream requests as | 685 // was closed). Processes as many pending stream requests as |
| 682 // possible. | 686 // possible. |
| 683 void ProcessPendingStreamRequests(); | 687 void ProcessPendingStreamRequests(); |
| 684 | 688 |
| 685 void TryCreatePushStream(SpdyStreamId stream_id, | 689 void TryCreatePushStream(SpdyStreamId stream_id, |
| 686 SpdyStreamId associated_stream_id, | 690 SpdyStreamId associated_stream_id, |
| 687 SpdyPriority priority, | |
| 688 SpdyHeaderBlock headers); | 691 SpdyHeaderBlock headers); |
| 689 | 692 |
| 690 // Close the stream pointed to by the given iterator. Note that that | 693 // Close the stream pointed to by the given iterator. Note that that |
| 691 // stream may hold the last reference to the session. | 694 // stream may hold the last reference to the session. |
| 692 void CloseActiveStreamIterator(ActiveStreamMap::iterator it, int status); | 695 void CloseActiveStreamIterator(ActiveStreamMap::iterator it, int status); |
| 693 | 696 |
| 694 // Close the stream pointed to by the given iterator. Note that that | 697 // Close the stream pointed to by the given iterator. Note that that |
| 695 // stream may hold the last reference to the session. | 698 // stream may hold the last reference to the session. |
| 696 void CloseCreatedStreamIterator(CreatedStreamSet::iterator it, int status); | 699 void CloseCreatedStreamIterator(CreatedStreamSet::iterator it, int status); |
| 697 | 700 |
| 698 // Calls EnqueueResetStreamFrame() and then | 701 // Calls EnqueueResetStreamFrame() and then |
| 699 // CloseActiveStreamIterator(). | 702 // CloseActiveStreamIterator(). |
| 700 void ResetStreamIterator(ActiveStreamMap::iterator it, | 703 void ResetStreamIterator(ActiveStreamMap::iterator it, |
| 701 SpdyRstStreamStatus status, | 704 SpdyRstStreamStatus status, |
| 702 const std::string& description); | 705 const std::string& description); |
| 703 | 706 |
| 704 // Send a RST_STREAM frame with the given parameters. There should | 707 // Send a RST_STREAM frame with the given parameters. There should |
| 705 // either be no active stream with the given ID, or that active | 708 // either be no active stream with the given ID, or that active |
| 706 // stream should be closed shortly after this function is called. | 709 // stream should be closed shortly after this function is called. |
| 707 // | |
| 708 // TODO(akalin): Rename this to EnqueueResetStreamFrame(). | |
|
Bence
2017/01/05 17:14:46
Lol. Thank you for removing this obviously stale
| |
| 709 void EnqueueResetStreamFrame(SpdyStreamId stream_id, | 710 void EnqueueResetStreamFrame(SpdyStreamId stream_id, |
| 710 RequestPriority priority, | 711 RequestPriority priority, |
| 711 SpdyRstStreamStatus status, | 712 SpdyRstStreamStatus status, |
| 712 const std::string& description); | 713 const std::string& description); |
| 713 | 714 |
| 715 // Send a PRIORITY frame with the given parameters. | |
| 716 void EnqueuePriorityFrame(SpdyStreamId stream_id, | |
| 717 SpdyStreamId dependency_id, | |
| 718 int weight, | |
| 719 bool exclusive); | |
| 720 | |
| 714 // Calls DoReadLoop. Use this function instead of DoReadLoop when | 721 // Calls DoReadLoop. Use this function instead of DoReadLoop when |
| 715 // posting a task to pump the read loop. | 722 // posting a task to pump the read loop. |
| 716 void PumpReadLoop(ReadState expected_read_state, int result); | 723 void PumpReadLoop(ReadState expected_read_state, int result); |
| 717 | 724 |
| 718 // Advance the ReadState state machine. |expected_read_state| is the | 725 // Advance the ReadState state machine. |expected_read_state| is the |
| 719 // expected starting read state. | 726 // expected starting read state. |
| 720 // | 727 // |
| 721 // This function must always be called via PumpReadLoop(). | 728 // This function must always be called via PumpReadLoop(). |
| 722 int DoReadLoop(ReadState expected_read_state, int result); | 729 int DoReadLoop(ReadState expected_read_state, int result); |
| 723 // The implementations of the states of the ReadState state machine. | 730 // The implementations of the states of the ReadState state machine. |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1206 // Used for posting asynchronous IO tasks. We use this even though | 1213 // Used for posting asynchronous IO tasks. We use this even though |
| 1207 // SpdySession is refcounted because we don't need to keep the SpdySession | 1214 // SpdySession is refcounted because we don't need to keep the SpdySession |
| 1208 // alive if the last reference is within a RunnableMethod. Just revoke the | 1215 // alive if the last reference is within a RunnableMethod. Just revoke the |
| 1209 // method. | 1216 // method. |
| 1210 base::WeakPtrFactory<SpdySession> weak_factory_; | 1217 base::WeakPtrFactory<SpdySession> weak_factory_; |
| 1211 }; | 1218 }; |
| 1212 | 1219 |
| 1213 } // namespace net | 1220 } // namespace net |
| 1214 | 1221 |
| 1215 #endif // NET_SPDY_SPDY_SESSION_H_ | 1222 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |