| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef NET_SPDY_CORE_HPACK_HPACK_DECODER3_H_ | 5 #ifndef NET_SPDY_CORE_HPACK_HPACK_DECODER3_H_ |
| 6 #define NET_SPDY_CORE_HPACK_HPACK_DECODER3_H_ | 6 #define NET_SPDY_CORE_HPACK_HPACK_DECODER3_H_ |
| 7 | 7 |
| 8 // HpackDecoder3 implements HpackDecoderInterface, using Http2HpackDecoder to | 8 // HpackDecoder3 implements HpackDecoderInterface, using Http2HpackDecoder to |
| 9 // decode HPACK blocks into HTTP/2 header lists as outlined in | 9 // decode HPACK blocks into HTTP/2 header lists as outlined in |
| 10 // http://tools.ietf.org/html/rfc7541. | 10 // http://tools.ietf.org/html/rfc7541. |
| 11 | 11 |
| 12 #include <stddef.h> | 12 #include <stddef.h> |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 | 15 |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "net/base/net_export.h" | |
| 18 #include "net/http2/hpack/decoder/hpack_decoder_listener.h" | 17 #include "net/http2/hpack/decoder/hpack_decoder_listener.h" |
| 19 #include "net/http2/hpack/decoder/http2_hpack_decoder.h" | 18 #include "net/http2/hpack/decoder/http2_hpack_decoder.h" |
| 20 #include "net/http2/hpack/hpack_string.h" | 19 #include "net/http2/hpack/hpack_string.h" |
| 21 #include "net/http2/hpack/http2_hpack_constants.h" | 20 #include "net/http2/hpack/http2_hpack_constants.h" |
| 22 #include "net/spdy/core/hpack/hpack_decoder_interface.h" | 21 #include "net/spdy/core/hpack/hpack_decoder_interface.h" |
| 23 #include "net/spdy/core/hpack/hpack_header_table.h" | 22 #include "net/spdy/core/hpack/hpack_header_table.h" |
| 24 #include "net/spdy/core/spdy_header_block.h" | 23 #include "net/spdy/core/spdy_header_block.h" |
| 25 #include "net/spdy/core/spdy_headers_handler_interface.h" | 24 #include "net/spdy/core/spdy_headers_handler_interface.h" |
| 25 #include "net/spdy/platform/api/spdy_export.h" |
| 26 #include "net/spdy/platform/api/spdy_string_piece.h" | 26 #include "net/spdy/platform/api/spdy_string_piece.h" |
| 27 | 27 |
| 28 namespace net { | 28 namespace net { |
| 29 namespace test { | 29 namespace test { |
| 30 class HpackDecoder3Peer; | 30 class HpackDecoder3Peer; |
| 31 } // namespace test | 31 } // namespace test |
| 32 | 32 |
| 33 class NET_EXPORT_PRIVATE HpackDecoder3 : public HpackDecoderInterface { | 33 class SPDY_EXPORT_PRIVATE HpackDecoder3 : public HpackDecoderInterface { |
| 34 public: | 34 public: |
| 35 friend test::HpackDecoder3Peer; | 35 friend test::HpackDecoder3Peer; |
| 36 HpackDecoder3(); | 36 HpackDecoder3(); |
| 37 ~HpackDecoder3() override; | 37 ~HpackDecoder3() override; |
| 38 | 38 |
| 39 // Override the HpackDecoderInterface methods: | 39 // Override the HpackDecoderInterface methods: |
| 40 | 40 |
| 41 void ApplyHeaderTableSizeSetting(size_t size_setting) override; | 41 void ApplyHeaderTableSizeSetting(size_t size_setting) override; |
| 42 void HandleControlFrameHeadersStart( | 42 void HandleControlFrameHeadersStart( |
| 43 SpdyHeadersHandlerInterface* handler) override; | 43 SpdyHeadersHandlerInterface* handler) override; |
| 44 bool HandleControlFrameHeadersData(const char* headers_data, | 44 bool HandleControlFrameHeadersData(const char* headers_data, |
| 45 size_t headers_data_length) override; | 45 size_t headers_data_length) override; |
| 46 bool HandleControlFrameHeadersComplete(size_t* compressed_len) override; | 46 bool HandleControlFrameHeadersComplete(size_t* compressed_len) override; |
| 47 const SpdyHeaderBlock& decoded_block() const override; | 47 const SpdyHeaderBlock& decoded_block() const override; |
| 48 void SetHeaderTableDebugVisitor( | 48 void SetHeaderTableDebugVisitor( |
| 49 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor) | 49 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor) |
| 50 override; | 50 override; |
| 51 void set_max_decode_buffer_size_bytes( | 51 void set_max_decode_buffer_size_bytes( |
| 52 size_t max_decode_buffer_size_bytes) override; | 52 size_t max_decode_buffer_size_bytes) override; |
| 53 size_t EstimateMemoryUsage() const override; | 53 size_t EstimateMemoryUsage() const override; |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 class NET_EXPORT_PRIVATE ListenerAdapter | 56 class SPDY_EXPORT_PRIVATE ListenerAdapter |
| 57 : public HpackDecoderListener, | 57 : public HpackDecoderListener, |
| 58 public HpackDecoderTablesDebugListener { | 58 public HpackDecoderTablesDebugListener { |
| 59 public: | 59 public: |
| 60 ListenerAdapter(); | 60 ListenerAdapter(); |
| 61 ~ListenerAdapter() override; | 61 ~ListenerAdapter() override; |
| 62 | 62 |
| 63 // If a SpdyHeadersHandlerInterface is provided, the decoder will emit | 63 // If a SpdyHeadersHandlerInterface is provided, the decoder will emit |
| 64 // headers to it rather than accumulating them in a SpdyHeaderBlock. | 64 // headers to it rather than accumulating them in a SpdyHeaderBlock. |
| 65 // Does not take ownership of the handler, but does use the pointer until | 65 // Does not take ownership of the handler, but does use the pointer until |
| 66 // the current HPACK block is completely decoded. | 66 // the current HPACK block is completely decoded. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // moment because HandleControlFrameHeadersStart won't be called if a handler | 122 // moment because HandleControlFrameHeadersStart won't be called if a handler |
| 123 // is not being provided by the caller. | 123 // is not being provided by the caller. |
| 124 bool header_block_started_; | 124 bool header_block_started_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(HpackDecoder3); | 126 DISALLOW_COPY_AND_ASSIGN(HpackDecoder3); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace net | 129 } // namespace net |
| 130 | 130 |
| 131 #endif // NET_SPDY_CORE_HPACK_HPACK_DECODER3_H_ | 131 #endif // NET_SPDY_CORE_HPACK_HPACK_DECODER3_H_ |
| OLD | NEW |