OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // The base class for streams which deliver data to/from an application. | 5 // The base class for streams which deliver data to/from an application. |
6 // In each direction, the data on such a stream first contains compressed | 6 // In each direction, the data on such a stream first contains compressed |
7 // headers then body data. | 7 // headers then body data. |
8 | 8 |
9 #ifndef NET_QUIC_QUIC_SPDY_STREAM_H_ | 9 #ifndef NET_QUIC_QUIC_SPDY_STREAM_H_ |
10 #define NET_QUIC_QUIC_SPDY_STREAM_H_ | 10 #define NET_QUIC_QUIC_SPDY_STREAM_H_ |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 const std::string& decompressed_trailers() const { | 180 const std::string& decompressed_trailers() const { |
181 return decompressed_trailers_; | 181 return decompressed_trailers_; |
182 } | 182 } |
183 | 183 |
184 // Returns whatever trailers have been received for this stream. | 184 // Returns whatever trailers have been received for this stream. |
185 const SpdyHeaderBlock& received_trailers() const { | 185 const SpdyHeaderBlock& received_trailers() const { |
186 return received_trailers_; | 186 return received_trailers_; |
187 } | 187 } |
188 | 188 |
| 189 // Returns true if headers have been fully read and consumed. |
| 190 bool FinishedReadingHeaders() const; |
| 191 |
189 virtual SpdyPriority priority() const; | 192 virtual SpdyPriority priority() const; |
190 | 193 |
191 // Sets priority_ to priority. This should only be called before bytes are | 194 // Sets priority_ to priority. This should only be called before bytes are |
192 // written to the server. | 195 // written to the server. |
193 void SetPriority(SpdyPriority priority); | 196 void SetPriority(SpdyPriority priority); |
194 | 197 |
195 // Called when owning session is getting deleted to avoid subsequent | 198 // Called when owning session is getting deleted to avoid subsequent |
196 // use of the spdy_session_ member. | 199 // use of the spdy_session_ member. |
197 void ClearSession(); | 200 void ClearSession(); |
198 | 201 |
199 // Returns true if the sequencer has delivered the FIN, and no more body bytes | 202 // Returns true if the sequencer has delivered the FIN, and no more body bytes |
200 // will be available. | 203 // will be available. |
201 bool IsClosed() { return sequencer()->IsClosed(); } | 204 bool IsClosed() { return sequencer()->IsClosed(); } |
202 | 205 |
203 protected: | 206 protected: |
204 // Called by OnStreamHeadersComplete depending on which type (initial or | 207 // Called by OnStreamHeadersComplete depending on which type (initial or |
205 // trailing) headers are expected next. | 208 // trailing) headers are expected next. |
206 virtual void OnInitialHeadersComplete(bool fin, size_t frame_len); | 209 virtual void OnInitialHeadersComplete(bool fin, size_t frame_len); |
207 virtual void OnTrailingHeadersComplete(bool fin, size_t frame_len); | 210 virtual void OnTrailingHeadersComplete(bool fin, size_t frame_len); |
208 virtual void OnInitialHeadersComplete(bool fin, | 211 virtual void OnInitialHeadersComplete(bool fin, |
209 size_t frame_len, | 212 size_t frame_len, |
210 const QuicHeaderList& header_list); | 213 const QuicHeaderList& header_list); |
211 virtual void OnTrailingHeadersComplete(bool fin, | 214 virtual void OnTrailingHeadersComplete(bool fin, |
212 size_t frame_len, | 215 size_t frame_len, |
213 const QuicHeaderList& header_list); | 216 const QuicHeaderList& header_list); |
214 QuicSpdySession* spdy_session() const { return spdy_session_; } | 217 QuicSpdySession* spdy_session() const { return spdy_session_; } |
215 Visitor* visitor() { return visitor_; } | 218 Visitor* visitor() { return visitor_; } |
216 | 219 |
217 // Returns true if headers have been fully read and consumed. | |
218 bool FinishedReadingHeaders() const; | |
219 | |
220 // Redirects to the headers stream if force HOL blocking enabled, | 220 // Redirects to the headers stream if force HOL blocking enabled, |
221 // otherwise just pass through. | 221 // otherwise just pass through. |
222 QuicConsumedData WritevDataInner( | 222 QuicConsumedData WritevDataInner( |
223 QuicIOVector iov, | 223 QuicIOVector iov, |
224 QuicStreamOffset offset, | 224 QuicStreamOffset offset, |
225 bool fin, | 225 bool fin, |
226 QuicAckListenerInterface* ack_notifier_delegate) override; | 226 QuicAckListenerInterface* ack_notifier_delegate) override; |
227 | 227 |
228 private: | 228 private: |
229 friend class test::QuicSpdyStreamPeer; | 229 friend class test::QuicSpdyStreamPeer; |
(...skipping 26 matching lines...) Expand all Loading... |
256 std::string decompressed_trailers_; | 256 std::string decompressed_trailers_; |
257 // The parsed trailers received from the peer. | 257 // The parsed trailers received from the peer. |
258 SpdyHeaderBlock received_trailers_; | 258 SpdyHeaderBlock received_trailers_; |
259 | 259 |
260 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); | 260 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); |
261 }; | 261 }; |
262 | 262 |
263 } // namespace net | 263 } // namespace net |
264 | 264 |
265 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ | 265 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ |
OLD | NEW |