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