| 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_ |
| 11 | 11 |
| 12 #include <stddef.h> | 12 #include <stddef.h> |
| 13 #include <sys/types.h> | 13 #include <sys/types.h> |
| 14 | 14 |
| 15 #include <list> | 15 #include <list> |
| 16 #include <string> | 16 #include <string> |
| 17 | 17 |
| 18 // TODO(rtenneti): Temporary while investigating crbug.com/585591. |
| 19 // Note base::Debug::StackTrace() is not supported in NACL |
| 20 // builds so conditionally disabled it there. |
| 21 #include "build/build_config.h" |
| 22 #ifndef OS_NACL |
| 23 #define TEMP_INSTRUMENTATION_585591 |
| 24 #include "base/debug/stack_trace.h" |
| 25 #endif |
| 26 |
| 18 #include "base/macros.h" | 27 #include "base/macros.h" |
| 19 #include "base/strings/string_piece.h" | 28 #include "base/strings/string_piece.h" |
| 20 #include "net/base/iovec.h" | 29 #include "net/base/iovec.h" |
| 21 #include "net/base/ip_endpoint.h" | 30 #include "net/base/ip_endpoint.h" |
| 22 #include "net/base/net_export.h" | 31 #include "net/base/net_export.h" |
| 23 #include "net/quic/quic_protocol.h" | 32 #include "net/quic/quic_protocol.h" |
| 24 #include "net/quic/quic_stream_sequencer.h" | 33 #include "net/quic/quic_stream_sequencer.h" |
| 25 #include "net/quic/reliable_quic_stream.h" | 34 #include "net/quic/reliable_quic_stream.h" |
| 26 #include "net/spdy/spdy_framer.h" | 35 #include "net/spdy/spdy_framer.h" |
| 27 | 36 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 const std::string& decompressed_trailers() const { | 153 const std::string& decompressed_trailers() const { |
| 145 return decompressed_trailers_; | 154 return decompressed_trailers_; |
| 146 } | 155 } |
| 147 | 156 |
| 148 SpdyPriority priority() const { return priority_; } | 157 SpdyPriority priority() const { return priority_; } |
| 149 | 158 |
| 150 // Sets priority_ to priority. This should only be called before bytes are | 159 // Sets priority_ to priority. This should only be called before bytes are |
| 151 // written to the server. | 160 // written to the server. |
| 152 void SetPriority(SpdyPriority priority); | 161 void SetPriority(SpdyPriority priority); |
| 153 | 162 |
| 163 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. |
| 164 void CrashIfInvalid() const; |
| 165 void set_read_is_called(bool value) { read_is_called_ = value; } |
| 166 |
| 154 protected: | 167 protected: |
| 155 // Called by OnStreamHeadersComplete depending on which type (initial or | 168 // Called by OnStreamHeadersComplete depending on which type (initial or |
| 156 // trailing) headers are expected next. | 169 // trailing) headers are expected next. |
| 157 virtual void OnInitialHeadersComplete(bool fin, size_t frame_len); | 170 virtual void OnInitialHeadersComplete(bool fin, size_t frame_len); |
| 158 virtual void OnTrailingHeadersComplete(bool fin, size_t frame_len); | 171 virtual void OnTrailingHeadersComplete(bool fin, size_t frame_len); |
| 159 QuicSpdySession* spdy_session() const { return spdy_session_; } | 172 QuicSpdySession* spdy_session() const { return spdy_session_; } |
| 160 Visitor* visitor() { return visitor_; } | 173 Visitor* visitor() { return visitor_; } |
| 161 | 174 |
| 162 // Returns true if headers have been fully read and consumed. | 175 // Returns true if headers have been fully read and consumed. |
| 163 bool FinishedReadingHeaders() const; | 176 bool FinishedReadingHeaders() const; |
| 164 | 177 |
| 165 private: | 178 private: |
| 166 friend class test::QuicSpdyStreamPeer; | 179 friend class test::QuicSpdyStreamPeer; |
| 167 friend class test::ReliableQuicStreamPeer; | 180 friend class test::ReliableQuicStreamPeer; |
| 168 friend class QuicStreamUtils; | 181 friend class QuicStreamUtils; |
| 169 | 182 |
| 183 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. |
| 184 enum Liveness { |
| 185 ALIVE = 0xCA11AB13, |
| 186 DEAD = 0xDEADBEEF, |
| 187 }; |
| 188 |
| 170 // Returns true if trailers have been fully read and consumed. | 189 // Returns true if trailers have been fully read and consumed. |
| 171 bool FinishedReadingTrailers() const; | 190 bool FinishedReadingTrailers() const; |
| 172 | 191 |
| 173 QuicSpdySession* spdy_session_; | 192 QuicSpdySession* spdy_session_; |
| 174 | 193 |
| 175 Visitor* visitor_; | 194 Visitor* visitor_; |
| 176 // True if the headers have been completely decompressed. | 195 // True if the headers have been completely decompressed. |
| 177 bool headers_decompressed_; | 196 bool headers_decompressed_; |
| 178 // The priority of the stream, once parsed. | 197 // The priority of the stream, once parsed. |
| 179 SpdyPriority priority_; | 198 SpdyPriority priority_; |
| 180 // Contains a copy of the decompressed headers until they are consumed | 199 // Contains a copy of the decompressed headers until they are consumed |
| 181 // via ProcessData or Readv. | 200 // via ProcessData or Readv. |
| 182 std::string decompressed_headers_; | 201 std::string decompressed_headers_; |
| 183 | 202 |
| 184 // True if the trailers have been completely decompressed. | 203 // True if the trailers have been completely decompressed. |
| 185 bool trailers_decompressed_; | 204 bool trailers_decompressed_; |
| 186 // Contains a copy of the decompressed trailers until they are consumed | 205 // Contains a copy of the decompressed trailers until they are consumed |
| 187 // via ProcessData or Readv. | 206 // via ProcessData or Readv. |
| 188 std::string decompressed_trailers_; | 207 std::string decompressed_trailers_; |
| 189 | 208 |
| 209 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. |
| 210 Liveness liveness_ = ALIVE; |
| 211 bool read_is_called_ = false; |
| 212 |
| 213 // TODO(rtenneti): Temporary while investigating crbug.com/585591. |
| 214 #ifdef TEMP_INSTRUMENTATION_585591 |
| 215 base::debug::StackTrace stack_trace_; |
| 216 #endif |
| 217 |
| 190 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); | 218 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); |
| 191 }; | 219 }; |
| 192 | 220 |
| 193 } // namespace net | 221 } // namespace net |
| 194 | 222 |
| 195 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ | 223 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ |
| OLD | NEW |