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

Side by Side Diff: net/http2/hpack/decoder/hpack_block_decoder.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_BLOCK_DECODER_H_
6 #define NET_HTTP2_HPACK_DECODER_HPACK_BLOCK_DECODER_H_
7
8 // HpackBlockDecoder decodes an entire HPACK block (or the available portion
9 // thereof in the DecodeBuffer) into entries, but doesn't include HPACK static
10 // or dynamic table support, so table indices remain indices at this level.
11 // Reports the entries to an HpackEntryDecoderListener.
12
13 #include <string>
14
15 #include "base/logging.h"
16 #include "base/macros.h"
17 #include "net/base/net_export.h"
18 #include "net/http2/decoder/decode_buffer.h"
19 #include "net/http2/decoder/decode_status.h"
20 #include "net/http2/hpack/decoder/hpack_entry_decoder.h"
21 #include "net/http2/hpack/decoder/hpack_entry_decoder_listener.h"
22
23 namespace net {
24
25 class NET_EXPORT_PRIVATE HpackBlockDecoder {
26 public:
27 explicit HpackBlockDecoder(HpackEntryDecoderListener* listener)
28 : listener_(listener) {
29 DCHECK_NE(listener_, nullptr);
30 }
31 ~HpackBlockDecoder() {}
32
33 // The listener may be changed at any time. The change takes effect on the
34 // next entry into the decode loop of the Decode() method below.
35 void set_listener(HpackEntryDecoderListener* listener) {
36 DCHECK_NE(nullptr, listener);
37 listener_ = listener;
38 }
39 HpackEntryDecoderListener* listener() { return listener_; }
40
41 // Prepares the decoder to start decoding a new HPACK block. Expected
42 // to be called from an implementation of Http2FrameDecoderListener's
43 // OnHeadersStart or OnPushPromiseStart methods.
44 void Reset() {
45 DVLOG(2) << "HpackBlockDecoder::Reset";
46 before_entry_ = true;
47 }
48
49 // Decode the fragment of the HPACK block contained in the decode buffer.
50 // Expected to be called from an implementation of Http2FrameDecoderListener's
51 // OnHpackFragment method.
52 DecodeStatus Decode(DecodeBuffer* db);
53
54 std::string DebugString() const;
55
56 private:
57 HpackEntryDecoder entry_decoder_;
58 HpackEntryDecoderListener* listener_;
59 bool before_entry_ = true;
60
61 DISALLOW_COPY_AND_ASSIGN(HpackBlockDecoder);
62 };
63
64 NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out,
65 const HpackBlockDecoder& v);
66
67 } // namespace net
68
69 #endif // NET_HTTP2_HPACK_DECODER_HPACK_BLOCK_DECODER_H_
OLDNEW
« 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