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