1 // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "quiche/quic/core/qpack/qpack_decoder_stream_sender.h" 6 7 #include <cstddef> 8 #include <limits> 9 #include <string> 10 11 #include "absl/strings/string_view.h" 12 #include "quiche/quic/core/qpack/qpack_instructions.h" 13 #include "quiche/quic/platform/api/quic_logging.h" 14 15 namespace quic { 16 QpackDecoderStreamSender()17QpackDecoderStreamSender::QpackDecoderStreamSender() : delegate_(nullptr) {} 18 SendInsertCountIncrement(uint64_t increment)19void QpackDecoderStreamSender::SendInsertCountIncrement(uint64_t increment) { 20 instruction_encoder_.Encode( 21 QpackInstructionWithValues::InsertCountIncrement(increment), &buffer_); 22 } 23 SendHeaderAcknowledgement(QuicStreamId stream_id)24void QpackDecoderStreamSender::SendHeaderAcknowledgement( 25 QuicStreamId stream_id) { 26 instruction_encoder_.Encode( 27 QpackInstructionWithValues::HeaderAcknowledgement(stream_id), &buffer_); 28 } 29 SendStreamCancellation(QuicStreamId stream_id)30void QpackDecoderStreamSender::SendStreamCancellation(QuicStreamId stream_id) { 31 instruction_encoder_.Encode( 32 QpackInstructionWithValues::StreamCancellation(stream_id), &buffer_); 33 } 34 Flush()35void QpackDecoderStreamSender::Flush() { 36 if (buffer_.empty()) { 37 return; 38 } 39 40 delegate_->WriteStreamData(buffer_); 41 buffer_.clear(); 42 } 43 44 } // namespace quic 45