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

Unified Diff: net/http2/hpack/decoder/hpack_block_decoder.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
« no previous file with comments | « net/http2/hpack/decoder/hpack_block_collector.cc ('k') | net/http2/hpack/decoder/hpack_block_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http2/hpack/decoder/hpack_block_decoder.h
diff --git a/net/http2/hpack/decoder/hpack_block_decoder.h b/net/http2/hpack/decoder/hpack_block_decoder.h
new file mode 100644
index 0000000000000000000000000000000000000000..49e8ae1784241153bdf90d5667fa48d6617f3d4b
--- /dev/null
+++ b/net/http2/hpack/decoder/hpack_block_decoder.h
@@ -0,0 +1,69 @@
+// 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_BLOCK_DECODER_H_
+#define NET_HTTP2_HPACK_DECODER_HPACK_BLOCK_DECODER_H_
+
+// HpackBlockDecoder decodes an entire HPACK block (or the available portion
+// thereof in the DecodeBuffer) into entries, but doesn't include HPACK static
+// or dynamic table support, so table indices remain indices at this level.
+// Reports the entries to an HpackEntryDecoderListener.
+
+#include <string>
+
+#include "base/logging.h"
+#include "base/macros.h"
+#include "net/base/net_export.h"
+#include "net/http2/decoder/decode_buffer.h"
+#include "net/http2/decoder/decode_status.h"
+#include "net/http2/hpack/decoder/hpack_entry_decoder.h"
+#include "net/http2/hpack/decoder/hpack_entry_decoder_listener.h"
+
+namespace net {
+
+class NET_EXPORT_PRIVATE HpackBlockDecoder {
+ public:
+ explicit HpackBlockDecoder(HpackEntryDecoderListener* listener)
+ : listener_(listener) {
+ DCHECK_NE(listener_, nullptr);
+ }
+ ~HpackBlockDecoder() {}
+
+ // The listener may be changed at any time. The change takes effect on the
+ // next entry into the decode loop of the Decode() method below.
+ void set_listener(HpackEntryDecoderListener* listener) {
+ DCHECK_NE(nullptr, listener);
+ listener_ = listener;
+ }
+ HpackEntryDecoderListener* listener() { return listener_; }
+
+ // Prepares the decoder to start decoding a new HPACK block. Expected
+ // to be called from an implementation of Http2FrameDecoderListener's
+ // OnHeadersStart or OnPushPromiseStart methods.
+ void Reset() {
+ DVLOG(2) << "HpackBlockDecoder::Reset";
+ before_entry_ = true;
+ }
+
+ // Decode the fragment of the HPACK block contained in the decode buffer.
+ // Expected to be called from an implementation of Http2FrameDecoderListener's
+ // OnHpackFragment method.
+ DecodeStatus Decode(DecodeBuffer* db);
+
+ std::string DebugString() const;
+
+ private:
+ HpackEntryDecoder entry_decoder_;
+ HpackEntryDecoderListener* listener_;
+ bool before_entry_ = true;
+
+ DISALLOW_COPY_AND_ASSIGN(HpackBlockDecoder);
+};
+
+NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out,
+ const HpackBlockDecoder& v);
+
+} // namespace net
+
+#endif // NET_HTTP2_HPACK_DECODER_HPACK_BLOCK_DECODER_H_
« no previous file with comments | « net/http2/hpack/decoder/hpack_block_collector.cc ('k') | net/http2/hpack/decoder/hpack_block_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698