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

Unified Diff: net/http2/hpack/tools/hpack_block_builder.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http2/hpack/tools/hpack_block_builder.h ('k') | net/http2/hpack/tools/hpack_block_builder_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http2/hpack/tools/hpack_block_builder.cc
diff --git a/net/http2/hpack/tools/hpack_block_builder.cc b/net/http2/hpack/tools/hpack_block_builder.cc
deleted file mode 100644
index 49eba0d67195e5521cd1ea837c606f5eb8f1a553..0000000000000000000000000000000000000000
--- a/net/http2/hpack/tools/hpack_block_builder.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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.
-
-#include "net/http2/hpack/tools/hpack_block_builder.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace net {
-namespace test {
-
-void HpackBlockBuilder::AppendHighBitsAndVarint(uint8_t high_bits,
- uint8_t prefix_length,
- uint64_t varint) {
- EXPECT_LE(4, prefix_length);
- EXPECT_LE(prefix_length, 7);
-
- // prefix_mask defines the sequence of low-order bits of the first byte
- // that encode the prefix of the value. It is also the marker in those bits
- // of the first byte indicating that at least one extension byte is needed.
- uint8_t prefix_mask = (1 << prefix_length) - 1;
- EXPECT_EQ(0, high_bits & prefix_mask);
-
- if (varint < prefix_mask) {
- uint8_t b = high_bits | static_cast<uint8_t>(varint);
- buffer_.push_back(static_cast<char>(b));
- return;
- }
-
- // We need extension bytes.
- buffer_.push_back(static_cast<char>(high_bits | prefix_mask));
- varint -= prefix_mask;
- while (varint >= 128) {
- uint8_t b = static_cast<uint8_t>((varint % 128) + 128);
- buffer_.push_back(static_cast<char>(b));
- varint = varint / 128;
- }
- char c = static_cast<char>(varint);
- buffer_.push_back(c);
-}
-
-void HpackBlockBuilder::AppendEntryTypeAndVarint(HpackEntryType entry_type,
- uint64_t varint) {
- uint8_t high_bits;
- uint8_t prefix_length; // Bits of the varint prefix in the first byte.
- switch (entry_type) {
- case HpackEntryType::kIndexedHeader:
- high_bits = 0x80;
- prefix_length = 7;
- break;
- case HpackEntryType::kDynamicTableSizeUpdate:
- high_bits = 0x20;
- prefix_length = 5;
- break;
- case HpackEntryType::kIndexedLiteralHeader:
- high_bits = 0x40;
- prefix_length = 6;
- break;
- case HpackEntryType::kUnindexedLiteralHeader:
- high_bits = 0x00;
- prefix_length = 4;
- break;
- case HpackEntryType::kNeverIndexedLiteralHeader:
- high_bits = 0x10;
- prefix_length = 4;
- break;
- default:
- NOTREACHED();
- high_bits = 0;
- prefix_length = 0;
- }
- AppendHighBitsAndVarint(high_bits, prefix_length, varint);
-}
-
-void HpackBlockBuilder::AppendString(bool is_huffman_encoded,
- base::StringPiece str) {
- uint8_t high_bits = is_huffman_encoded ? 0x80 : 0;
- uint8_t prefix_length = 7;
- AppendHighBitsAndVarint(high_bits, prefix_length, str.size());
- str.AppendToString(&buffer_);
-}
-
-} // namespace test
-} // namespace net
« no previous file with comments | « net/http2/hpack/tools/hpack_block_builder.h ('k') | net/http2/hpack/tools/hpack_block_builder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698