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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // might also not have initiated the stream yet, but indicated it | 319 // might also not have initiated the stream yet, but indicated it |
320 // will via X-Associated-Content. Returns OK if a stream was found | 320 // will via X-Associated-Content. Returns OK if a stream was found |
321 // and put into |spdy_stream|, or if one was not found but it is | 321 // and put into |spdy_stream|, or if one was not found but it is |
322 // okay to create a new stream (in which case |spdy_stream| is | 322 // okay to create a new stream (in which case |spdy_stream| is |
323 // reset). Returns an error (not ERR_IO_PENDING) otherwise, and | 323 // reset). Returns an error (not ERR_IO_PENDING) otherwise, and |
324 // resets |spdy_stream|. | 324 // resets |spdy_stream|. |
325 int GetPushStream(const GURL& url, | 325 int GetPushStream(const GURL& url, |
326 base::WeakPtr<SpdyStream>* spdy_stream, | 326 base::WeakPtr<SpdyStream>* spdy_stream, |
327 const NetLogWithSource& stream_net_log); | 327 const NetLogWithSource& stream_net_log); |
328 | 328 |
| 329 // Called when the pushed stream should be cancelled. If the pushed stream is |
| 330 // not claimed and active, sends RST to the server to cancel the stream. |
| 331 void CancelPush(const GURL& url); |
| 332 |
329 // Initialize the session with the given connection. |is_secure| | 333 // Initialize the session with the given connection. |is_secure| |
330 // must indicate whether |connection| uses an SSL socket or not; it | 334 // must indicate whether |connection| uses an SSL socket or not; it |
331 // is usually true, but it can be false for testing or when SPDY is | 335 // is usually true, but it can be false for testing or when SPDY is |
332 // configured to work with non-secure sockets. | 336 // configured to work with non-secure sockets. |
333 // | 337 // |
334 // |pool| is the SpdySessionPool that owns us. Its lifetime must | 338 // |pool| is the SpdySessionPool that owns us. Its lifetime must |
335 // strictly be greater than |this|. | 339 // strictly be greater than |this|. |
336 // | 340 // |
337 // The session begins reading from |connection| on a subsequent event loop | 341 // The session begins reading from |connection| on a subsequent event loop |
338 // iteration, so the SpdySession may close immediately afterwards if the first | 342 // iteration, so the SpdySession may close immediately afterwards if the first |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 // Called when there is room to create more streams (e.g., a stream | 674 // Called when there is room to create more streams (e.g., a stream |
671 // was closed). Processes as many pending stream requests as | 675 // was closed). Processes as many pending stream requests as |
672 // possible. | 676 // possible. |
673 void ProcessPendingStreamRequests(); | 677 void ProcessPendingStreamRequests(); |
674 | 678 |
675 bool TryCreatePushStream(SpdyStreamId stream_id, | 679 bool TryCreatePushStream(SpdyStreamId stream_id, |
676 SpdyStreamId associated_stream_id, | 680 SpdyStreamId associated_stream_id, |
677 SpdyPriority priority, | 681 SpdyPriority priority, |
678 SpdyHeaderBlock headers); | 682 SpdyHeaderBlock headers); |
679 | 683 |
680 // Called when the pushed stream should be cancelled. If the pushed stream is | |
681 // not claimed and active, sends RST to the server to cancel the stream. | |
682 void CancelPush(const GURL& url); | |
683 | |
684 // Close the stream pointed to by the given iterator. Note that that | 684 // Close the stream pointed to by the given iterator. Note that that |
685 // stream may hold the last reference to the session. | 685 // stream may hold the last reference to the session. |
686 void CloseActiveStreamIterator(ActiveStreamMap::iterator it, int status); | 686 void CloseActiveStreamIterator(ActiveStreamMap::iterator it, int status); |
687 | 687 |
688 // Close the stream pointed to by the given iterator. Note that that | 688 // Close the stream pointed to by the given iterator. Note that that |
689 // stream may hold the last reference to the session. | 689 // stream may hold the last reference to the session. |
690 void CloseCreatedStreamIterator(CreatedStreamSet::iterator it, int status); | 690 void CloseCreatedStreamIterator(CreatedStreamSet::iterator it, int status); |
691 | 691 |
692 // Calls EnqueueResetStreamFrame() and then | 692 // Calls EnqueueResetStreamFrame() and then |
693 // CloseActiveStreamIterator(). | 693 // CloseActiveStreamIterator(). |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 // Used for posting asynchronous IO tasks. We use this even though | 1213 // Used for posting asynchronous IO tasks. We use this even though |
1214 // 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 |
1215 // 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 |
1216 // method. | 1216 // method. |
1217 base::WeakPtrFactory<SpdySession> weak_factory_; | 1217 base::WeakPtrFactory<SpdySession> weak_factory_; |
1218 }; | 1218 }; |
1219 | 1219 |
1220 } // namespace net | 1220 } // namespace net |
1221 | 1221 |
1222 #endif // NET_SPDY_SPDY_SESSION_H_ | 1222 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |