Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: net/quic/quic_spdy_stream.h

Issue 1518483003: QuicSpdyStream supports receiving trailing headers frames. Flag protected by FLAGS_quic_support_tra… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clean
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_spdy_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 // Writes the headers contained in |header_block| to the dedicated 88 // Writes the headers contained in |header_block| to the dedicated
89 // headers stream. 89 // headers stream.
90 virtual size_t WriteHeaders(const SpdyHeaderBlock& header_block, 90 virtual size_t WriteHeaders(const SpdyHeaderBlock& header_block,
91 bool fin, 91 bool fin,
92 QuicAckListenerInterface* ack_notifier_delegate); 92 QuicAckListenerInterface* ack_notifier_delegate);
93 93
94 // Marks |bytes_consumed| of the headers data as consumed. 94 // Marks |bytes_consumed| of the headers data as consumed.
95 void MarkHeadersConsumed(size_t bytes_consumed); 95 void MarkHeadersConsumed(size_t bytes_consumed);
96 96
97 // Marks |bytes_consumed| of the trailers data as consumed.
98 void MarkTrailersConsumed(size_t bytes_consumed);
99
97 // This block of functions wraps the sequencer's functions of the same 100 // This block of functions wraps the sequencer's functions of the same
98 // name. These methods return uncompressed data until that has 101 // name. These methods return uncompressed data until that has
99 // been fully processed. Then they simply delegate to the sequencer. 102 // been fully processed. Then they simply delegate to the sequencer.
100 virtual size_t Readv(const struct iovec* iov, size_t iov_len); 103 virtual size_t Readv(const struct iovec* iov, size_t iov_len);
101 virtual int GetReadableRegions(iovec* iov, size_t iov_len) const; 104 virtual int GetReadableRegions(iovec* iov, size_t iov_len) const;
102 void MarkConsumed(size_t num_bytes); 105 void MarkConsumed(size_t num_bytes);
103 106
104 // Returns true when all data has been read from the peer, including the fin. 107 // Returns true when all data has been read from the peer, including the fin.
105 bool IsDoneReading() const; 108 bool IsDoneReading() const;
106 bool HasBytesToRead() const; 109 bool HasBytesToRead() const;
107 110
108 void set_visitor(Visitor* visitor) { visitor_ = visitor; } 111 void set_visitor(Visitor* visitor) { visitor_ = visitor; }
109 112
110 bool headers_decompressed() const { return headers_decompressed_; } 113 bool headers_decompressed() const { return headers_decompressed_; }
111 114
112 const std::string& decompressed_headers() const { 115 const std::string& decompressed_headers() const {
113 return decompressed_headers_; 116 return decompressed_headers_;
114 } 117 }
115 118
119 bool trailers_decompressed() const { return trailers_decompressed_; }
120
121 const std::string& decompressed_trailers() const {
122 return decompressed_trailers_;
123 }
124
116 SpdyPriority priority() const { return priority_; } 125 SpdyPriority priority() const { return priority_; }
117 126
118 protected: 127 protected:
128 // Called by OnStreamHeadersComplete depending on which type (initial or
129 // trailing) headers are expected next.
130 virtual void OnInitialHeadersComplete(bool fin, size_t frame_len);
131 virtual void OnTrailingHeadersComplete(bool fin, size_t frame_len);
132
119 // Sets priority_ to priority. This should only be called before bytes are 133 // Sets priority_ to priority. This should only be called before bytes are
120 // written to the server. 134 // written to the server.
121 void set_priority(SpdyPriority priority); 135 void set_priority(SpdyPriority priority);
122 136
137 // Returns true if headers have been fully read and consumed.
123 bool FinishedReadingHeaders() const; 138 bool FinishedReadingHeaders() const;
124 139
125 private: 140 private:
126 friend class test::QuicSpdyStreamPeer; 141 friend class test::QuicSpdyStreamPeer;
127 friend class test::ReliableQuicStreamPeer; 142 friend class test::ReliableQuicStreamPeer;
128 friend class QuicStreamUtils; 143 friend class QuicStreamUtils;
129 144
145 // Returns true if trailers have been fully read and consumed.
146 bool FinishedReadingTrailers() const;
147
130 QuicSpdySession* spdy_session_; 148 QuicSpdySession* spdy_session_;
131 149
132 Visitor* visitor_; 150 Visitor* visitor_;
133 // True if the headers have been completely decompressed. 151 // True if the headers have been completely decompressed.
134 bool headers_decompressed_; 152 bool headers_decompressed_;
135 // The priority of the stream, once parsed. 153 // The priority of the stream, once parsed.
136 SpdyPriority priority_; 154 SpdyPriority priority_;
137 // Contains a copy of the decompressed headers until they are consumed 155 // Contains a copy of the decompressed headers until they are consumed
138 // via ProcessData or Readv. 156 // via ProcessData or Readv.
139 std::string decompressed_headers_; 157 std::string decompressed_headers_;
140 158
159 // True if the trailers have been completely decompressed.
160 bool trailers_decompressed_;
161 // Contains a copy of the decompressed trailers until they are consumed
162 // via ProcessData or Readv.
163 std::string decompressed_trailers_;
164
141 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream); 165 DISALLOW_COPY_AND_ASSIGN(QuicSpdyStream);
142 }; 166 };
143 167
144 } // namespace net 168 } // namespace net
145 169
146 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_ 170 #endif // NET_QUIC_QUIC_SPDY_STREAM_H_
OLDNEW
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_spdy_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698