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

Unified Diff: net/quic/core/quic_headers_stream.cc

Issue 2430973004: Landing Recent QUIC changes until 10:38 AM, Oct 17, 2016 UTC-4 (Closed)
Patch Set: Improving flagsaver logging Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_headers_stream.h ('k') | net/quic/core/quic_headers_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_headers_stream.cc
diff --git a/net/quic/core/quic_headers_stream.cc b/net/quic/core/quic_headers_stream.cc
index a31a3261686b8c8eaa2010d4327b8b075b53eb2c..c0943290ec00d8fc0e0cbf283897972a13f974ba 100644
--- a/net/quic/core/quic_headers_stream.cc
+++ b/net/quic/core/quic_headers_stream.cc
@@ -314,6 +314,12 @@ class QuicHeadersStream::SpdyFramerVisitor
}
}
+ void set_max_uncompressed_header_bytes(
+ size_t set_max_uncompressed_header_bytes) {
+ header_list_.set_max_uncompressed_header_bytes(
+ set_max_uncompressed_header_bytes);
+ }
+
private:
void CloseConnection(const string& details) {
if (stream_->IsConnected()) {
@@ -387,25 +393,6 @@ size_t QuicHeadersStream::WritePushPromise(QuicStreamId original_stream_id,
return frame.size();
}
-void QuicHeadersStream::WriteDataFrame(
- QuicStreamId id,
- StringPiece data,
- bool fin,
- QuicAckListenerInterface* ack_notifier_delegate) {
- SpdyDataIR spdy_data(id, data);
- spdy_data.set_fin(fin);
- SpdySerializedFrame frame(spdy_framer_.SerializeFrame(spdy_data));
- scoped_refptr<ForceHolAckListener> ack_listener;
- if (ack_notifier_delegate != nullptr) {
- ack_listener = new ForceHolAckListener(ack_notifier_delegate,
- frame.size() - data.length());
- }
- // Use buffered writes so that coherence of framing is preserved
- // between streams.
- WriteOrBufferData(StringPiece(frame.data(), frame.size()), false,
- ack_listener.get());
-}
-
QuicConsumedData QuicHeadersStream::WritevStreamData(
QuicStreamId id,
QuicIOVector iov,
@@ -418,92 +405,48 @@ QuicConsumedData QuicHeadersStream::WritevStreamData(
QuicConsumedData result(0, false);
size_t total_length = iov.total_length;
- if (!FLAGS_quic_bugfix_fhol_writev_fin_only_v2) {
- // Encapsulate the data into HTTP/2 DATA frames. The outer loop
- // handles each element of the source iov, the inner loop handles
- // the possibility of fragmenting eacho of those into multiple DATA
- // frames, as the DATA frames have a max size of 16KB.
- for (int i = 0; i < iov.iov_count; i++) {
- size_t offset = 0;
- const struct iovec* src_iov = &iov.iov[i];
- do {
- size_t len = std::min(std::min(src_iov->iov_len - offset, max_len),
- total_length);
- char* data = static_cast<char*>(src_iov->iov_base) + offset;
- SpdyDataIR spdy_data(id, StringPiece(data, len));
- offset += len;
- // fin handling, only set it for the final HTTP/2 DATA frame.
- bool last_iov = i == iov.iov_count - 1;
- bool last_fragment_within_iov = offset >= src_iov->iov_len;
- bool frame_fin = (last_iov && last_fragment_within_iov) ? fin : false;
- spdy_data.set_fin(frame_fin);
- if (frame_fin) {
- result.fin_consumed = true;
- }
- SpdySerializedFrame frame(spdy_framer_.SerializeFrame(spdy_data));
- DVLOG(1) << "Encapsulating in DATA frame for stream " << id << " len "
- << len << " fin " << spdy_data.fin() << " remaining "
- << src_iov->iov_len - offset;
-
- scoped_refptr<ForceHolAckListener> ack_listener;
- if (ack_notifier_delegate != nullptr) {
- ack_listener = new ForceHolAckListener(ack_notifier_delegate,
- frame.size() - len);
- }
-
- WriteOrBufferData(StringPiece(frame.data(), frame.size()), false,
- ack_listener.get());
- result.bytes_consumed += len;
- total_length -= len;
- if (total_length <= 0) {
- return result;
- }
- } while (offset < src_iov->iov_len);
- }
- } else {
- if (total_length == 0 && fin) {
- WriteDataFrame(id, StringPiece(), true, ack_notifier_delegate);
- result.fin_consumed = true;
- return result;
- }
+ // Encapsulate the data into HTTP/2 DATA frames. The outer loop
+ // handles each element of the source iov, the inner loop handles
+ // the possibility of fragmenting eacho of those into multiple DATA
+ // frames, as the DATA frames have a max size of 16KB.
+ for (int i = 0; i < iov.iov_count; i++) {
+ size_t offset = 0;
+ const struct iovec* src_iov = &iov.iov[i];
+ do {
+ size_t len =
+ std::min(std::min(src_iov->iov_len - offset, max_len), total_length);
+ char* data = static_cast<char*>(src_iov->iov_base) + offset;
+ SpdyDataIR spdy_data(id, StringPiece(data, len));
+ offset += len;
+ // fin handling, set it only it only very last generated HTTP/2
+ // DATA frame.
+ bool last_iov = i == iov.iov_count - 1;
+ bool last_fragment_within_iov = offset >= src_iov->iov_len;
+ bool frame_fin = (last_iov && last_fragment_within_iov) ? fin : false;
+ spdy_data.set_fin(frame_fin);
+ if (frame_fin) {
+ result.fin_consumed = true;
+ }
+ SpdySerializedFrame frame(spdy_framer_.SerializeFrame(spdy_data));
+ DVLOG(1) << "Encapsulating in DATA frame for stream " << id << " len "
+ << len << " fin " << spdy_data.fin() << " remaining "
+ << src_iov->iov_len - offset;
+
+ scoped_refptr<ForceHolAckListener> ack_listener;
+ if (ack_notifier_delegate != nullptr) {
+ ack_listener =
+ new ForceHolAckListener(ack_notifier_delegate, frame.size() - len);
+ }
- // Encapsulate the data into HTTP/2 DATA frames. The outer loop
- // handles each element of the source iov, the inner loop handles
- // the possibility of fragmenting each of those into multiple DATA
- // frames, as the DATA frames have a max size of 16KB.
- for (int i = 0; i < iov.iov_count; i++) {
- size_t src_iov_offset = 0;
- const struct iovec* src_iov = &iov.iov[i];
- do {
- if (queued_data_bytes() > 0) {
- // Limit the amount of buffering to the minimum needed to
- // preserve framing.
- return result;
- }
- size_t len = std::min(
- std::min(src_iov->iov_len - src_iov_offset, max_len), total_length);
- char* data = static_cast<char*>(src_iov->iov_base) + src_iov_offset;
- src_iov_offset += len;
- offset += len;
- // fin handling, only set it for the final HTTP/2 DATA frame.
- bool last_iov = i == iov.iov_count - 1;
- bool last_fragment_within_iov = src_iov_offset >= src_iov->iov_len;
- bool frame_fin = (last_iov && last_fragment_within_iov) ? fin : false;
- WriteDataFrame(id, StringPiece(data, len), frame_fin,
- ack_notifier_delegate);
- result.bytes_consumed += len;
- if (frame_fin) {
- result.fin_consumed = true;
- }
- DCHECK_GE(total_length, len);
- total_length -= len;
- if (total_length <= 0) {
- return result;
- }
- } while (src_iov_offset < src_iov->iov_len);
- }
+ WriteOrBufferData(StringPiece(frame.data(), frame.size()), false,
+ ack_listener.get());
+ result.bytes_consumed += len;
+ total_length -= len;
+ if (total_length <= 0) {
+ return result;
+ }
+ } while (offset < src_iov->iov_len);
}
-
return result;
}
@@ -529,6 +472,12 @@ void QuicHeadersStream::OnDataAvailable() {
}
}
+void QuicHeadersStream::set_max_uncompressed_header_bytes(
+ size_t set_max_uncompressed_header_bytes) {
+ spdy_framer_visitor_->set_max_uncompressed_header_bytes(
+ set_max_uncompressed_header_bytes);
+}
+
void QuicHeadersStream::OnHeaders(SpdyStreamId stream_id,
bool has_priority,
SpdyPriority priority,
« no previous file with comments | « net/quic/core/quic_headers_stream.h ('k') | net/quic/core/quic_headers_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698