| Index: net/quic/bidirectional_stream_quic_impl.cc
|
| diff --git a/net/quic/bidirectional_stream_quic_impl.cc b/net/quic/bidirectional_stream_quic_impl.cc
|
| index b85997b67f2cd479e66dcf7191657bfd439fea2c..da6624023bb46ac5d7f55fdea2921188a491f03e 100644
|
| --- a/net/quic/bidirectional_stream_quic_impl.cc
|
| +++ b/net/quic/bidirectional_stream_quic_impl.cc
|
| @@ -32,7 +32,7 @@ BidirectionalStreamQuicImpl::BidirectionalStreamQuicImpl(
|
| closed_stream_sent_bytes_(0),
|
| has_sent_headers_(false),
|
| has_received_headers_(false),
|
| - disable_auto_flush_(false),
|
| + delay_headers_until_next_send_data_(false),
|
| weak_factory_(this) {
|
| DCHECK(session_);
|
| session_->AddObserver(this);
|
| @@ -47,12 +47,12 @@ BidirectionalStreamQuicImpl::~BidirectionalStreamQuicImpl() {
|
| void BidirectionalStreamQuicImpl::Start(
|
| const BidirectionalStreamRequestInfo* request_info,
|
| const BoundNetLog& net_log,
|
| - bool disable_auto_flush,
|
| + bool delay_headers_until_next_send_data,
|
| BidirectionalStreamImpl::Delegate* delegate,
|
| std::unique_ptr<base::Timer> /* timer */) {
|
| DCHECK(!stream_);
|
|
|
| - disable_auto_flush_ = disable_auto_flush;
|
| + delay_headers_until_next_send_data_ = delay_headers_until_next_send_data;
|
| if (!session_) {
|
| NotifyError(was_handshake_confirmed_ ? ERR_QUIC_PROTOCOL_ERROR
|
| : ERR_QUIC_HANDSHAKE_FAILED);
|
| @@ -103,6 +103,16 @@ void BidirectionalStreamQuicImpl::SendData(const scoped_refptr<IOBuffer>& data,
|
| DCHECK(stream_);
|
| DCHECK(length > 0 || (length == 0 && end_stream));
|
|
|
| + std::unique_ptr<QuicConnection::ScopedPacketBundler> bundler;
|
| + if (!has_sent_headers_) {
|
| + DCHECK(delay_headers_until_next_send_data_);
|
| + // Creates a bundler only if there are headers to be sent along with the
|
| + // single data buffer.
|
| + bundler.reset(new QuicConnection::ScopedPacketBundler(
|
| + session_->connection(), QuicConnection::SEND_ACK_IF_PENDING));
|
| + SendRequestHeaders();
|
| + }
|
| +
|
| base::StringPiece string_data(data->data(), length);
|
| int rv = stream_->WriteStreamData(
|
| string_data, end_stream,
|
| @@ -126,6 +136,7 @@ void BidirectionalStreamQuicImpl::SendvData(
|
| QuicConnection::ScopedPacketBundler bundler(
|
| session_->connection(), QuicConnection::SEND_ACK_IF_PENDING);
|
| if (!has_sent_headers_) {
|
| + DCHECK(delay_headers_until_next_send_data_);
|
| SendRequestHeaders();
|
| }
|
|
|
| @@ -238,7 +249,7 @@ void BidirectionalStreamQuicImpl::OnStreamReady(int rv) {
|
| DCHECK(rv == OK || !stream_);
|
| if (rv == OK) {
|
| stream_->SetDelegate(this);
|
| - if (!disable_auto_flush_) {
|
| + if (!delay_headers_until_next_send_data_) {
|
| SendRequestHeaders();
|
| }
|
| delegate_->OnStreamReady();
|
|
|