| 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_HTTP2_HPACK_DECODER_HTTP2_HPACK_DECODER_H_ | 5 #ifndef NET_HTTP2_HPACK_DECODER_HTTP2_HPACK_DECODER_H_ |
| 6 #define NET_HTTP2_HPACK_DECODER_HTTP2_HPACK_DECODER_H_ | 6 #define NET_HTTP2_HPACK_DECODER_HTTP2_HPACK_DECODER_H_ |
| 7 | 7 |
| 8 // Decodes HPACK blocks, calls an Http2HpackDecoderListener with the decoded | 8 // Decodes HPACK blocks, calls an Http2HpackDecoderListener with the decoded |
| 9 // header entries. Also notifies the listener of errors and of the boundaries of | 9 // header entries. Also notifies the listener of errors and of the boundaries of |
| 10 // the HPACK blocks. | 10 // the HPACK blocks. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 bool DecodeFragment(DecodeBuffer* db); | 88 bool DecodeFragment(DecodeBuffer* db); |
| 89 | 89 |
| 90 // Completes the process of decoding an HPACK block: if the HPACK block was | 90 // Completes the process of decoding an HPACK block: if the HPACK block was |
| 91 // properly terminated, announces the end of the header list to the listener | 91 // properly terminated, announces the end of the header list to the listener |
| 92 // and returns true; else returns false. | 92 // and returns true; else returns false. |
| 93 bool EndDecodingBlock(); | 93 bool EndDecodingBlock(); |
| 94 | 94 |
| 95 // Was an error detected? | 95 // Was an error detected? |
| 96 bool error_detected(); | 96 bool error_detected(); |
| 97 | 97 |
| 98 // Returns the estimate of dynamically allocated memory in bytes. |
| 99 size_t EstimateMemoryUsage() const; |
| 100 |
| 98 private: | 101 private: |
| 99 friend class test::Http2HpackDecoderPeer; | 102 friend class test::Http2HpackDecoderPeer; |
| 100 | 103 |
| 101 // Reports an error to the listener IF this is the first error detected. | 104 // Reports an error to the listener IF this is the first error detected. |
| 102 void ReportError(base::StringPiece error_message); | 105 void ReportError(base::StringPiece error_message); |
| 103 | 106 |
| 104 // The decompressor state, as defined by HPACK (i.e. the static and dynamic | 107 // The decompressor state, as defined by HPACK (i.e. the static and dynamic |
| 105 // tables). | 108 // tables). |
| 106 HpackDecoderState decoder_state_; | 109 HpackDecoderState decoder_state_; |
| 107 | 110 |
| 108 // Assembles the various parts of a header entry into whole entries. | 111 // Assembles the various parts of a header entry into whole entries. |
| 109 HpackWholeEntryBuffer entry_buffer_; | 112 HpackWholeEntryBuffer entry_buffer_; |
| 110 | 113 |
| 111 // The decoder of HPACK blocks into entry parts, passed to entry_buffer_. | 114 // The decoder of HPACK blocks into entry parts, passed to entry_buffer_. |
| 112 HpackBlockDecoder block_decoder_; | 115 HpackBlockDecoder block_decoder_; |
| 113 | 116 |
| 114 // Has an error been detected? | 117 // Has an error been detected? |
| 115 bool error_detected_; | 118 bool error_detected_; |
| 116 | 119 |
| 117 DISALLOW_COPY_AND_ASSIGN(Http2HpackDecoder); | 120 DISALLOW_COPY_AND_ASSIGN(Http2HpackDecoder); |
| 118 }; | 121 }; |
| 119 | 122 |
| 120 } // namespace net | 123 } // namespace net |
| 121 | 124 |
| 122 #endif // NET_HTTP2_HPACK_DECODER_HTTP2_HPACK_DECODER_H_ | 125 #endif // NET_HTTP2_HPACK_DECODER_HTTP2_HPACK_DECODER_H_ |
| OLD | NEW |