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

Unified Diff: net/http2/hpack/decoder/hpack_string_decoder_listener.h

Issue 2293613002: Add new HTTP/2 and HPACK decoder in net/http2/. (Closed)
Patch Set: Replace LOG(INFO) by VLOG(2) in DecodeBufferTest.SlowDecodeTestStruct so that trybots do not fail. 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 side-by-side diff with in-line comments
Download patch
Index: net/http2/hpack/decoder/hpack_string_decoder_listener.h
diff --git a/net/http2/hpack/decoder/hpack_string_decoder_listener.h b/net/http2/hpack/decoder/hpack_string_decoder_listener.h
new file mode 100644
index 0000000000000000000000000000000000000000..fbeeeb4b54435595542abdde34e0dd0ea3b4ce1e
--- /dev/null
+++ b/net/http2/hpack/decoder/hpack_string_decoder_listener.h
@@ -0,0 +1,62 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_HTTP2_HPACK_DECODER_HPACK_STRING_DECODER_LISTENER_H_
+#define NET_HTTP2_HPACK_DECODER_HPACK_STRING_DECODER_LISTENER_H_
+
+// Defines HpackStringDecoderListener which defines the methods required by an
+// HpackStringDecoder. Also defines HpackStringDecoderVLoggingListener which
+// logs before calling another HpackStringDecoderListener implementation.
+// For now these are only used by tests, so placed in the test namespace.
+
+#include <stddef.h>
+
+#include "net/base/net_export.h"
+
+namespace net {
+namespace test {
+
+// HpackStringDecoder methods require a listener that implements the methods
+// below, but it is NOT necessary to extend this class because the methods
+// are templates.
+class NET_EXPORT_PRIVATE HpackStringDecoderListener {
+ public:
+ virtual ~HpackStringDecoderListener() {}
+
+ // Called at the start of decoding an HPACK string. The encoded length of the
+ // string is |len| bytes, which may be zero. The string is Huffman encoded
+ // if huffman_encoded is true, else it is plain text (i.e. the encoded length
+ // is then the plain text length).
+ virtual void OnStringStart(bool huffman_encoded, size_t len) = 0;
+
+ // Called when some data is available, or once when the string length is zero
+ // (to simplify the decoder, it doesn't have a special case for len==0).
+ virtual void OnStringData(const char* data, size_t len) = 0;
+
+ // Called after OnStringData has provided all of the encoded bytes of the
+ // string.
+ virtual void OnStringEnd() = 0;
+};
+
+class NET_EXPORT_PRIVATE HpackStringDecoderVLoggingListener
+ : public HpackStringDecoderListener {
+ public:
+ HpackStringDecoderVLoggingListener() : wrapped_(nullptr) {}
+ explicit HpackStringDecoderVLoggingListener(
+ HpackStringDecoderListener* wrapped)
+ : wrapped_(wrapped) {}
+ ~HpackStringDecoderVLoggingListener() override {}
+
+ void OnStringStart(bool huffman_encoded, size_t len) override;
+ void OnStringData(const char* data, size_t len) override;
+ void OnStringEnd() override;
+
+ private:
+ HpackStringDecoderListener* const wrapped_;
+};
+
+} // namespace test
+} // namespace net
+
+#endif // NET_HTTP2_HPACK_DECODER_HPACK_STRING_DECODER_LISTENER_H_
« 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