Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: net/http2/hpack/decoder/hpack_string_decoder_listener.h

Issue 2554683003: Revert of Add new HTTP/2 and HPACK decoder in net/http2/. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 #ifndef NET_HTTP2_HPACK_DECODER_HPACK_STRING_DECODER_LISTENER_H_
6 #define NET_HTTP2_HPACK_DECODER_HPACK_STRING_DECODER_LISTENER_H_
7
8 // Defines HpackStringDecoderListener which defines the methods required by an
9 // HpackStringDecoder. Also defines HpackStringDecoderVLoggingListener which
10 // logs before calling another HpackStringDecoderListener implementation.
11 // For now these are only used by tests, so placed in the test namespace.
12
13 #include <stddef.h>
14
15 #include "net/base/net_export.h"
16
17 namespace net {
18 namespace test {
19
20 // HpackStringDecoder methods require a listener that implements the methods
21 // below, but it is NOT necessary to extend this class because the methods
22 // are templates.
23 class NET_EXPORT_PRIVATE HpackStringDecoderListener {
24 public:
25 virtual ~HpackStringDecoderListener() {}
26
27 // Called at the start of decoding an HPACK string. The encoded length of the
28 // string is |len| bytes, which may be zero. The string is Huffman encoded
29 // if huffman_encoded is true, else it is plain text (i.e. the encoded length
30 // is then the plain text length).
31 virtual void OnStringStart(bool huffman_encoded, size_t len) = 0;
32
33 // Called when some data is available, or once when the string length is zero
34 // (to simplify the decoder, it doesn't have a special case for len==0).
35 virtual void OnStringData(const char* data, size_t len) = 0;
36
37 // Called after OnStringData has provided all of the encoded bytes of the
38 // string.
39 virtual void OnStringEnd() = 0;
40 };
41
42 class NET_EXPORT_PRIVATE HpackStringDecoderVLoggingListener
43 : public HpackStringDecoderListener {
44 public:
45 HpackStringDecoderVLoggingListener() : wrapped_(nullptr) {}
46 explicit HpackStringDecoderVLoggingListener(
47 HpackStringDecoderListener* wrapped)
48 : wrapped_(wrapped) {}
49 ~HpackStringDecoderVLoggingListener() override {}
50
51 void OnStringStart(bool huffman_encoded, size_t len) override;
52 void OnStringData(const char* data, size_t len) override;
53 void OnStringEnd() override;
54
55 private:
56 HpackStringDecoderListener* const wrapped_;
57 };
58
59 } // namespace test
60 } // namespace net
61
62 #endif // NET_HTTP2_HPACK_DECODER_HPACK_STRING_DECODER_LISTENER_H_
OLDNEW
« no previous file with comments | « net/http2/hpack/decoder/hpack_string_decoder.cc ('k') | net/http2/hpack/decoder/hpack_string_decoder_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698