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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 const std::string& decompressed_trailers() const { | 140 const std::string& decompressed_trailers() const { |
141 return decompressed_trailers_; | 141 return decompressed_trailers_; |
142 } | 142 } |
143 | 143 |
144 virtual SpdyPriority priority() const; | 144 virtual SpdyPriority priority() const; |
145 | 145 |
146 // Sets priority_ to priority. This should only be called before bytes are | 146 // Sets priority_ to priority. This should only be called before bytes are |
147 // written to the server. | 147 // written to the server. |
148 void SetPriority(SpdyPriority priority); | 148 void SetPriority(SpdyPriority priority); |
149 | 149 |
| 150 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. |
| 151 void CrashIfInvalid() const; |
| 152 void set_read_in_progress(bool value) { read_in_progress_ = value; } |
| 153 |
150 protected: | 154 protected: |
151 // Called by OnStreamHeadersComplete depending on which type (initial or | 155 // Called by OnStreamHeadersComplete depending on which type (initial or |
152 // trailing) headers are expected next. | 156 // trailing) headers are expected next. |
153 virtual void OnInitialHeadersComplete(bool fin, size_t frame_len); | 157 virtual void OnInitialHeadersComplete(bool fin, size_t frame_len); |
154 virtual void OnTrailingHeadersComplete(bool fin, size_t frame_len); | 158 virtual void OnTrailingHeadersComplete(bool fin, size_t frame_len); |
155 QuicSpdySession* spdy_session() const { return spdy_session_; } | 159 QuicSpdySession* spdy_session() const { return spdy_session_; } |
156 Visitor* visitor() { return visitor_; } | 160 Visitor* visitor() { return visitor_; } |
157 | 161 |
158 // Returns true if headers have been fully read and consumed. | 162 // Returns true if headers have been fully read and consumed. |
159 bool FinishedReadingHeaders() const; | 163 bool FinishedReadingHeaders() const; |
160 | 164 |
161 private: | 165 private: |
162 friend class test::QuicSpdyStreamPeer; | 166 friend class test::QuicSpdyStreamPeer; |
163 friend class test::ReliableQuicStreamPeer; | 167 friend class test::ReliableQuicStreamPeer; |
164 friend class QuicStreamUtils; | 168 friend class QuicStreamUtils; |
165 | 169 |
| 170 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. |
| 171 enum Liveness { |
| 172 ALIVE = 0xCA11AB13, |
| 173 DEAD = 0xDEADBEEF, |
| 174 }; |
| 175 |
166 // Returns true if trailers have been fully read and consumed. | 176 // Returns true if trailers have been fully read and consumed. |
167 bool FinishedReadingTrailers() const; | 177 bool FinishedReadingTrailers() const; |
168 | 178 |
169 QuicSpdySession* spdy_session_; | 179 QuicSpdySession* spdy_session_; |
170 | 180 |
171 Visitor* visitor_; | 181 Visitor* visitor_; |
172 // True if the headers have been completely decompressed. | 182 // True if the headers have been completely decompressed. |
173 bool headers_decompressed_; | 183 bool headers_decompressed_; |
174 // The priority of the stream, once parsed. | 184 // The priority of the stream, once parsed. |
175 SpdyPriority priority_; | 185 SpdyPriority priority_; |
176 // Contains a copy of the decompressed headers until they are consumed | 186 // Contains a copy of the decompressed headers until they are consumed |
177 // via ProcessData or Readv. | 187 // via ProcessData or Readv. |
178 std::string decompressed_headers_; | 188 std::string decompressed_headers_; |
179 | 189 |
180 // True if the trailers have been completely decompressed. | 190 // True if the trailers have been completely decompressed. |
181 bool trailers_decompressed_; | 191 bool trailers_decompressed_; |
182 // Contains a copy of the decompressed trailers until they are consumed | 192 // Contains a copy of the decompressed trailers until they are consumed |
183 // via ProcessData or Readv. | 193 // via ProcessData or Readv. |
184 std::string decompressed_trailers_; | 194 std::string decompressed_trailers_; |
185 | 195 |
| 196 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. |
| 197 Liveness liveness_ = ALIVE; |
| 198 bool read_in_progress_ = false; |
| 199 |
186 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); | 200 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); |
187 }; | 201 }; |
188 | 202 |
189 } // namespace net | 203 } // namespace net |
190 | 204 |
191 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ | 205 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ |
OLD | NEW |