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_STREAM_H_ | 5 #ifndef NET_SPDY_SPDY_STREAM_H_ |
6 #define NET_SPDY_SPDY_STREAM_H_ | 6 #define NET_SPDY_SPDY_STREAM_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 // more data to send. | 50 // more data to send. |
51 enum SpdySendStatus { | 51 enum SpdySendStatus { |
52 MORE_DATA_TO_SEND, | 52 MORE_DATA_TO_SEND, |
53 NO_MORE_DATA_TO_SEND | 53 NO_MORE_DATA_TO_SEND |
54 }; | 54 }; |
55 | 55 |
56 // Returned by SpdyStream::OnResponseHeadersUpdated() to indicate | 56 // Returned by SpdyStream::OnResponseHeadersUpdated() to indicate |
57 // whether the current response headers are complete or not. | 57 // whether the current response headers are complete or not. |
58 enum SpdyResponseHeadersStatus { | 58 enum SpdyResponseHeadersStatus { |
59 RESPONSE_HEADERS_ARE_INCOMPLETE, | 59 RESPONSE_HEADERS_ARE_INCOMPLETE, |
60 RESPONSE_HEADERS_ARE_COMPLETE | 60 RESPONSE_HEADERS_ARE_COMPLETE, |
61 TRAILERS_RECEIVED, | |
61 }; | 62 }; |
62 | 63 |
63 // The SpdyStream is used by the SpdySession to represent each stream known | 64 // The SpdyStream is used by the SpdySession to represent each stream known |
64 // on the SpdySession. This class provides interfaces for SpdySession to use. | 65 // on the SpdySession. This class provides interfaces for SpdySession to use. |
65 // Streams can be created either by the client or by the server. When they | 66 // Streams can be created either by the client or by the server. When they |
66 // are initiated by the client, both the SpdySession and client object (such as | 67 // are initiated by the client, both the SpdySession and client object (such as |
67 // a SpdyNetworkTransaction) will maintain a reference to the stream. When | 68 // a SpdyNetworkTransaction) will maintain a reference to the stream. When |
68 // initiated by the server, only the SpdySession will maintain any reference, | 69 // initiated by the server, only the SpdySession will maintain any reference, |
69 // until such a time as a client object requests a stream for the path. | 70 // until such a time as a client object requests a stream for the path. |
70 class NET_EXPORT_PRIVATE SpdyStream { | 71 class NET_EXPORT_PRIVATE SpdyStream { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 | 142 |
142 // Called when SpdyStream is closed. No other delegate functions | 143 // Called when SpdyStream is closed. No other delegate functions |
143 // will be called after this is called, and the delegate must not | 144 // will be called after this is called, and the delegate must not |
144 // access the stream after this is called. Must not cause the | 145 // access the stream after this is called. Must not cause the |
145 // stream to be be (re-)closed. | 146 // stream to be be (re-)closed. |
146 // | 147 // |
147 // TODO(akalin): Allow this function to re-close the stream and | 148 // TODO(akalin): Allow this function to re-close the stream and |
148 // handle it gracefully. | 149 // handle it gracefully. |
149 virtual void OnClose(int status) = 0; | 150 virtual void OnClose(int status) = 0; |
150 | 151 |
152 // Called when trailers are received. Note that trailers HEADER frame will | |
153 // have END_STREAM flag set, so this will be follwed by OnDataReceived with | |
Bence
2015/08/06 18:26:25
Nit: s/follwed/followed/.
xunjieli
2015/08/06 21:02:00
Done.
| |
154 // an empty buffer. | |
155 virtual void OnTrailers(const SpdyHeaderBlock& trailers); | |
156 | |
151 protected: | 157 protected: |
152 virtual ~Delegate() {} | 158 virtual ~Delegate() {} |
153 | 159 |
154 private: | 160 private: |
155 DISALLOW_COPY_AND_ASSIGN(Delegate); | 161 DISALLOW_COPY_AND_ASSIGN(Delegate); |
156 }; | 162 }; |
157 | 163 |
158 // SpdyStream constructor | 164 // SpdyStream constructor |
159 SpdyStream(SpdyStreamType type, | 165 SpdyStream(SpdyStreamType type, |
160 const base::WeakPtr<SpdySession>& session, | 166 const base::WeakPtr<SpdySession>& session, |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 bool write_handler_guard_; | 580 bool write_handler_guard_; |
575 | 581 |
576 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; | 582 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; |
577 | 583 |
578 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 584 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
579 }; | 585 }; |
580 | 586 |
581 } // namespace net | 587 } // namespace net |
582 | 588 |
583 #endif // NET_SPDY_SPDY_STREAM_H_ | 589 #endif // NET_SPDY_SPDY_STREAM_H_ |
OLD | NEW |