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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 ~QuicSpdyStream() override; | 55 ~QuicSpdyStream() override; |
56 | 56 |
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 // By default, this is the same as priority(), however it allows streams | 65 // This is the same as priority() and is being deprecated |
66 // to temporarily alter effective priority. For example if a SPDY stream has | 66 // TODO(alyssar) remove after Priority refactor. |
67 // compressed but not written headers it can write the headers with a higher | 67 QuicPriority Priority() const override; |
68 // priority. | |
69 QuicPriority EffectivePriority() const override; | |
70 | 68 |
71 // Called by the session when decompressed headers data is received | 69 // Called by the session when decompressed headers data is received |
72 // for this stream. | 70 // for this stream. |
73 // May be called multiple times, with each call providing additional headers | 71 // May be called multiple times, with each call providing additional headers |
74 // data until OnStreamHeadersComplete is called. | 72 // data until OnStreamHeadersComplete is called. |
75 virtual void OnStreamHeaders(base::StringPiece headers_data); | 73 virtual void OnStreamHeaders(base::StringPiece headers_data); |
76 | 74 |
77 // 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 |
78 // 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. |
79 virtual void OnStreamHeadersPriority(QuicPriority priority); | 77 virtual void OnStreamHeadersPriority(QuicPriority priority); |
(...skipping 28 matching lines...) Expand all Loading... |
108 bool HasBytesToRead() const; | 106 bool HasBytesToRead() const; |
109 | 107 |
110 void set_visitor(Visitor* visitor) { visitor_ = visitor; } | 108 void set_visitor(Visitor* visitor) { visitor_ = visitor; } |
111 | 109 |
112 bool headers_decompressed() const { return headers_decompressed_; } | 110 bool headers_decompressed() const { return headers_decompressed_; } |
113 | 111 |
114 const std::string& decompressed_headers() const { | 112 const std::string& decompressed_headers() const { |
115 return decompressed_headers_; | 113 return decompressed_headers_; |
116 } | 114 } |
117 | 115 |
| 116 QuicPriority priority() const { return priority_; } |
| 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(QuicPriority priority); |
122 // This is protected because external classes should use EffectivePriority | |
123 // instead. | |
124 QuicPriority priority() const { return priority_; } | |
125 | 122 |
126 bool FinishedReadingHeaders() const; | 123 bool FinishedReadingHeaders() const; |
127 | 124 |
128 private: | 125 private: |
129 friend class test::QuicSpdyStreamPeer; | 126 friend class test::QuicSpdyStreamPeer; |
130 friend class test::ReliableQuicStreamPeer; | 127 friend class test::ReliableQuicStreamPeer; |
131 friend class QuicStreamUtils; | 128 friend class QuicStreamUtils; |
132 | 129 |
133 QuicSpdySession* spdy_session_; | 130 QuicSpdySession* spdy_session_; |
134 | 131 |
135 Visitor* visitor_; | 132 Visitor* visitor_; |
136 // True if the headers have been completely decompressed. | 133 // True if the headers have been completely decompressed. |
137 bool headers_decompressed_; | 134 bool headers_decompressed_; |
138 // The priority of the stream, once parsed. | 135 // The priority of the stream, once parsed. |
139 QuicPriority priority_; | 136 QuicPriority priority_; |
140 // Contains a copy of the decompressed headers until they are consumed | 137 // Contains a copy of the decompressed headers until they are consumed |
141 // via ProcessData or Readv. | 138 // via ProcessData or Readv. |
142 std::string decompressed_headers_; | 139 std::string decompressed_headers_; |
143 | 140 |
144 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); | 141 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); |
145 }; | 142 }; |
146 | 143 |
147 } // namespace net | 144 } // namespace net |
148 | 145 |
149 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ | 146 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ |
OLD | NEW |