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

Side by Side Diff: net/http2/hpack/decoder/hpack_block_decoder.cc

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 #include "net/http2/hpack/decoder/hpack_block_decoder.h"
6
7 #include <stdint.h>
8
9 #include <sstream>
10 #include <string>
11
12 #include "base/logging.h"
13
14 namespace net {
15
16 DecodeStatus HpackBlockDecoder::Decode(DecodeBuffer* db) {
17 if (!before_entry_) {
18 DVLOG(2) << "HpackBlockDecoder::Decode resume entry, db->Remaining="
19 << db->Remaining();
20 DecodeStatus status = entry_decoder_.Resume(db, listener_);
21 switch (status) {
22 case DecodeStatus::kDecodeDone:
23 before_entry_ = true;
24 break;
25 case DecodeStatus::kDecodeInProgress:
26 DCHECK_EQ(0u, db->Remaining());
27 return DecodeStatus::kDecodeInProgress;
28 case DecodeStatus::kDecodeError:
29 return DecodeStatus::kDecodeError;
30 }
31 }
32 DCHECK(before_entry_);
33 while (db->HasData()) {
34 DVLOG(2) << "HpackBlockDecoder::Decode start entry, db->Remaining="
35 << db->Remaining();
36 DecodeStatus status = entry_decoder_.Start(db, listener_);
37 switch (status) {
38 case DecodeStatus::kDecodeDone:
39 continue;
40 case DecodeStatus::kDecodeInProgress:
41 DCHECK_EQ(0u, db->Remaining());
42 before_entry_ = false;
43 return DecodeStatus::kDecodeInProgress;
44 case DecodeStatus::kDecodeError:
45 return DecodeStatus::kDecodeError;
46 }
47 DCHECK(false);
48 }
49 DCHECK(before_entry_);
50 return DecodeStatus::kDecodeDone;
51 }
52
53 std::string HpackBlockDecoder::DebugString() const {
54 std::stringstream ss;
55 ss << "HpackBlockDecoder(" << entry_decoder_.DebugString() << ", listener@"
56 << std::hex << reinterpret_cast<intptr_t>(listener_)
57 << (before_entry_ ? ", between entries)" : ", in an entry)");
58 return ss.str();
59 }
60
61 std::ostream& operator<<(std::ostream& out, const HpackBlockDecoder& v) {
62 return out << v.DebugString();
63 }
64
65 } // namespace net
OLDNEW
« no previous file with comments | « net/http2/hpack/decoder/hpack_block_decoder.h ('k') | net/http2/hpack/decoder/hpack_block_decoder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698