| 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_DATA_STREAM_H_ | 9 #ifndef NET_QUIC_QUIC_DATA_STREAM_H_ |
| 10 #define NET_QUIC_QUIC_DATA_STREAM_H_ | 10 #define NET_QUIC_QUIC_DATA_STREAM_H_ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "net/quic/reliable_quic_stream.h" | 25 #include "net/quic/reliable_quic_stream.h" |
| 26 #include "net/spdy/spdy_framer.h" | 26 #include "net/spdy/spdy_framer.h" |
| 27 | 27 |
| 28 namespace net { | 28 namespace net { |
| 29 | 29 |
| 30 namespace test { | 30 namespace test { |
| 31 class QuicDataStreamPeer; | 31 class QuicDataStreamPeer; |
| 32 class ReliableQuicStreamPeer; | 32 class ReliableQuicStreamPeer; |
| 33 } // namespace test | 33 } // namespace test |
| 34 | 34 |
| 35 class QuicSession; | 35 class QuicSpdySession; |
| 36 | 36 |
| 37 // All this does right now is send data to subclasses via the sequencer. | 37 // A QUIC data stream that can also send and receive headers. |
| 38 class NET_EXPORT_PRIVATE QuicDataStream : public ReliableQuicStream { | 38 class NET_EXPORT_PRIVATE QuicDataStream : public ReliableQuicStream { |
| 39 public: | 39 public: |
| 40 // Visitor receives callbacks from the stream. | 40 // Visitor receives callbacks from the stream. |
| 41 class NET_EXPORT_PRIVATE Visitor { | 41 class NET_EXPORT_PRIVATE Visitor { |
| 42 public: | 42 public: |
| 43 Visitor() {} | 43 Visitor() {} |
| 44 | 44 |
| 45 // Called when the stream is closed. | 45 // Called when the stream is closed. |
| 46 virtual void OnClose(QuicDataStream* stream) = 0; | 46 virtual void OnClose(QuicDataStream* stream) = 0; |
| 47 | 47 |
| 48 protected: | 48 protected: |
| 49 virtual ~Visitor() {} | 49 virtual ~Visitor() {} |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(Visitor); | 52 DISALLOW_COPY_AND_ASSIGN(Visitor); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 QuicDataStream(QuicStreamId id, QuicSession* session); | 55 QuicDataStream(QuicStreamId id, QuicSpdySession* spdy_session); |
| 56 | |
| 57 ~QuicDataStream() override; | 56 ~QuicDataStream() override; |
| 58 | 57 |
| 59 // ReliableQuicStream implementation | 58 // ReliableQuicStream implementation |
| 60 void OnClose() override; | 59 void OnClose() override; |
| 61 uint32 ProcessRawData(const char* data, uint32 data_len) override; | 60 uint32 ProcessRawData(const char* data, uint32 data_len) override; |
| 62 | 61 |
| 63 // By default, this is the same as priority(), however it allows streams | 62 // By default, this is the same as priority(), however it allows streams |
| 64 // to temporarily alter effective priority. For example if a SPDY stream has | 63 // to temporarily alter effective priority. For example if a SPDY stream has |
| 65 // compressed but not written headers it can write the headers with a higher | 64 // compressed but not written headers it can write the headers with a higher |
| 66 // priority. | 65 // priority. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 114 |
| 116 private: | 115 private: |
| 117 friend class test::QuicDataStreamPeer; | 116 friend class test::QuicDataStreamPeer; |
| 118 friend class test::ReliableQuicStreamPeer; | 117 friend class test::ReliableQuicStreamPeer; |
| 119 friend class QuicStreamUtils; | 118 friend class QuicStreamUtils; |
| 120 | 119 |
| 121 uint32 ProcessHeaderData(); | 120 uint32 ProcessHeaderData(); |
| 122 | 121 |
| 123 bool FinishedReadingHeaders(); | 122 bool FinishedReadingHeaders(); |
| 124 | 123 |
| 124 QuicSpdySession* spdy_session_; |
| 125 |
| 125 Visitor* visitor_; | 126 Visitor* visitor_; |
| 126 // True if the headers have been completely decompresssed. | 127 // True if the headers have been completely decompressed. |
| 127 bool headers_decompressed_; | 128 bool headers_decompressed_; |
| 128 // The priority of the stream, once parsed. | 129 // The priority of the stream, once parsed. |
| 129 QuicPriority priority_; | 130 QuicPriority priority_; |
| 130 // Contains a copy of the decompressed headers until they are consumed | 131 // Contains a copy of the decompressed headers until they are consumed |
| 131 // via ProcessData or Readv. | 132 // via ProcessData or Readv. |
| 132 std::string decompressed_headers_; | 133 std::string decompressed_headers_; |
| 133 | 134 |
| 134 DISALLOW_COPY_AND_ASSIGN(QuicDataStream); | 135 DISALLOW_COPY_AND_ASSIGN(QuicDataStream); |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 } // namespace net | 138 } // namespace net |
| 138 | 139 |
| 139 #endif // NET_QUIC_QUIC_DATA_STREAM_H_ | 140 #endif // NET_QUIC_QUIC_DATA_STREAM_H_ |
| OLD | NEW |