QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 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 "net/third_party/quiche/src/quic/core/qpack/qpack_encoder.h" |
| 6 | |
vasilvv | 872e7a3 | 2019-03-12 16:42:44 -0700 | [diff] [blame] | 7 | #include <string> |
| 8 | |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 9 | #include "net/third_party/quiche/src/quic/core/qpack/qpack_progressive_encoder.h" |
vasilvv | 0fb4443 | 2019-03-13 22:47:36 -0700 | [diff] [blame^] | 10 | #include "net/third_party/quiche/src/quic/platform/api/quic_logging.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 11 | #include "net/third_party/quiche/src/quic/platform/api/quic_ptr_util.h" |
QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 12 | #include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h" |
| 13 | |
| 14 | namespace quic { |
| 15 | |
| 16 | QpackEncoder::QpackEncoder( |
| 17 | DecoderStreamErrorDelegate* decoder_stream_error_delegate, |
| 18 | QpackEncoderStreamSender::Delegate* encoder_stream_sender_delegate) |
| 19 | : decoder_stream_error_delegate_(decoder_stream_error_delegate), |
| 20 | decoder_stream_receiver_(this), |
| 21 | encoder_stream_sender_(encoder_stream_sender_delegate) { |
| 22 | DCHECK(decoder_stream_error_delegate_); |
| 23 | DCHECK(encoder_stream_sender_delegate); |
| 24 | } |
| 25 | |
| 26 | QpackEncoder::~QpackEncoder() {} |
| 27 | |
| 28 | std::unique_ptr<spdy::HpackEncoder::ProgressiveEncoder> |
| 29 | QpackEncoder::EncodeHeaderList(QuicStreamId stream_id, |
| 30 | const spdy::SpdyHeaderBlock* header_list) { |
| 31 | return QuicMakeUnique<QpackProgressiveEncoder>( |
| 32 | stream_id, &header_table_, &encoder_stream_sender_, header_list); |
| 33 | } |
| 34 | |
| 35 | void QpackEncoder::DecodeDecoderStreamData(QuicStringPiece data) { |
| 36 | decoder_stream_receiver_.Decode(data); |
| 37 | } |
| 38 | |
| 39 | void QpackEncoder::OnInsertCountIncrement(uint64_t increment) { |
| 40 | // TODO(bnc): Implement dynamic table management for encoding. |
| 41 | } |
| 42 | |
| 43 | void QpackEncoder::OnHeaderAcknowledgement(QuicStreamId stream_id) { |
| 44 | // TODO(bnc): Implement dynamic table management for encoding. |
| 45 | } |
| 46 | |
| 47 | void QpackEncoder::OnStreamCancellation(QuicStreamId stream_id) { |
| 48 | // TODO(bnc): Implement dynamic table management for encoding. |
| 49 | } |
| 50 | |
| 51 | void QpackEncoder::OnErrorDetected(QuicStringPiece error_message) { |
| 52 | decoder_stream_error_delegate_->OnDecoderStreamError(error_message); |
| 53 | } |
| 54 | |
| 55 | } // namespace quic |