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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Override the base class to send QUIC_STREAM_NO_ERROR to the peer | 57 // Override the base class to send QUIC_STREAM_NO_ERROR to the peer |
58 // when the stream has not received all the data. | 58 // when the stream has not received all the data. |
59 void CloseWriteSide() override; | 59 void CloseWriteSide() override; |
60 void StopReading() override; | 60 void StopReading() override; |
61 | 61 |
62 // ReliableQuicStream implementation | 62 // ReliableQuicStream implementation |
63 void OnClose() override; | 63 void OnClose() override; |
64 | 64 |
65 // This is the same as priority() and is being deprecated | 65 // This is the same as priority() and is being deprecated |
66 // TODO(alyssar) remove after Priority refactor. | 66 // TODO(alyssar) remove after Priority refactor. |
67 QuicPriority Priority() const override; | 67 SpdyPriority Priority() const override; |
68 | 68 |
69 // Called by the session when decompressed headers data is received | 69 // Called by the session when decompressed headers data is received |
70 // for this stream. | 70 // for this stream. |
71 // May be called multiple times, with each call providing additional headers | 71 // May be called multiple times, with each call providing additional headers |
72 // data until OnStreamHeadersComplete is called. | 72 // data until OnStreamHeadersComplete is called. |
73 virtual void OnStreamHeaders(base::StringPiece headers_data); | 73 virtual void OnStreamHeaders(base::StringPiece headers_data); |
74 | 74 |
75 // Called by the session when headers with a priority have been received | 75 // Called by the session when headers with a priority have been received |
76 // for this stream. This method will only be called for server streams. | 76 // for this stream. This method will only be called for server streams. |
77 virtual void OnStreamHeadersPriority(QuicPriority priority); | 77 virtual void OnStreamHeadersPriority(SpdyPriority priority); |
78 | 78 |
79 // Called by the session when decompressed headers have been completely | 79 // Called by the session when decompressed headers have been completely |
80 // delilvered to this stream. If |fin| is true, then this stream | 80 // delilvered to this stream. If |fin| is true, then this stream |
81 // should be closed; no more data will be sent by the peer. | 81 // should be closed; no more data will be sent by the peer. |
82 virtual void OnStreamHeadersComplete(bool fin, size_t frame_len); | 82 virtual void OnStreamHeadersComplete(bool fin, size_t frame_len); |
83 | 83 |
84 // Override the base class to not discard response when receiving | 84 // Override the base class to not discard response when receiving |
85 // QUIC_STREAM_NO_ERROR on QUIC_VERSION_29 and later versions. | 85 // QUIC_STREAM_NO_ERROR on QUIC_VERSION_29 and later versions. |
86 void OnStreamReset(const QuicRstStreamFrame& frame) override; | 86 void OnStreamReset(const QuicRstStreamFrame& frame) override; |
87 | 87 |
(...skipping 18 matching lines...) Expand all Loading... |
106 bool HasBytesToRead() const; | 106 bool HasBytesToRead() const; |
107 | 107 |
108 void set_visitor(Visitor* visitor) { visitor_ = visitor; } | 108 void set_visitor(Visitor* visitor) { visitor_ = visitor; } |
109 | 109 |
110 bool headers_decompressed() const { return headers_decompressed_; } | 110 bool headers_decompressed() const { return headers_decompressed_; } |
111 | 111 |
112 const std::string& decompressed_headers() const { | 112 const std::string& decompressed_headers() const { |
113 return decompressed_headers_; | 113 return decompressed_headers_; |
114 } | 114 } |
115 | 115 |
116 QuicPriority priority() const { return priority_; } | 116 SpdyPriority priority() const { return priority_; } |
117 | 117 |
118 protected: | 118 protected: |
119 // Sets priority_ to priority. This should only be called before bytes are | 119 // Sets priority_ to priority. This should only be called before bytes are |
120 // written to the server. | 120 // written to the server. |
121 void set_priority(QuicPriority priority); | 121 void set_priority(SpdyPriority priority); |
122 | 122 |
123 bool FinishedReadingHeaders() const; | 123 bool FinishedReadingHeaders() const; |
124 | 124 |
125 private: | 125 private: |
126 friend class test::QuicSpdyStreamPeer; | 126 friend class test::QuicSpdyStreamPeer; |
127 friend class test::ReliableQuicStreamPeer; | 127 friend class test::ReliableQuicStreamPeer; |
128 friend class QuicStreamUtils; | 128 friend class QuicStreamUtils; |
129 | 129 |
130 QuicSpdySession* spdy_session_; | 130 QuicSpdySession* spdy_session_; |
131 | 131 |
132 Visitor* visitor_; | 132 Visitor* visitor_; |
133 // True if the headers have been completely decompressed. | 133 // True if the headers have been completely decompressed. |
134 bool headers_decompressed_; | 134 bool headers_decompressed_; |
135 // The priority of the stream, once parsed. | 135 // The priority of the stream, once parsed. |
136 QuicPriority priority_; | 136 SpdyPriority priority_; |
137 // Contains a copy of the decompressed headers until they are consumed | 137 // Contains a copy of the decompressed headers until they are consumed |
138 // via ProcessData or Readv. | 138 // via ProcessData or Readv. |
139 std::string decompressed_headers_; | 139 std::string decompressed_headers_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); | 141 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); |
142 }; | 142 }; |
143 | 143 |
144 } // namespace net | 144 } // namespace net |
145 | 145 |
146 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ | 146 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ |
OLD | NEW |