summaryrefslogtreecommitdiff
path: root/chromium/net/third_party/quiche/src/spdy
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/net/third_party/quiche/src/spdy')
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_constants.cc4
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.cc2
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.h5
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter_test.cc70
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.cc48
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h17
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder_test.cc140
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_entry.cc18
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_entry.h19
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.cc26
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h25
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table_test.cc11
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.cc4
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h6
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table_benchmark.cc64
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table_test.cc46
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.cc8
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h7
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream_test.cc14
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_round_trip_test.cc2
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_static_table.cc6
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_static_table_test.cc4
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.cc4
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h8
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/mock_spdy_framer_visitor.h7
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/recording_headers_handler.cc38
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/recording_headers_handler.h51
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.cc53
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h30
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format_test.cc64
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_deframer_visitor.cc20
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_deframer_visitor.h2
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder.cc3
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder.h18
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder_test.cc8
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader.cc26
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader.h6
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader_test.cc58
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_framer.cc11
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_framer.h2
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_framer_test.cc146
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_header_block.cc113
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_header_block.h119
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_header_block_test.cc129
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage.cc23
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage.h22
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage_test.cc16
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_headers_handler_interface.h5
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_intrusive_list_test.cc3
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_no_op_visitor.h8
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece.h6
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece_test.cc18
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_prefixed_buffer_reader_test.cc15
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_protocol.cc10
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_protocol.h33
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_protocol_test.cc16
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_protocol_test_utils.cc6
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_simple_arena_test.cc28
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_test_utils.cc20
-rw-r--r--chromium/net/third_party/quiche/src/spdy/core/spdy_test_utils.h36
-rw-r--r--chromium/net/third_party/quiche/src/spdy/platform/api/spdy_endianness_util.h44
-rw-r--r--chromium/net/third_party/quiche/src/spdy/platform/api/spdy_mem_slice_test.cc8
-rw-r--r--chromium/net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h9
-rw-r--r--chromium/net/third_party/quiche/src/spdy/platform/api/spdy_string_utils_test.cc6
64 files changed, 855 insertions, 939 deletions
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_constants.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_constants.cc
index 71ac1395e94..8d60d5e86d1 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_constants.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_constants.cc
@@ -8,7 +8,7 @@
#include <memory>
#include <vector>
-#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
+#include "absl/base/macros.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_static_table.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h"
@@ -290,7 +290,7 @@ const std::vector<HpackHuffmanSymbol>& HpackHuffmanCodeVector() {
// The "constructor" for a HpackStaticEntry that computes the lengths at
// compile time.
#define STATIC_ENTRY(name, value) \
- { name, QUICHE_ARRAYSIZE(name) - 1, value, QUICHE_ARRAYSIZE(value) - 1 }
+ { name, ABSL_ARRAYSIZE(name) - 1, value, ABSL_ARRAYSIZE(value) - 1 }
const std::vector<HpackStaticEntry>& HpackStaticTableVector() {
static const auto* kHpackStaticTable = new std::vector<HpackStaticEntry>{
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.cc
index cf9a0e79b35..fa54464ed94 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.cc
@@ -185,7 +185,7 @@ void HpackDecoderAdapter::ListenerAdapter::OnHeaderListEnd() {
}
void HpackDecoderAdapter::ListenerAdapter::OnHeaderErrorDetected(
- quiche::QuicheStringPiece error_message) {
+ absl::string_view error_message) {
SPDY_VLOG(1) << error_message;
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.h b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.h
index f521ee12cd5..36f42b7b749 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.h
@@ -13,13 +13,13 @@
#include <cstdint>
#include <memory>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_listener.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_tables.h"
#include "net/third_party/quiche/src/http2/hpack/hpack_string.h"
#include "net/third_party/quiche/src/http2/hpack/http2_hpack_constants.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h"
#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
#include "net/third_party/quiche/src/spdy/core/spdy_headers_handler_interface.h"
@@ -113,8 +113,7 @@ class QUICHE_EXPORT_PRIVATE HpackDecoderAdapter {
void OnHeader(const http2::HpackString& name,
const http2::HpackString& value) override;
void OnHeaderListEnd() override;
- void OnHeaderErrorDetected(
- quiche::QuicheStringPiece error_message) override;
+ void OnHeaderErrorDetected(absl::string_view error_message) override;
// Override the HpackDecoderTablesDebugListener methods:
int64_t OnEntryInserted(const http2::HpackStringPair& entry,
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter_test.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter_test.cc
index 2fe01fcf7cd..5a69a126a59 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter_test.cc
@@ -13,15 +13,16 @@
#include <utility>
#include <vector>
+#include "absl/base/macros.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_state.h"
#include "net/third_party/quiche/src/http2/hpack/decoder/hpack_decoder_tables.h"
#include "net/third_party/quiche/src/http2/hpack/tools/hpack_block_builder.h"
#include "net/third_party/quiche/src/http2/test_tools/http2_random.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h"
+#include "net/third_party/quiche/src/spdy/core/recording_headers_handler.h"
#include "net/third_party/quiche/src/spdy/core/spdy_test_utils.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h"
@@ -65,8 +66,8 @@ class HpackDecoderAdapterPeer {
explicit HpackDecoderAdapterPeer(HpackDecoderAdapter* decoder)
: decoder_(decoder) {}
- void HandleHeaderRepresentation(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ void HandleHeaderRepresentation(absl::string_view name,
+ absl::string_view value) {
decoder_->listener_adapter_.OnHeader(HpackString(name), HpackString(value));
}
@@ -133,7 +134,7 @@ class HpackDecoderAdapterTest
}
}
- bool HandleControlFrameHeadersData(quiche::QuicheStringPiece str) {
+ bool HandleControlFrameHeadersData(absl::string_view str) {
SPDY_VLOG(3) << "HandleControlFrameHeadersData:\n" << SpdyHexDump(str);
bytes_passed_in_ += str.size();
return decoder_.HandleControlFrameHeadersData(str.data(), str.size());
@@ -147,7 +148,7 @@ class HpackDecoderAdapterTest
return rc;
}
- bool DecodeHeaderBlock(quiche::QuicheStringPiece str,
+ bool DecodeHeaderBlock(absl::string_view str,
bool check_decoded_size = true) {
// Don't call this again if HandleControlFrameHeadersData failed previously.
EXPECT_FALSE(decode_has_failed_);
@@ -178,7 +179,7 @@ class HpackDecoderAdapterTest
decode_has_failed_ = true;
return false;
}
- total_hpack_bytes = handler_.compressed_header_bytes_parsed();
+ total_hpack_bytes = handler_.compressed_header_bytes();
} else {
if (!HandleControlFrameHeadersComplete(&total_hpack_bytes)) {
decode_has_failed_ = true;
@@ -187,7 +188,8 @@ class HpackDecoderAdapterTest
}
EXPECT_EQ(total_hpack_bytes, bytes_passed_in_);
if (check_decoded_size && start_choice_ == START_WITH_HANDLER) {
- EXPECT_EQ(handler_.header_bytes_parsed(), SizeOfHeaders(decoded_block()));
+ EXPECT_EQ(handler_.uncompressed_header_bytes(),
+ SizeOfHeaders(decoded_block()));
}
return true;
}
@@ -225,8 +227,7 @@ class HpackDecoderAdapterTest
return size;
}
- const SpdyHeaderBlock& DecodeBlockExpectingSuccess(
- quiche::QuicheStringPiece str) {
+ const SpdyHeaderBlock& DecodeBlockExpectingSuccess(absl::string_view str) {
EXPECT_TRUE(DecodeHeaderBlock(str));
return decoded_block();
}
@@ -253,7 +254,7 @@ class HpackDecoderAdapterTest
http2::test::Http2Random random_;
HpackDecoderAdapter decoder_;
test::HpackDecoderAdapterPeer decoder_peer_;
- TestHeadersHandler handler_;
+ RecordingHeadersHandler handler_;
StartChoice start_choice_;
bool randomly_split_input_buffer_;
bool decode_has_failed_ = false;
@@ -434,11 +435,10 @@ TEST_P(HpackDecoderAdapterTest, HandleHeaderRepresentation) {
decoded_block(),
ElementsAre(
Pair("cookie", " part 1; part 2 ; part3; fin!"),
- Pair("passed-through", quiche::QuicheStringPiece("foo\0baz", 7)),
- Pair("joined",
- quiche::QuicheStringPiece("joined\0value 1\0value 2", 22)),
+ Pair("passed-through", absl::string_view("foo\0baz", 7)),
+ Pair("joined", absl::string_view("joined\0value 1\0value 2", 22)),
Pair("empty", ""),
- Pair("empty-joined", quiche::QuicheStringPiece("\0foo\0\0", 6))));
+ Pair("empty-joined", absl::string_view("\0foo\0\0", 6))));
}
// Decoding indexed static table field should work.
@@ -503,7 +503,7 @@ TEST_P(HpackDecoderAdapterTest, ContextUpdateMaximumSize) {
output_stream.AppendUint32(126);
output_stream.TakeString(&input);
- EXPECT_TRUE(DecodeHeaderBlock(quiche::QuicheStringPiece(input)));
+ EXPECT_TRUE(DecodeHeaderBlock(absl::string_view(input)));
EXPECT_EQ(126u, decoder_peer_.header_table_size_limit());
}
{
@@ -513,7 +513,7 @@ TEST_P(HpackDecoderAdapterTest, ContextUpdateMaximumSize) {
output_stream.AppendUint32(kDefaultHeaderTableSizeSetting);
output_stream.TakeString(&input);
- EXPECT_TRUE(DecodeHeaderBlock(quiche::QuicheStringPiece(input)));
+ EXPECT_TRUE(DecodeHeaderBlock(absl::string_view(input)));
EXPECT_EQ(kDefaultHeaderTableSizeSetting,
decoder_peer_.header_table_size_limit());
}
@@ -524,7 +524,7 @@ TEST_P(HpackDecoderAdapterTest, ContextUpdateMaximumSize) {
output_stream.AppendUint32(kDefaultHeaderTableSizeSetting + 1);
output_stream.TakeString(&input);
- EXPECT_FALSE(DecodeHeaderBlock(quiche::QuicheStringPiece(input)));
+ EXPECT_FALSE(DecodeHeaderBlock(absl::string_view(input)));
EXPECT_EQ(kDefaultHeaderTableSizeSetting,
decoder_peer_.header_table_size_limit());
}
@@ -542,7 +542,7 @@ TEST_P(HpackDecoderAdapterTest, TwoTableSizeUpdates) {
output_stream.AppendUint32(122);
output_stream.TakeString(&input);
- EXPECT_TRUE(DecodeHeaderBlock(quiche::QuicheStringPiece(input)));
+ EXPECT_TRUE(DecodeHeaderBlock(absl::string_view(input)));
EXPECT_EQ(122u, decoder_peer_.header_table_size_limit());
}
}
@@ -562,7 +562,7 @@ TEST_P(HpackDecoderAdapterTest, ThreeTableSizeUpdatesError) {
output_stream.TakeString(&input);
- EXPECT_FALSE(DecodeHeaderBlock(quiche::QuicheStringPiece(input)));
+ EXPECT_FALSE(DecodeHeaderBlock(absl::string_view(input)));
EXPECT_EQ(10u, decoder_peer_.header_table_size_limit());
}
}
@@ -581,7 +581,7 @@ TEST_P(HpackDecoderAdapterTest, TableSizeUpdateSecondError) {
output_stream.TakeString(&input);
- EXPECT_FALSE(DecodeHeaderBlock(quiche::QuicheStringPiece(input)));
+ EXPECT_FALSE(DecodeHeaderBlock(absl::string_view(input)));
EXPECT_EQ(kDefaultHeaderTableSizeSetting,
decoder_peer_.header_table_size_limit());
}
@@ -604,7 +604,7 @@ TEST_P(HpackDecoderAdapterTest, TableSizeUpdateFirstThirdError) {
output_stream.TakeString(&input);
- EXPECT_FALSE(DecodeHeaderBlock(quiche::QuicheStringPiece(input)));
+ EXPECT_FALSE(DecodeHeaderBlock(absl::string_view(input)));
EXPECT_EQ(60u, decoder_peer_.header_table_size_limit());
}
}
@@ -616,7 +616,7 @@ TEST_P(HpackDecoderAdapterTest, LiteralHeaderNoIndexing) {
// name.
const char input[] = "\x04\x0c/sample/path\x00\x06:path2\x0e/sample/path/2";
const SpdyHeaderBlock& header_set = DecodeBlockExpectingSuccess(
- quiche::QuicheStringPiece(input, QUICHE_ARRAYSIZE(input) - 1));
+ absl::string_view(input, ABSL_ARRAYSIZE(input) - 1));
SpdyHeaderBlock expected_header_set;
expected_header_set[":path"] = "/sample/path";
@@ -629,7 +629,7 @@ TEST_P(HpackDecoderAdapterTest, LiteralHeaderNoIndexing) {
TEST_P(HpackDecoderAdapterTest, LiteralHeaderIncrementalIndexing) {
const char input[] = "\x44\x0c/sample/path\x40\x06:path2\x0e/sample/path/2";
const SpdyHeaderBlock& header_set = DecodeBlockExpectingSuccess(
- quiche::QuicheStringPiece(input, QUICHE_ARRAYSIZE(input) - 1));
+ absl::string_view(input, ABSL_ARRAYSIZE(input) - 1));
SpdyHeaderBlock expected_header_set;
expected_header_set[":path"] = "/sample/path";
@@ -642,23 +642,23 @@ TEST_P(HpackDecoderAdapterTest, LiteralHeaderWithIndexingInvalidNameIndex) {
EXPECT_TRUE(EncodeAndDecodeDynamicTableSizeUpdates(0, 0));
// Name is the last static index. Works.
- EXPECT_TRUE(DecodeHeaderBlock(quiche::QuicheStringPiece("\x7d\x03ooo")));
+ EXPECT_TRUE(DecodeHeaderBlock(absl::string_view("\x7d\x03ooo")));
// Name is one beyond the last static index. Fails.
- EXPECT_FALSE(DecodeHeaderBlock(quiche::QuicheStringPiece("\x7e\x03ooo")));
+ EXPECT_FALSE(DecodeHeaderBlock(absl::string_view("\x7e\x03ooo")));
}
TEST_P(HpackDecoderAdapterTest, LiteralHeaderNoIndexingInvalidNameIndex) {
// Name is the last static index. Works.
- EXPECT_TRUE(DecodeHeaderBlock(quiche::QuicheStringPiece("\x0f\x2e\x03ooo")));
+ EXPECT_TRUE(DecodeHeaderBlock(absl::string_view("\x0f\x2e\x03ooo")));
// Name is one beyond the last static index. Fails.
- EXPECT_FALSE(DecodeHeaderBlock(quiche::QuicheStringPiece("\x0f\x2f\x03ooo")));
+ EXPECT_FALSE(DecodeHeaderBlock(absl::string_view("\x0f\x2f\x03ooo")));
}
TEST_P(HpackDecoderAdapterTest, LiteralHeaderNeverIndexedInvalidNameIndex) {
// Name is the last static index. Works.
- EXPECT_TRUE(DecodeHeaderBlock(quiche::QuicheStringPiece("\x1f\x2e\x03ooo")));
+ EXPECT_TRUE(DecodeHeaderBlock(absl::string_view("\x1f\x2e\x03ooo")));
// Name is one beyond the last static index. Fails.
- EXPECT_FALSE(DecodeHeaderBlock(quiche::QuicheStringPiece("\x1f\x2f\x03ooo")));
+ EXPECT_FALSE(DecodeHeaderBlock(absl::string_view("\x1f\x2f\x03ooo")));
}
TEST_P(HpackDecoderAdapterTest, TruncatedIndex) {
@@ -710,7 +710,7 @@ TEST_P(HpackDecoderAdapterTest, HuffmanEOSError) {
// Round-tripping the header set from RFC 7541 C.3.1 should work.
// http://httpwg.org/specs/rfc7541.html#rfc.section.C.3.1
TEST_P(HpackDecoderAdapterTest, BasicC31) {
- HpackEncoder encoder(ObtainHpackHuffmanTable());
+ HpackEncoder encoder;
SpdyHeaderBlock expected_header_set;
expected_header_set[":method"] = "GET";
@@ -1055,10 +1055,10 @@ TEST_P(HpackDecoderAdapterTest, ReuseNameOfEvictedEntry) {
hbb.AppendDynamicTableSizeUpdate(0);
hbb.AppendDynamicTableSizeUpdate(63);
- const quiche::QuicheStringPiece name("some-name");
- const quiche::QuicheStringPiece value1("some-value");
- const quiche::QuicheStringPiece value2("another-value");
- const quiche::QuicheStringPiece value3("yet-another-value");
+ const absl::string_view name("some-name");
+ const absl::string_view value1("some-value");
+ const absl::string_view value2("another-value");
+ const absl::string_view value3("yet-another-value");
// Add an entry that will become the first in the dynamic table, entry 62.
hbb.AppendLiteralNameAndValue(HpackEntryType::kIndexedLiteralHeader, false,
@@ -1106,7 +1106,7 @@ TEST_P(HpackDecoderAdapterTest, ReuseNameOfEvictedEntry) {
EXPECT_EQ(expected_header_set, decoded_block());
if (start_choice_ == START_WITH_HANDLER) {
- EXPECT_EQ(handler_.header_bytes_parsed(),
+ EXPECT_EQ(handler_.uncompressed_header_bytes(),
6 * name.size() + 2 * value1.size() + 2 * value2.size() +
2 * value3.size());
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.cc
index 71b94a37f3f..c0d2ec6f8c8 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.cc
@@ -8,6 +8,7 @@
#include <limits>
#include <utility>
+#include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_encoder.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h"
@@ -57,12 +58,10 @@ class HpackEncoder::RepresentationIterator {
namespace {
// The default header listener.
-void NoOpListener(quiche::QuicheStringPiece /*name*/,
- quiche::QuicheStringPiece /*value*/) {}
+void NoOpListener(absl::string_view /*name*/, absl::string_view /*value*/) {}
// The default HPACK indexing policy.
-bool DefaultPolicy(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece /* value */) {
+bool DefaultPolicy(absl::string_view name, absl::string_view /* value */) {
if (name.empty()) {
return false;
}
@@ -77,14 +76,16 @@ bool DefaultPolicy(quiche::QuicheStringPiece name,
} // namespace
-HpackEncoder::HpackEncoder(const HpackHuffmanTable& table)
+HpackEncoder::HpackEncoder()
: output_stream_(),
- huffman_table_(table),
+ huffman_table_(ObtainHpackHuffmanTable()),
min_table_size_setting_received_(std::numeric_limits<size_t>::max()),
listener_(NoOpListener),
should_index_(DefaultPolicy),
enable_compression_(true),
- should_emit_table_size_(false) {}
+ should_emit_table_size_(false),
+ use_fast_huffman_encoder_(
+ GetSpdyReloadableFlag(http2_use_fast_huffman_encoder)) {}
HpackEncoder::~HpackEncoder() = default;
@@ -197,15 +198,24 @@ void HpackEncoder::EmitLiteral(const Representation& representation) {
EmitString(representation.second);
}
-void HpackEncoder::EmitString(quiche::QuicheStringPiece str) {
+void HpackEncoder::EmitString(absl::string_view str) {
size_t encoded_size =
- enable_compression_ ? huffman_table_.EncodedSize(str) : str.size();
+ enable_compression_
+ ? (use_fast_huffman_encoder_ ? http2::HuffmanSize(str)
+ : huffman_table_.EncodedSize(str))
+ : str.size();
if (encoded_size < str.size()) {
SPDY_DVLOG(2) << "Emitted Huffman-encoded string of length "
<< encoded_size;
output_stream_.AppendPrefix(kStringLiteralHuffmanEncoded);
output_stream_.AppendUint32(encoded_size);
- huffman_table_.EncodeString(str, &output_stream_);
+ if (use_fast_huffman_encoder_) {
+ SPDY_CODE_COUNT(http2_use_fast_huffman_encoder);
+ http2::HuffmanEncodeFast(str, encoded_size,
+ output_stream_.MutableString());
+ } else {
+ huffman_table_.EncodeString(str, &output_stream_);
+ }
} else {
SPDY_DVLOG(2) << "Emitted literal string of length " << str.size();
output_stream_.AppendPrefix(kStringLiteralIdentityEncoded);
@@ -238,21 +248,19 @@ void HpackEncoder::CookieToCrumbs(const Representation& cookie,
// See Section 8.1.2.5. "Compressing the Cookie Header Field" in the HTTP/2
// specification at https://tools.ietf.org/html/draft-ietf-httpbis-http2-14.
// Cookie values are split into individually-encoded HPACK representations.
- quiche::QuicheStringPiece cookie_value = cookie.second;
+ absl::string_view cookie_value = cookie.second;
// Consume leading and trailing whitespace if present.
- quiche::QuicheStringPiece::size_type first =
- cookie_value.find_first_not_of(" \t");
- quiche::QuicheStringPiece::size_type last =
- cookie_value.find_last_not_of(" \t");
- if (first == quiche::QuicheStringPiece::npos) {
- cookie_value = quiche::QuicheStringPiece();
+ absl::string_view::size_type first = cookie_value.find_first_not_of(" \t");
+ absl::string_view::size_type last = cookie_value.find_last_not_of(" \t");
+ if (first == absl::string_view::npos) {
+ cookie_value = absl::string_view();
} else {
cookie_value = cookie_value.substr(first, (last - first) + 1);
}
for (size_t pos = 0;;) {
size_t end = cookie_value.find(";", pos);
- if (end == quiche::QuicheStringPiece::npos) {
+ if (end == absl::string_view::npos) {
out->push_back(std::make_pair(cookie.first, cookie_value.substr(pos)));
break;
}
@@ -272,12 +280,12 @@ void HpackEncoder::DecomposeRepresentation(const Representation& header_field,
Representations* out) {
size_t pos = 0;
size_t end = 0;
- while (end != quiche::QuicheStringPiece::npos) {
+ while (end != absl::string_view::npos) {
end = header_field.second.find('\0', pos);
out->push_back(std::make_pair(
header_field.first,
header_field.second.substr(
- pos, end == quiche::QuicheStringPiece::npos ? end : end - pos)));
+ pos, end == absl::string_view::npos ? end : end - pos)));
pos = end + 1;
}
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h
index 534b9e6c086..f9cc0d10f10 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h
@@ -14,8 +14,8 @@
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
@@ -33,23 +33,20 @@ class HpackEncoderPeer;
class QUICHE_EXPORT_PRIVATE HpackEncoder {
public:
- using Representation =
- std::pair<quiche::QuicheStringPiece, quiche::QuicheStringPiece>;
+ using Representation = std::pair<absl::string_view, absl::string_view>;
using Representations = std::vector<Representation>;
// Callers may provide a HeaderListener to be informed of header name-value
// pairs processed by this encoder.
using HeaderListener =
- std::function<void(quiche::QuicheStringPiece, quiche::QuicheStringPiece)>;
+ std::function<void(absl::string_view, absl::string_view)>;
// An indexing policy should return true if the provided header name-value
// pair should be inserted into the HPACK dynamic table.
using IndexingPolicy =
- std::function<bool(quiche::QuicheStringPiece, quiche::QuicheStringPiece)>;
+ std::function<bool(absl::string_view, absl::string_view)>;
- // |table| is an initialized HPACK Huffman table, having an
- // externally-managed lifetime which spans beyond HpackEncoder.
- explicit HpackEncoder(const HpackHuffmanTable& table);
+ HpackEncoder();
HpackEncoder(const HpackEncoder&) = delete;
HpackEncoder& operator=(const HpackEncoder&) = delete;
~HpackEncoder();
@@ -127,7 +124,7 @@ class QUICHE_EXPORT_PRIVATE HpackEncoder {
void EmitLiteral(const Representation& representation);
// Emits a Huffman or identity string (whichever is smaller).
- void EmitString(quiche::QuicheStringPiece str);
+ void EmitString(absl::string_view str);
// Emits the current dynamic table size if the table size was recently
// updated and we have not yet emitted it (Section 6.3).
@@ -150,6 +147,8 @@ class QUICHE_EXPORT_PRIVATE HpackEncoder {
IndexingPolicy should_index_;
bool enable_compression_;
bool should_emit_table_size_;
+ // Latched value of gfe2_reloadable_flag_http2_use_fast_huffman_encoder.
+ const bool use_fast_huffman_encoder_;
};
} // namespace spdy
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder_test.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder_test.cc
index f6f9f87a1c0..52693dbbab4 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_encoder_test.cc
@@ -5,8 +5,9 @@
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h"
#include <cstdint>
-#include <map>
+#include <utility>
+#include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_encoder.h"
#include "net/third_party/quiche/src/http2/test_tools/http2_random.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h"
@@ -39,15 +40,12 @@ class HpackEncoderPeer {
bool compression_enabled() const { return encoder_->enable_compression_; }
HpackHeaderTable* table() { return &encoder_->header_table_; }
HpackHeaderTablePeer table_peer() { return HpackHeaderTablePeer(table()); }
- const HpackHuffmanTable& huffman_table() const {
- return encoder_->huffman_table_;
- }
- void EmitString(quiche::QuicheStringPiece str) { encoder_->EmitString(str); }
+ void EmitString(absl::string_view str) { encoder_->EmitString(str); }
void TakeString(std::string* out) {
encoder_->output_stream_.TakeString(out);
}
- static void CookieToCrumbs(quiche::QuicheStringPiece cookie,
- std::vector<quiche::QuicheStringPiece>* out) {
+ static void CookieToCrumbs(absl::string_view cookie,
+ std::vector<absl::string_view>* out) {
Representations tmp;
HpackEncoder::CookieToCrumbs(std::make_pair("", cookie), &tmp);
@@ -56,9 +54,8 @@ class HpackEncoderPeer {
out->push_back(tmp[i].second);
}
}
- static void DecomposeRepresentation(
- quiche::QuicheStringPiece value,
- std::vector<quiche::QuicheStringPiece>* out) {
+ static void DecomposeRepresentation(absl::string_view value,
+ std::vector<absl::string_view>* out) {
Representations tmp;
HpackEncoder::DecomposeRepresentation(std::make_pair("foobar", value),
&tmp);
@@ -128,15 +125,17 @@ enum EncodeStrategy {
kRepresentations,
};
-class HpackEncoderTestBase : public QuicheTest {
+class HpackEncoderTest
+ : public QuicheTestWithParam<std::tuple<EncodeStrategy, bool>> {
protected:
typedef test::HpackEncoderPeer::Representations Representations;
- HpackEncoderTestBase()
- : encoder_(ObtainHpackHuffmanTable()),
- peer_(&encoder_),
+ HpackEncoderTest()
+ : peer_(&encoder_),
static_(peer_.table()->GetByIndex(1)),
- headers_storage_(1024 /* block size */) {}
+ headers_storage_(1024 /* block size */),
+ strategy_(std::get<0>(GetParam())),
+ use_fast_huffman_encoder_(std::get<1>(GetParam())) {}
void SetUp() override {
// Populate dynamic entries into the table fixture. For simplicity each
@@ -150,12 +149,11 @@ class HpackEncoderTestBase : public QuicheTest {
peer_.table()->SetMaxSize(peer_.table()->size());
}
- void SaveHeaders(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
- quiche::QuicheStringPiece n(
- headers_storage_.Memdup(name.data(), name.size()), name.size());
- quiche::QuicheStringPiece v(
- headers_storage_.Memdup(value.data(), value.size()), value.size());
+ void SaveHeaders(absl::string_view name, absl::string_view value) {
+ absl::string_view n(headers_storage_.Memdup(name.data(), name.size()),
+ name.size());
+ absl::string_view v(headers_storage_.Memdup(value.data(), value.size()),
+ value.size());
headers_observed_.push_back(std::make_pair(n, v));
}
@@ -164,40 +162,45 @@ class HpackEncoderTestBase : public QuicheTest {
expected_.AppendUint32(index);
}
void ExpectIndexedLiteral(const HpackEntry* key_entry,
- quiche::QuicheStringPiece value) {
+ absl::string_view value) {
expected_.AppendPrefix(kLiteralIncrementalIndexOpcode);
expected_.AppendUint32(IndexOf(key_entry));
ExpectString(&expected_, value);
}
- void ExpectIndexedLiteral(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ void ExpectIndexedLiteral(absl::string_view name, absl::string_view value) {
expected_.AppendPrefix(kLiteralIncrementalIndexOpcode);
expected_.AppendUint32(0);
ExpectString(&expected_, name);
ExpectString(&expected_, value);
}
- void ExpectNonIndexedLiteral(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ void ExpectNonIndexedLiteral(absl::string_view name,
+ absl::string_view value) {
expected_.AppendPrefix(kLiteralNoIndexOpcode);
expected_.AppendUint32(0);
ExpectString(&expected_, name);
ExpectString(&expected_, value);
}
void ExpectNonIndexedLiteralWithNameIndex(const HpackEntry* key_entry,
- quiche::QuicheStringPiece value) {
+ absl::string_view value) {
expected_.AppendPrefix(kLiteralNoIndexOpcode);
expected_.AppendUint32(IndexOf(key_entry));
ExpectString(&expected_, value);
}
- void ExpectString(HpackOutputStream* stream, quiche::QuicheStringPiece str) {
- const HpackHuffmanTable& huffman_table = peer_.huffman_table();
- size_t encoded_size = peer_.compression_enabled()
- ? huffman_table.EncodedSize(str)
- : str.size();
+ void ExpectString(HpackOutputStream* stream, absl::string_view str) {
+ const HpackHuffmanTable& huffman_table = ObtainHpackHuffmanTable();
+ size_t encoded_size =
+ peer_.compression_enabled()
+ ? (use_fast_huffman_encoder_ ? http2::HuffmanSize(str)
+ : huffman_table.EncodedSize(str))
+ : str.size();
if (encoded_size < str.size()) {
expected_.AppendPrefix(kStringLiteralHuffmanEncoded);
expected_.AppendUint32(encoded_size);
- huffman_table.EncodeString(str, stream);
+ if (use_fast_huffman_encoder_) {
+ http2::HuffmanEncodeFast(str, encoded_size, stream->MutableString());
+ } else {
+ huffman_table.EncodeString(str, stream);
+ }
} else {
expected_.AppendPrefix(kStringLiteralIdentityEncoded);
expected_.AppendUint32(str.size());
@@ -255,25 +258,32 @@ class HpackEncoderTestBase : public QuicheTest {
const HpackEntry* cookie_c_;
SpdySimpleArena headers_storage_;
- std::vector<std::pair<quiche::QuicheStringPiece, quiche::QuicheStringPiece>>
+ std::vector<std::pair<absl::string_view, absl::string_view>>
headers_observed_;
HpackOutputStream expected_;
- EncodeStrategy strategy_ = kDefault;
+ const EncodeStrategy strategy_;
+ const bool use_fast_huffman_encoder_;
};
-TEST_F(HpackEncoderTestBase, EncodeRepresentations) {
+using HpackEncoderTestWithDefaultStrategy = HpackEncoderTest;
+
+INSTANTIATE_TEST_SUITE_P(HpackEncoderTests,
+ HpackEncoderTestWithDefaultStrategy,
+ ::testing::Combine(::testing::Values(kDefault),
+ ::testing::Bool()));
+
+TEST_P(HpackEncoderTestWithDefaultStrategy, EncodeRepresentations) {
encoder_.SetHeaderListener(
- [this](quiche::QuicheStringPiece name, quiche::QuicheStringPiece value) {
+ [this](absl::string_view name, absl::string_view value) {
this->SaveHeaders(name, value);
});
- const std::vector<
- std::pair<quiche::QuicheStringPiece, quiche::QuicheStringPiece>>
+ const std::vector<std::pair<absl::string_view, absl::string_view>>
header_list = {{"cookie", "val1; val2;val3"},
{":path", "/home"},
{"accept", "text/html, text/plain,application/xml"},
{"cookie", "val4"},
- {"withnul", quiche::QuicheStringPiece("one\0two", 7)}};
+ {"withnul", absl::string_view("one\0two", 7)}};
ExpectNonIndexedLiteralWithNameIndex(peer_.table()->GetByName(":path"),
"/home");
ExpectIndexedLiteral(peer_.table()->GetByName("cookie"), "val1");
@@ -282,7 +292,7 @@ TEST_F(HpackEncoderTestBase, EncodeRepresentations) {
ExpectIndexedLiteral(peer_.table()->GetByName("accept"),
"text/html, text/plain,application/xml");
ExpectIndexedLiteral(peer_.table()->GetByName("cookie"), "val4");
- ExpectIndexedLiteral("withnul", quiche::QuicheStringPiece("one\0two", 7));
+ ExpectIndexedLiteral("withnul", absl::string_view("one\0two", 7));
CompareWithExpectedEncoding(header_list);
EXPECT_THAT(
@@ -291,27 +301,19 @@ TEST_F(HpackEncoderTestBase, EncodeRepresentations) {
Pair("cookie", "val2"), Pair("cookie", "val3"),
Pair("accept", "text/html, text/plain,application/xml"),
Pair("cookie", "val4"),
- Pair("withnul", quiche::QuicheStringPiece("one\0two", 7))));
+ Pair("withnul", absl::string_view("one\0two", 7))));
}
-class HpackEncoderTest : public HpackEncoderTestBase,
- public ::testing::WithParamInterface<EncodeStrategy> {
- protected:
- void SetUp() override {
- strategy_ = GetParam();
- HpackEncoderTestBase::SetUp();
- }
-};
-
INSTANTIATE_TEST_SUITE_P(HpackEncoderTests,
HpackEncoderTest,
- ::testing::Values(kDefault,
- kIncremental,
- kRepresentations));
+ ::testing::Combine(::testing::Values(kDefault,
+ kIncremental,
+ kRepresentations),
+ ::testing::Bool()));
TEST_P(HpackEncoderTest, SingleDynamicIndex) {
encoder_.SetHeaderListener(
- [this](quiche::QuicheStringPiece name, quiche::QuicheStringPiece value) {
+ [this](absl::string_view name, absl::string_view value) {
this->SaveHeaders(name, value);
});
@@ -432,7 +434,7 @@ TEST_P(HpackEncoderTest, StringsDynamicallySelectHuffmanCoding) {
TEST_P(HpackEncoderTest, EncodingWithoutCompression) {
encoder_.SetHeaderListener(
- [this](quiche::QuicheStringPiece name, quiche::QuicheStringPiece value) {
+ [this](absl::string_view name, absl::string_view value) {
this->SaveHeaders(name, value);
});
encoder_.DisableCompression();
@@ -460,11 +462,10 @@ TEST_P(HpackEncoderTest, EncodingWithoutCompression) {
if (strategy_ == kRepresentations) {
EXPECT_THAT(
headers_observed_,
- ElementsAre(
- Pair(":path", "/index.html"), Pair("cookie", "foo=bar"),
- Pair("cookie", "baz=bing"),
- Pair("hello", quiche::QuicheStringPiece("goodbye\0aloha", 13)),
- Pair("multivalue", "value1, value2")));
+ ElementsAre(Pair(":path", "/index.html"), Pair("cookie", "foo=bar"),
+ Pair("cookie", "baz=bing"),
+ Pair("hello", absl::string_view("goodbye\0aloha", 13)),
+ Pair("multivalue", "value1, value2")));
} else {
EXPECT_THAT(
headers_observed_,
@@ -477,7 +478,7 @@ TEST_P(HpackEncoderTest, EncodingWithoutCompression) {
TEST_P(HpackEncoderTest, MultipleEncodingPasses) {
encoder_.SetHeaderListener(
- [this](quiche::QuicheStringPiece name, quiche::QuicheStringPiece value) {
+ [this](absl::string_view name, absl::string_view value) {
this->SaveHeaders(name, value);
});
@@ -574,7 +575,7 @@ TEST_P(HpackEncoderTest, PseudoHeadersFirst) {
TEST_P(HpackEncoderTest, CookieToCrumbs) {
test::HpackEncoderPeer peer(nullptr);
- std::vector<quiche::QuicheStringPiece> out;
+ std::vector<absl::string_view> out;
// Leading and trailing whitespace is consumed. A space after ';' is consumed.
// All other spaces remain. ';' at beginning and end of string produce empty
@@ -608,7 +609,7 @@ TEST_P(HpackEncoderTest, CookieToCrumbs) {
TEST_P(HpackEncoderTest, DecomposeRepresentation) {
test::HpackEncoderPeer peer(nullptr);
- std::vector<quiche::QuicheStringPiece> out;
+ std::vector<absl::string_view> out;
peer.DecomposeRepresentation("", &out);
EXPECT_THAT(out, ElementsAre(""));
@@ -616,19 +617,16 @@ TEST_P(HpackEncoderTest, DecomposeRepresentation) {
peer.DecomposeRepresentation("foobar", &out);
EXPECT_THAT(out, ElementsAre("foobar"));
- peer.DecomposeRepresentation(quiche::QuicheStringPiece("foo\0bar", 7), &out);
+ peer.DecomposeRepresentation(absl::string_view("foo\0bar", 7), &out);
EXPECT_THAT(out, ElementsAre("foo", "bar"));
- peer.DecomposeRepresentation(quiche::QuicheStringPiece("\0foo\0bar", 8),
- &out);
+ peer.DecomposeRepresentation(absl::string_view("\0foo\0bar", 8), &out);
EXPECT_THAT(out, ElementsAre("", "foo", "bar"));
- peer.DecomposeRepresentation(quiche::QuicheStringPiece("foo\0bar\0", 8),
- &out);
+ peer.DecomposeRepresentation(absl::string_view("foo\0bar\0", 8), &out);
EXPECT_THAT(out, ElementsAre("foo", "bar", ""));
- peer.DecomposeRepresentation(quiche::QuicheStringPiece("\0foo\0bar\0", 9),
- &out);
+ peer.DecomposeRepresentation(absl::string_view("\0foo\0bar\0", 9), &out);
EXPECT_THAT(out, ElementsAre("", "foo", "bar", ""));
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_entry.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_entry.cc
index 586f3216d24..7f251e6e1ff 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_entry.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_entry.cc
@@ -12,8 +12,8 @@ namespace spdy {
const size_t HpackEntry::kSizeOverhead = 32;
-HpackEntry::HpackEntry(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value,
+HpackEntry::HpackEntry(absl::string_view name,
+ absl::string_view value,
bool is_static,
size_t insertion_index)
: name_(name.data(), name.size()),
@@ -24,8 +24,7 @@ HpackEntry::HpackEntry(quiche::QuicheStringPiece name,
type_(is_static ? STATIC : DYNAMIC),
time_added_(0) {}
-HpackEntry::HpackEntry(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value)
+HpackEntry::HpackEntry(absl::string_view name, absl::string_view value)
: name_ref_(name),
value_ref_(value),
insertion_index_(0),
@@ -44,8 +43,8 @@ HpackEntry::HpackEntry(const HpackEntry& other)
} else {
name_ = other.name_;
value_ = other.value_;
- name_ref_ = quiche::QuicheStringPiece(name_.data(), name_.size());
- value_ref_ = quiche::QuicheStringPiece(value_.data(), value_.size());
+ name_ref_ = absl::string_view(name_.data(), name_.size());
+ value_ref_ = absl::string_view(value_.data(), value_.size());
}
}
@@ -61,16 +60,15 @@ HpackEntry& HpackEntry::operator=(const HpackEntry& other) {
}
name_ = other.name_;
value_ = other.value_;
- name_ref_ = quiche::QuicheStringPiece(name_.data(), name_.size());
- value_ref_ = quiche::QuicheStringPiece(value_.data(), value_.size());
+ name_ref_ = absl::string_view(name_.data(), name_.size());
+ value_ref_ = absl::string_view(value_.data(), value_.size());
return *this;
}
HpackEntry::~HpackEntry() = default;
// static
-size_t HpackEntry::Size(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+size_t HpackEntry::Size(absl::string_view name, absl::string_view value) {
return name.size() + value.size() + kSizeOverhead;
}
size_t HpackEntry::Size() const {
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_entry.h b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_entry.h
index 750c7e61782..e9c4efcfc96 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_entry.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_entry.h
@@ -9,8 +9,8 @@
#include <cstdint>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
// All section references below are to
// http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-08
@@ -34,15 +34,15 @@ class QUICHE_EXPORT_PRIVATE HpackEntry {
// The combination of |is_static| and |insertion_index| allows an
// HpackEntryTable to determine the index of an HpackEntry in O(1) time.
// Copies |name| and |value|.
- HpackEntry(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value,
+ HpackEntry(absl::string_view name,
+ absl::string_view value,
bool is_static,
size_t insertion_index);
// Create a 'lookup' entry (only) suitable for querying a HpackEntrySet. The
// instance InsertionIndex() always returns 0 and IsLookup() returns true.
// The memory backing |name| and |value| must outlive this object.
- HpackEntry(quiche::QuicheStringPiece name, quiche::QuicheStringPiece value);
+ HpackEntry(absl::string_view name, absl::string_view value);
HpackEntry(const HpackEntry& other);
HpackEntry& operator=(const HpackEntry& other);
@@ -53,8 +53,8 @@ class QUICHE_EXPORT_PRIVATE HpackEntry {
~HpackEntry();
- quiche::QuicheStringPiece name() const { return name_ref_; }
- quiche::QuicheStringPiece value() const { return value_ref_; }
+ absl::string_view name() const { return name_ref_; }
+ absl::string_view value() const { return value_ref_; }
// Returns whether this entry is a member of the static (as opposed to
// dynamic) table.
@@ -67,8 +67,7 @@ class QUICHE_EXPORT_PRIVATE HpackEntry {
size_t InsertionIndex() const { return insertion_index_; }
// Returns the size of an entry as defined in 5.1.
- static size_t Size(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value);
+ static size_t Size(absl::string_view name, absl::string_view value);
size_t Size() const;
std::string GetDebugString() const;
@@ -92,8 +91,8 @@ class QUICHE_EXPORT_PRIVATE HpackEntry {
// These members are always valid. For DYNAMIC and STATIC entries, they
// always point to |name_| and |value_|.
- quiche::QuicheStringPiece name_ref_;
- quiche::QuicheStringPiece value_ref_;
+ absl::string_view name_ref_;
+ absl::string_view value_ref_;
// The entry's index in the total set of entries ever inserted into the header
// table.
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.cc
index 67a0a5f443f..8adbf43aad3 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_static_table.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h"
@@ -60,7 +61,7 @@ const HpackEntry* HpackHeaderTable::GetByIndex(size_t index) {
return nullptr;
}
-const HpackEntry* HpackHeaderTable::GetByName(quiche::QuicheStringPiece name) {
+const HpackEntry* HpackHeaderTable::GetByName(absl::string_view name) {
{
auto it = static_name_index_.find(name);
if (it != static_name_index_.end()) {
@@ -80,9 +81,8 @@ const HpackEntry* HpackHeaderTable::GetByName(quiche::QuicheStringPiece name) {
return nullptr;
}
-const HpackEntry* HpackHeaderTable::GetByNameAndValue(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+const HpackEntry* HpackHeaderTable::GetByNameAndValue(absl::string_view name,
+ absl::string_view value) {
HpackEntry query(name, value);
{
auto it = static_index_.find(&query);
@@ -128,8 +128,8 @@ void HpackHeaderTable::SetSettingsHeaderTableSize(size_t settings_size) {
SetMaxSize(settings_size_bound_);
}
-void HpackHeaderTable::EvictionSet(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value,
+void HpackHeaderTable::EvictionSet(absl::string_view name,
+ absl::string_view value,
EntryTable::iterator* begin_out,
EntryTable::iterator* end_out) {
size_t eviction_count = EvictionCountForEntry(name, value);
@@ -137,9 +137,8 @@ void HpackHeaderTable::EvictionSet(quiche::QuicheStringPiece name,
*end_out = dynamic_entries_.end();
}
-size_t HpackHeaderTable::EvictionCountForEntry(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) const {
+size_t HpackHeaderTable::EvictionCountForEntry(absl::string_view name,
+ absl::string_view value) const {
size_t available_size = max_size_ - size_;
size_t entry_size = HpackEntry::Size(name, value);
@@ -185,9 +184,8 @@ void HpackHeaderTable::Evict(size_t count) {
}
}
-const HpackEntry* HpackHeaderTable::TryAddEntry(
- quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+const HpackEntry* HpackHeaderTable::TryAddEntry(absl::string_view name,
+ absl::string_view value) {
Evict(EvictionCountForEntry(name, value));
size_t entry_size = HpackEntry::Size(name, value);
@@ -255,7 +253,7 @@ void HpackHeaderTable::DebugLogTableState() const {
SPDY_DVLOG(2) << " " << entry->GetDebugString();
}
SPDY_DVLOG(2) << "Full Static Name Index:";
- for (const auto it : static_name_index_) {
+ for (const auto& it : static_name_index_) {
SPDY_DVLOG(2) << " " << it.first << ": " << it.second->GetDebugString();
}
SPDY_DVLOG(2) << "Full Dynamic Index:";
@@ -263,7 +261,7 @@ void HpackHeaderTable::DebugLogTableState() const {
SPDY_DVLOG(2) << " " << entry->GetDebugString();
}
SPDY_DVLOG(2) << "Full Dynamic Name Index:";
- for (const auto it : dynamic_name_index_) {
+ for (const auto& it : dynamic_name_index_) {
SPDY_DVLOG(2) << " " << it.first << ": " << it.second->GetDebugString();
}
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h
index 88ef6d7b73a..f835ae72874 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h
@@ -10,8 +10,9 @@
#include <deque>
#include <memory>
+#include "absl/hash/hash.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_entry.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_macros.h"
@@ -67,9 +68,9 @@ class QUICHE_EXPORT_PRIVATE HpackHeaderTable {
bool operator()(const HpackEntry* lhs, const HpackEntry* rhs) const;
};
using UnorderedEntrySet = SpdyHashSet<HpackEntry*, EntryHasher, EntriesEq>;
- using NameToEntryMap = SpdyHashMap<quiche::QuicheStringPiece,
+ using NameToEntryMap = SpdyHashMap<absl::string_view,
const HpackEntry*,
- quiche::QuicheStringPieceHash>;
+ absl::Hash<absl::string_view>>;
HpackHeaderTable();
HpackHeaderTable(const HpackHeaderTable&) = delete;
@@ -89,11 +90,11 @@ class QUICHE_EXPORT_PRIVATE HpackHeaderTable {
const HpackEntry* GetByIndex(size_t index);
// Returns the lowest-value entry having |name|, or NULL.
- const HpackEntry* GetByName(quiche::QuicheStringPiece name);
+ const HpackEntry* GetByName(absl::string_view name);
// Returns the lowest-index matching entry, or NULL.
- const HpackEntry* GetByNameAndValue(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value);
+ const HpackEntry* GetByNameAndValue(absl::string_view name,
+ absl::string_view value);
// Returns the index of an entry within this header table.
size_t IndexOf(const HpackEntry* entry) const;
@@ -109,8 +110,8 @@ class QUICHE_EXPORT_PRIVATE HpackHeaderTable {
// Determine the set of entries which would be evicted by the insertion
// of |name| & |value| into the table, as per section 4.4. No eviction
// actually occurs. The set is returned via range [begin_out, end_out).
- void EvictionSet(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value,
+ void EvictionSet(absl::string_view name,
+ absl::string_view value,
EntryTable::iterator* begin_out,
EntryTable::iterator* end_out);
@@ -118,8 +119,8 @@ class QUICHE_EXPORT_PRIVATE HpackHeaderTable {
// and |value| must not be owned by an entry which could be evicted. The
// added HpackEntry is returned, or NULL is returned if all entries were
// evicted and the empty table is of insufficent size for the representation.
- const HpackEntry* TryAddEntry(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value);
+ const HpackEntry* TryAddEntry(absl::string_view name,
+ absl::string_view value);
void DebugLogTableState() const SPDY_UNUSED;
@@ -132,8 +133,8 @@ class QUICHE_EXPORT_PRIVATE HpackHeaderTable {
private:
// Returns number of evictions required to enter |name| & |value|.
- size_t EvictionCountForEntry(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) const;
+ size_t EvictionCountForEntry(absl::string_view name,
+ absl::string_view value) const;
// Returns number of evictions required to reclaim |reclaim_size| table size.
size_t EvictionCountToReclaim(size_t reclaim_size) const;
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table_test.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table_test.cc
index cc5674f137f..0b6799eb958 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_header_table_test.cc
@@ -33,8 +33,8 @@ class HpackHeaderTablePeer {
size_t index_size() {
return table_->static_index_.size() + table_->dynamic_index_.size();
}
- std::vector<HpackEntry*> EvictionSet(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ std::vector<HpackEntry*> EvictionSet(absl::string_view name,
+ absl::string_view value) {
HpackHeaderTable::EntryTable::iterator begin, end;
table_->EvictionSet(name, value, &begin, &end);
std::vector<HpackEntry*> result;
@@ -45,8 +45,8 @@ class HpackHeaderTablePeer {
}
size_t total_insertions() { return table_->total_insertions_; }
size_t dynamic_entries_count() { return table_->dynamic_entries_.size(); }
- size_t EvictionCountForEntry(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ size_t EvictionCountForEntry(absl::string_view name,
+ absl::string_view value) {
return table_->EvictionCountForEntry(name, value);
}
size_t EvictionCountToReclaim(size_t reclaim_size) {
@@ -54,8 +54,7 @@ class HpackHeaderTablePeer {
}
void Evict(size_t count) { return table_->Evict(count); }
- void AddDynamicEntry(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ void AddDynamicEntry(absl::string_view name, absl::string_view value) {
table_->dynamic_entries_.push_back(
HpackEntry(name, value, false, table_->total_insertions_++));
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.cc
index eb799d08728..aac6d1b8d10 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.cc
@@ -96,7 +96,7 @@ bool HpackHuffmanTable::IsInitialized() const {
return !code_by_id_.empty();
}
-void HpackHuffmanTable::EncodeString(quiche::QuicheStringPiece in,
+void HpackHuffmanTable::EncodeString(absl::string_view in,
HpackOutputStream* out) const {
size_t bit_remnant = 0;
for (size_t i = 0; i != in.size(); i++) {
@@ -129,7 +129,7 @@ void HpackHuffmanTable::EncodeString(quiche::QuicheStringPiece in,
}
}
-size_t HpackHuffmanTable::EncodedSize(quiche::QuicheStringPiece in) const {
+size_t HpackHuffmanTable::EncodedSize(absl::string_view in) const {
size_t bit_count = 0;
for (size_t i = 0; i != in.size(); i++) {
uint16_t symbol_id = static_cast<uint8_t>(in[i]);
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h
index b7c264933b3..81af770afb5 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h
@@ -9,8 +9,8 @@
#include <cstdint>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
namespace spdy {
@@ -45,10 +45,10 @@ class QUICHE_EXPORT_PRIVATE HpackHuffmanTable {
// Encodes the input string to the output stream using the table's Huffman
// context.
- void EncodeString(quiche::QuicheStringPiece in, HpackOutputStream* out) const;
+ void EncodeString(absl::string_view in, HpackOutputStream* out) const;
// Returns the encoded size of the input string.
- size_t EncodedSize(quiche::QuicheStringPiece in) const;
+ size_t EncodedSize(absl::string_view in) const;
// Returns the estimate of dynamically allocated memory in bytes.
size_t EstimateMemoryUsage() const;
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table_benchmark.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table_benchmark.cc
deleted file mode 100644
index aeea7268965..00000000000
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table_benchmark.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2020 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.
-
-//
-// $ blaze run -c opt --dynamic_mode=off \
-// -- //net/third_party/quiche/src/spdy/core/hpack:hpack_huffman_table_benchmark \
-// --benchmarks=all --benchmark_memory_usage --benchmark_repetitions=1
-//
-// Benchmark Time(ns) CPU(ns) Allocs Iterations
-// -----------------------------------------------------------------------------
-// BM_EncodeSmallStrings 463 441 0 100000 0.000B peak-mem
-// BM_EncodeLargeString/1k 9003 9069 5 4861 1.125kB peak-mem
-// BM_EncodeLargeString/4k 34808 35157 7 1597 4.500kB peak-mem
-// BM_EncodeLargeString/32k 275973 270741 10 207 36.000kB peak-mem
-// BM_EncodeLargeString/256k 2234748 2236850 13 29 288.000kB peak-mem
-// BM_EncodeLargeString/2M 18248449 18717995 16 3 2.250MB peak-mem
-// BM_EncodeLargeString/16M 144944895 144415061 19 1 18.000MB peak-mem
-// BM_EncodeLargeString/128M 1200907841 1207238809 86 1 144.009MB peak-mem
-//
-
-#include <string>
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Weverything"
-// This header has multiple DCHECK_* macros with signed-unsigned comparison.
-#include "testing/base/public/benchmark.h"
-#pragma clang diagnostic pop
-
-#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
-#include "net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h"
-#include "net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h"
-
-namespace spdy {
-namespace {
-
-void BM_EncodeSmallStrings(benchmark::State& state) {
- const HpackHuffmanTable& table = ObtainHpackHuffmanTable();
- const std::vector<const std::string> inputs{
- ":method", ":path", "cookie", "set-cookie", "vary", "accept-encoding"};
- for (auto s : state) {
- for (const auto& input : inputs) {
- HpackOutputStream output_stream;
- table.EncodedSize(input);
- table.EncodeString(input, &output_stream);
- }
- }
-}
-
-void BM_EncodeLargeString(benchmark::State& state) {
- const HpackHuffmanTable& table = ObtainHpackHuffmanTable();
- const std::string input(state.range(0), 'a');
- for (auto s : state) {
- HpackOutputStream output_stream;
- table.EncodedSize(input);
- table.EncodeString(input, &output_stream);
- }
-}
-
-BENCHMARK(BM_EncodeSmallStrings);
-BENCHMARK(BM_EncodeLargeString)->Range(1024, 128 * 1024 * 1024);
-
-} // namespace
-} // namespace spdy
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table_test.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table_test.cc
index f49c73daab6..6c3e288ad20 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table_test.cc
@@ -7,8 +7,8 @@
#include <string>
#include <utility>
+#include "absl/base/macros.h"
#include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_decoder.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h"
@@ -42,7 +42,7 @@ class GenericHuffmanTableTest : public QuicheTest {
protected:
GenericHuffmanTableTest() : table_(), peer_(table_) {}
- std::string EncodeString(quiche::QuicheStringPiece input) {
+ std::string EncodeString(absl::string_view input) {
std::string result;
HpackOutputStream output_stream;
table_.EncodeString(input, &output_stream);
@@ -69,7 +69,7 @@ TEST_F(GenericHuffmanTableTest, InitializeEdgeCases) {
{0b11000000000000000000000000000000, 3, 6},
{0b11100000000000000000000000000000, 8, 7}};
HpackHuffmanTable table;
- EXPECT_TRUE(table.Initialize(code, QUICHE_ARRAYSIZE(code)));
+ EXPECT_TRUE(table.Initialize(code, ABSL_ARRAYSIZE(code)));
}
{
// But using 2 bits with one symbol overflows the code.
@@ -83,7 +83,7 @@ TEST_F(GenericHuffmanTableTest, InitializeEdgeCases) {
{0b11100000000000000000000000000000, 3, 6},
{0b00000000000000000000000000000000, 8, 7}}; // Overflow.
HpackHuffmanTable table;
- EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code)));
+ EXPECT_FALSE(table.Initialize(code, ABSL_ARRAYSIZE(code)));
EXPECT_EQ(7, HpackHuffmanTablePeer(table).failed_symbol_id());
}
{
@@ -93,7 +93,7 @@ TEST_F(GenericHuffmanTableTest, InitializeEdgeCases) {
{0b11000000000000000000000000000000, 3, 2},
{0b11100000000000000000000000000000, 8, 3}};
HpackHuffmanTable table;
- EXPECT_TRUE(table.Initialize(code, QUICHE_ARRAYSIZE(code)));
+ EXPECT_TRUE(table.Initialize(code, ABSL_ARRAYSIZE(code)));
}
{
// But repeating a length overflows the code.
@@ -103,7 +103,7 @@ TEST_F(GenericHuffmanTableTest, InitializeEdgeCases) {
{0b11000000000000000000000000000000, 2, 2},
{0b00000000000000000000000000000000, 8, 3}}; // Overflow.
HpackHuffmanTable table;
- EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code)));
+ EXPECT_FALSE(table.Initialize(code, ABSL_ARRAYSIZE(code)));
EXPECT_EQ(3, HpackHuffmanTablePeer(table).failed_symbol_id());
}
{
@@ -114,7 +114,7 @@ TEST_F(GenericHuffmanTableTest, InitializeEdgeCases) {
{0b11000000000000000000000000000000, 3, 1}, // Repeat.
{0b11100000000000000000000000000000, 8, 3}};
HpackHuffmanTable table;
- EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code)));
+ EXPECT_FALSE(table.Initialize(code, ABSL_ARRAYSIZE(code)));
EXPECT_EQ(2, HpackHuffmanTablePeer(table).failed_symbol_id());
}
{
@@ -124,7 +124,7 @@ TEST_F(GenericHuffmanTableTest, InitializeEdgeCases) {
{0b10100000000000000000000000000000, 4, 2},
{0b10110000000000000000000000000000, 8, 3}};
HpackHuffmanTable table;
- EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code)));
+ EXPECT_FALSE(table.Initialize(code, ABSL_ARRAYSIZE(code)));
EXPECT_EQ(0, HpackHuffmanTablePeer(table).failed_symbol_id());
}
{
@@ -135,7 +135,7 @@ TEST_F(GenericHuffmanTableTest, InitializeEdgeCases) {
{0b11000000000000000000000000000000, 2, 2}, // Code not canonical.
{0b10000000000000000000000000000000, 8, 3}};
HpackHuffmanTable table;
- EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code)));
+ EXPECT_FALSE(table.Initialize(code, ABSL_ARRAYSIZE(code)));
EXPECT_EQ(2, HpackHuffmanTablePeer(table).failed_symbol_id());
}
{
@@ -145,7 +145,7 @@ TEST_F(GenericHuffmanTableTest, InitializeEdgeCases) {
{0b11000000000000000000000000000000, 3, 2},
{0b11100000000000000000000000000000, 7, 3}};
HpackHuffmanTable table;
- EXPECT_FALSE(table.Initialize(code, QUICHE_ARRAYSIZE(code)));
+ EXPECT_FALSE(table.Initialize(code, ABSL_ARRAYSIZE(code)));
}
}
@@ -159,11 +159,11 @@ TEST_F(GenericHuffmanTableTest, ValidateInternalsWithSmallCode) {
{0b10001000000000000000000000000000, 5, 5}, // 6th.
{0b10011000000000000000000000000000, 8, 6}, // 8th.
{0b10010000000000000000000000000000, 5, 7}}; // 7th.
- EXPECT_TRUE(table_.Initialize(code, QUICHE_ARRAYSIZE(code)));
+ EXPECT_TRUE(table_.Initialize(code, ABSL_ARRAYSIZE(code)));
- ASSERT_EQ(QUICHE_ARRAYSIZE(code), peer_.code_by_id().size());
- ASSERT_EQ(QUICHE_ARRAYSIZE(code), peer_.length_by_id().size());
- for (size_t i = 0; i < QUICHE_ARRAYSIZE(code); ++i) {
+ ASSERT_EQ(ABSL_ARRAYSIZE(code), peer_.code_by_id().size());
+ ASSERT_EQ(ABSL_ARRAYSIZE(code), peer_.length_by_id().size());
+ for (size_t i = 0; i < ABSL_ARRAYSIZE(code); ++i) {
EXPECT_EQ(code[i].code, peer_.code_by_id()[i]);
EXPECT_EQ(code[i].length, peer_.length_by_id()[i]);
}
@@ -171,12 +171,10 @@ TEST_F(GenericHuffmanTableTest, ValidateInternalsWithSmallCode) {
EXPECT_EQ(0b10011000, peer_.pad_bits());
char input_storage[] = {2, 3, 2, 7, 4};
- quiche::QuicheStringPiece input(input_storage,
- QUICHE_ARRAYSIZE(input_storage));
+ absl::string_view input(input_storage, ABSL_ARRAYSIZE(input_storage));
// By symbol: (2) 00 (3) 010 (2) 00 (7) 10010 (4) 10000 (6 as pad) 1001100.
char expect_storage[] = {0b00010001, 0b00101000, 0b01001100};
- quiche::QuicheStringPiece expect(expect_storage,
- QUICHE_ARRAYSIZE(expect_storage));
+ absl::string_view expect(expect_storage, ABSL_ARRAYSIZE(expect_storage));
EXPECT_EQ(expect, EncodeString(input));
}
@@ -215,7 +213,7 @@ TEST_F(HpackHuffmanTableTest, SpecRequestExamples) {
"custom-value",
};
// Round-trip each test example.
- for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); i += 2) {
+ for (size_t i = 0; i != ABSL_ARRAYSIZE(test_table); i += 2) {
const std::string& encodedFixture(test_table[i]);
const std::string& decodedFixture(test_table[i + 1]);
DecodeString(encodedFixture, &buffer);
@@ -244,7 +242,7 @@ TEST_F(HpackHuffmanTableTest, SpecResponseExamples) {
"foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1",
};
// Round-trip each test example.
- for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); i += 2) {
+ for (size_t i = 0; i != ABSL_ARRAYSIZE(test_table); i += 2) {
const std::string& encodedFixture(test_table[i]);
const std::string& decodedFixture(test_table[i + 1]);
DecodeString(encodedFixture, &buffer);
@@ -258,7 +256,7 @@ TEST_F(HpackHuffmanTableTest, RoundTripIndividualSymbols) {
for (size_t i = 0; i != 256; i++) {
char c = static_cast<char>(i);
char storage[3] = {c, c, c};
- quiche::QuicheStringPiece input(storage, QUICHE_ARRAYSIZE(storage));
+ absl::string_view input(storage, ABSL_ARRAYSIZE(storage));
std::string buffer_in = EncodeString(input);
std::string buffer_out;
DecodeString(buffer_in, &buffer_out);
@@ -272,7 +270,7 @@ TEST_F(HpackHuffmanTableTest, RoundTripSymbolSequence) {
storage[i] = static_cast<char>(i);
storage[511 - i] = static_cast<char>(i);
}
- quiche::QuicheStringPiece input(storage, QUICHE_ARRAYSIZE(storage));
+ absl::string_view input(storage, ABSL_ARRAYSIZE(storage));
std::string buffer_in = EncodeString(input);
std::string buffer_out;
DecodeString(buffer_in, &buffer_out);
@@ -291,12 +289,12 @@ TEST_F(HpackHuffmanTableTest, EncodedSizeAgreesWithEncodeString) {
};
for (size_t i = 0; i != 256; ++i) {
// Expand last |test_table| entry to cover all codes.
- test_table[QUICHE_ARRAYSIZE(test_table) - 1][i] = static_cast<char>(i);
+ test_table[ABSL_ARRAYSIZE(test_table) - 1][i] = static_cast<char>(i);
}
HpackOutputStream output_stream;
std::string encoding;
- for (size_t i = 0; i != QUICHE_ARRAYSIZE(test_table); ++i) {
+ for (size_t i = 0; i != ABSL_ARRAYSIZE(test_table); ++i) {
table_.EncodeString(test_table[i], &output_stream);
output_stream.TakeString(&encoding);
EXPECT_EQ(encoding.size(), table_.EncodedSize(test_table[i]));
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.cc
index 5c2dd683f1c..a532f0b379e 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.cc
@@ -41,7 +41,7 @@ void HpackOutputStream::AppendPrefix(HpackPrefix prefix) {
AppendBits(prefix.bits, prefix.bit_size);
}
-void HpackOutputStream::AppendBytes(quiche::QuicheStringPiece buffer) {
+void HpackOutputStream::AppendBytes(absl::string_view buffer) {
DCHECK_EQ(bit_offset_, 0u);
buffer_.append(buffer.data(), buffer.size());
}
@@ -61,6 +61,12 @@ void HpackOutputStream::AppendUint32(uint32_t I) {
}
AppendBits(static_cast<uint8_t>(I), 8);
}
+ DCHECK_EQ(bit_offset_, 0u);
+}
+
+std::string* HpackOutputStream::MutableString() {
+ DCHECK_EQ(bit_offset_, 0u);
+ return &buffer_;
}
void HpackOutputStream::TakeString(std::string* output) {
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h
index f7e71f1fb2a..b94aa0c91c6 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h
@@ -9,8 +9,8 @@
#include <map>
#include <string>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
// All section references below are to
@@ -37,7 +37,7 @@ class QUICHE_EXPORT_PRIVATE HpackOutputStream {
void AppendPrefix(HpackPrefix prefix);
// Directly appends |buffer|.
- void AppendBytes(quiche::QuicheStringPiece buffer);
+ void AppendBytes(absl::string_view buffer);
// Appends the given integer using the representation described in
// 6.1. If the internal buffer ends on a byte boundary, the prefix
@@ -48,6 +48,9 @@ class QUICHE_EXPORT_PRIVATE HpackOutputStream {
// boundary after this function is called.
void AppendUint32(uint32_t I);
+ // Return pointer to internal buffer. |bit_offset_| needs to be zero.
+ std::string* MutableString();
+
// Swaps the internal buffer with |output|, then resets state.
void TakeString(std::string* output);
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream_test.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream_test.cc
index 21e6947de1c..20d320c902c 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream_test.cc
@@ -271,6 +271,20 @@ TEST(HpackOutputStreamTest, BoundedTakeString) {
EXPECT_EQ("\x10", str);
}
+TEST(HpackOutputStreamTest, MutableString) {
+ HpackOutputStream output_stream;
+
+ output_stream.AppendBytes("1");
+ output_stream.MutableString()->append("2");
+
+ output_stream.AppendBytes("foo");
+ output_stream.MutableString()->append("bar");
+
+ std::string str;
+ output_stream.TakeString(&str);
+ EXPECT_EQ("12foobar", str);
+}
+
} // namespace
} // namespace spdy
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_round_trip_test.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_round_trip_test.cc
index c4bf0371884..4b5dd5b395f 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_round_trip_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_round_trip_test.cc
@@ -24,8 +24,6 @@ enum InputSizeParam { ALL_INPUT, ONE_BYTE, ZERO_THEN_ONE_BYTE };
class HpackRoundTripTest : public QuicheTestWithParam<InputSizeParam> {
protected:
- HpackRoundTripTest() : encoder_(ObtainHpackHuffmanTable()), decoder_() {}
-
void SetUp() override {
// Use a small table size to tickle eviction handling.
encoder_.ApplyHeaderTableSizeSetting(256);
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_static_table.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_static_table.cc
index e8b07f1ccbc..c0815ce159b 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_static_table.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_static_table.cc
@@ -4,7 +4,7 @@
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_static_table.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_entry.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_estimate_memory_usage.h"
@@ -24,8 +24,8 @@ void HpackStaticTable::Initialize(const HpackStaticEntry* static_entry_table,
for (const HpackStaticEntry* it = static_entry_table;
it != static_entry_table + static_entry_count; ++it) {
static_entries_.push_back(
- HpackEntry(quiche::QuicheStringPiece(it->name, it->name_len),
- quiche::QuicheStringPiece(it->value, it->value_len),
+ HpackEntry(absl::string_view(it->name, it->name_len),
+ absl::string_view(it->value, it->value_len),
true, // is_static
total_insertions));
HpackEntry* entry = &static_entries_.back();
diff --git a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_static_table_test.cc b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_static_table_test.cc
index 42c62548224..36eb8315a2d 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_static_table_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/hpack/hpack_static_table_test.cc
@@ -7,7 +7,7 @@
#include <set>
#include <vector>
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
@@ -39,7 +39,7 @@ TEST_F(HpackStaticTableTest, Initialize) {
HpackHeaderTable::NameToEntryMap static_name_index =
table_.GetStaticNameIndex();
- std::set<quiche::QuicheStringPiece> names;
+ std::set<absl::string_view> names;
for (auto* entry : static_index) {
names.insert(entry->name());
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.cc b/chromium/net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.cc
index 8f62a93a734..1313c7d3bfc 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.cc
@@ -21,6 +21,7 @@
#include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder_listener.h"
#include "net/third_party/quiche/src/http2/http2_constants.h"
#include "net/third_party/quiche/src/http2/http2_structures.h"
+#include "net/third_party/quiche/src/common/quiche_endian.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h"
#include "net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h"
@@ -28,7 +29,6 @@
#include "net/third_party/quiche/src/spdy/core/spdy_headers_handler_interface.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_bug_tracker.h"
-#include "net/third_party/quiche/src/spdy/platform/api/spdy_endianness_util.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_estimate_memory_usage.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_flags.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h"
@@ -67,7 +67,7 @@ SpdyFrameType ToSpdyFrameType(Http2FrameType type) {
uint64_t ToSpdyPingId(const Http2PingFields& ping) {
uint64_t v;
std::memcpy(&v, ping.opaque_bytes, Http2PingFields::EncodedSize());
- return spdy::SpdyNetToHost64(v);
+ return quiche::QuicheEndian::NetToHost64(v);
}
// Overwrites the fields of the header with invalid values, for the purpose
diff --git a/chromium/net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h b/chromium/net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h
index 1ac20c28b76..89d7fdc011a 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h
@@ -11,10 +11,10 @@
#include <memory>
#include <string>
+#include "absl/strings/string_view.h"
+#include "absl/types/optional.h"
#include "net/third_party/quiche/src/http2/decoder/http2_frame_decoder.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_optional.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_header_table.h"
#include "net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h"
@@ -269,7 +269,7 @@ class QUICHE_EXPORT_PRIVATE Http2DecoderAdapter
// Amount of trailing padding. Currently used just as an indicator of whether
// OnPadLength has been called.
- quiche::QuicheOptional<size_t> opt_pad_length_;
+ absl::optional<size_t> opt_pad_length_;
// Temporary buffers for the AltSvc fields.
std::string alt_svc_origin_;
@@ -494,7 +494,7 @@ class QUICHE_EXPORT_PRIVATE SpdyFramerVisitorInterface {
// Called when an ALTSVC frame has been parsed.
virtual void OnAltSvc(
SpdyStreamId /*stream_id*/,
- quiche::QuicheStringPiece /*origin*/,
+ absl::string_view /*origin*/,
const SpdyAltSvcWireFormat::AlternativeServiceVector& /*altsvc_vector*/) {
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/mock_spdy_framer_visitor.h b/chromium/net/third_party/quiche/src/spdy/core/mock_spdy_framer_visitor.h
index e54c869212b..5faf2fb2da1 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/mock_spdy_framer_visitor.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/mock_spdy_framer_visitor.h
@@ -9,9 +9,10 @@
#include <memory>
#include <utility>
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
#include "net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h"
+#include "net/third_party/quiche/src/spdy/core/recording_headers_handler.h"
#include "net/third_party/quiche/src/spdy/core/spdy_test_utils.h"
namespace spdy {
@@ -90,7 +91,7 @@ class MockSpdyFramerVisitor : public SpdyFramerVisitorInterface {
void,
OnAltSvc,
(SpdyStreamId stream_id,
- quiche::QuicheStringPiece origin,
+ absl::string_view origin,
const SpdyAltSvcWireFormat::AlternativeServiceVector& altsvc_vector),
(override));
MOCK_METHOD(void,
@@ -117,7 +118,7 @@ class MockSpdyFramerVisitor : public SpdyFramerVisitorInterface {
SpdyHeadersHandlerInterface* ReturnTestHeadersHandler(
SpdyStreamId /* stream_id */) {
if (headers_handler_ == nullptr) {
- headers_handler_ = std::make_unique<TestHeadersHandler>();
+ headers_handler_ = std::make_unique<RecordingHeadersHandler>();
}
return headers_handler_.get();
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/recording_headers_handler.cc b/chromium/net/third_party/quiche/src/spdy/core/recording_headers_handler.cc
new file mode 100644
index 00000000000..02e5edeed2e
--- /dev/null
+++ b/chromium/net/third_party/quiche/src/spdy/core/recording_headers_handler.cc
@@ -0,0 +1,38 @@
+// Copyright (c) 2020 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/third_party/quiche/src/spdy/core/recording_headers_handler.h"
+
+namespace spdy {
+
+RecordingHeadersHandler::RecordingHeadersHandler(
+ SpdyHeadersHandlerInterface* wrapped)
+ : wrapped_(wrapped) {}
+
+void RecordingHeadersHandler::OnHeaderBlockStart() {
+ block_.clear();
+ if (wrapped_ != nullptr) {
+ wrapped_->OnHeaderBlockStart();
+ }
+}
+
+void RecordingHeadersHandler::OnHeader(absl::string_view key,
+ absl::string_view value) {
+ block_.AppendValueOrAddHeader(key, value);
+ if (wrapped_ != nullptr) {
+ wrapped_->OnHeader(key, value);
+ }
+}
+
+void RecordingHeadersHandler::OnHeaderBlockEnd(size_t uncompressed_header_bytes,
+ size_t compressed_header_bytes) {
+ uncompressed_header_bytes_ = uncompressed_header_bytes;
+ compressed_header_bytes_ = compressed_header_bytes;
+ if (wrapped_ != nullptr) {
+ wrapped_->OnHeaderBlockEnd(uncompressed_header_bytes,
+ compressed_header_bytes);
+ }
+}
+
+} // namespace spdy
diff --git a/chromium/net/third_party/quiche/src/spdy/core/recording_headers_handler.h b/chromium/net/third_party/quiche/src/spdy/core/recording_headers_handler.h
new file mode 100644
index 00000000000..a61670ef8d8
--- /dev/null
+++ b/chromium/net/third_party/quiche/src/spdy/core/recording_headers_handler.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2020 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 QUICHE_SPDY_CORE_RECORDING_HEADERS_HANDLER_H_
+#define QUICHE_SPDY_CORE_RECORDING_HEADERS_HANDLER_H_
+
+#include <cstddef>
+#include <cstdint>
+#include <string>
+
+#include "absl/strings/string_view.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
+#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
+#include "net/third_party/quiche/src/spdy/core/spdy_headers_handler_interface.h"
+
+namespace spdy {
+
+// RecordingHeadersHandler copies the headers emitted from the deframer, and
+// when needed can forward events to another wrapped handler.
+class QUICHE_EXPORT_PRIVATE RecordingHeadersHandler
+ : public SpdyHeadersHandlerInterface {
+ public:
+ explicit RecordingHeadersHandler(
+ SpdyHeadersHandlerInterface* wrapped = nullptr);
+ RecordingHeadersHandler(const RecordingHeadersHandler&) = delete;
+ RecordingHeadersHandler& operator=(const RecordingHeadersHandler&) = delete;
+
+ void OnHeaderBlockStart() override;
+
+ void OnHeader(absl::string_view key, absl::string_view value) override;
+
+ void OnHeaderBlockEnd(size_t uncompressed_header_bytes,
+ size_t compressed_header_bytes) override;
+
+ const Http2HeaderBlock& decoded_block() const { return block_; }
+ size_t uncompressed_header_bytes() const {
+ return uncompressed_header_bytes_;
+ }
+ size_t compressed_header_bytes() const { return compressed_header_bytes_; }
+
+ private:
+ SpdyHeadersHandlerInterface* wrapped_ = nullptr;
+ Http2HeaderBlock block_;
+ size_t uncompressed_header_bytes_ = 0;
+ size_t compressed_header_bytes_ = 0;
+};
+
+} // namespace spdy
+
+#endif // QUICHE_SPDY_CORE_RECORDING_HEADERS_HANDLER_H_
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.cc
index 7f7ca298ab7..ac85b9c4f59 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.cc
@@ -17,8 +17,8 @@ namespace spdy {
namespace {
template <class T>
-bool ParsePositiveIntegerImpl(quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
+bool ParsePositiveIntegerImpl(absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
T* value) {
*value = 0;
for (; c != end && std::isdigit(*c); ++c) {
@@ -57,20 +57,20 @@ SpdyAltSvcWireFormat::AlternativeService::AlternativeService(
// static
bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
- quiche::QuicheStringPiece value,
+ absl::string_view value,
AlternativeServiceVector* altsvc_vector) {
// Empty value is invalid according to the specification.
if (value.empty()) {
return false;
}
altsvc_vector->clear();
- if (value == quiche::QuicheStringPiece("clear")) {
+ if (value == absl::string_view("clear")) {
return true;
}
- quiche::QuicheStringPiece::const_iterator c = value.begin();
+ absl::string_view::const_iterator c = value.begin();
while (c != value.end()) {
// Parse protocol-id.
- quiche::QuicheStringPiece::const_iterator percent_encoded_protocol_id_end =
+ absl::string_view::const_iterator percent_encoded_protocol_id_end =
std::find(c, value.end(), '=');
std::string protocol_id;
if (percent_encoded_protocol_id_end == c ||
@@ -91,7 +91,7 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
return false;
}
++c;
- quiche::QuicheStringPiece::const_iterator alt_authority_begin = c;
+ absl::string_view::const_iterator alt_authority_begin = c;
for (; c != value.end() && *c != '"'; ++c) {
// Decode backslash encoding.
if (*c != '\\') {
@@ -115,7 +115,7 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
// Parse parameters.
uint32_t max_age = 86400;
VersionVector version;
- quiche::QuicheStringPiece::const_iterator parameters_end =
+ absl::string_view::const_iterator parameters_end =
std::find(c, value.end(), ',');
while (c != parameters_end) {
SkipWhiteSpace(&c, parameters_end);
@@ -140,7 +140,7 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
}
++c;
SkipWhiteSpace(&c, parameters_end);
- quiche::QuicheStringPiece::const_iterator parameter_value_begin = c;
+ absl::string_view::const_iterator parameter_value_begin = c;
for (; c != parameters_end && *c != ';' && *c != ' ' && *c != '\t'; ++c) {
}
if (c == parameter_value_begin) {
@@ -164,10 +164,9 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
}
++c;
parameters_end = std::find(c, value.end(), ',');
- quiche::QuicheStringPiece::const_iterator v_begin =
- parameter_value_begin + 1;
+ absl::string_view::const_iterator v_begin = parameter_value_begin + 1;
while (v_begin < c) {
- quiche::QuicheStringPiece::const_iterator v_end = v_begin;
+ absl::string_view::const_iterator v_end = v_begin;
while (v_end < c - 1 && *v_end != ',') {
++v_end;
}
@@ -196,10 +195,9 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
// hq=":443";quic=51303338
// ... will be stored in |versions| as 0x51303338.
uint32_t quic_version;
- if (!SpdyHexDecodeToUInt32(
- quiche::QuicheStringPiece(&*parameter_value_begin,
- c - parameter_value_begin),
- &quic_version) ||
+ if (!SpdyHexDecodeToUInt32(absl::string_view(&*parameter_value_begin,
+ c - parameter_value_begin),
+ &quic_version) ||
quic_version == 0) {
return false;
}
@@ -295,17 +293,16 @@ std::string SpdyAltSvcWireFormat::SerializeHeaderFieldValue(
// static
void SpdyAltSvcWireFormat::SkipWhiteSpace(
- quiche::QuicheStringPiece::const_iterator* c,
- quiche::QuicheStringPiece::const_iterator end) {
+ absl::string_view::const_iterator* c,
+ absl::string_view::const_iterator end) {
for (; *c != end && (**c == ' ' || **c == '\t'); ++*c) {
}
}
// static
-bool SpdyAltSvcWireFormat::PercentDecode(
- quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
- std::string* output) {
+bool SpdyAltSvcWireFormat::PercentDecode(absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
+ std::string* output) {
output->clear();
for (; c != end; ++c) {
if (*c != '%') {
@@ -331,8 +328,8 @@ bool SpdyAltSvcWireFormat::PercentDecode(
// static
bool SpdyAltSvcWireFormat::ParseAltAuthority(
- quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
+ absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
std::string* host,
uint16_t* port) {
host->clear();
@@ -378,16 +375,16 @@ bool SpdyAltSvcWireFormat::ParseAltAuthority(
// static
bool SpdyAltSvcWireFormat::ParsePositiveInteger16(
- quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
+ absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
uint16_t* value) {
return ParsePositiveIntegerImpl<uint16_t>(c, end, value);
}
// static
bool SpdyAltSvcWireFormat::ParsePositiveInteger32(
- quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
+ absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
uint32_t* value) {
return ParsePositiveIntegerImpl<uint32_t>(c, end, value);
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h
index 4d2545035b1..30462feb031 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h
@@ -14,8 +14,8 @@
#include <string>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h"
namespace spdy {
@@ -60,29 +60,27 @@ class QUICHE_EXPORT_PRIVATE SpdyAltSvcWireFormat {
typedef std::vector<AlternativeService> AlternativeServiceVector;
friend class test::SpdyAltSvcWireFormatPeer;
- static bool ParseHeaderFieldValue(quiche::QuicheStringPiece value,
+ static bool ParseHeaderFieldValue(absl::string_view value,
AlternativeServiceVector* altsvc_vector);
static std::string SerializeHeaderFieldValue(
const AlternativeServiceVector& altsvc_vector);
private:
- static void SkipWhiteSpace(quiche::QuicheStringPiece::const_iterator* c,
- quiche::QuicheStringPiece::const_iterator end);
- static bool PercentDecode(quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
+ static void SkipWhiteSpace(absl::string_view::const_iterator* c,
+ absl::string_view::const_iterator end);
+ static bool PercentDecode(absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
std::string* output);
- static bool ParseAltAuthority(quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
+ static bool ParseAltAuthority(absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
std::string* host,
uint16_t* port);
- static bool ParsePositiveInteger16(
- quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
- uint16_t* value);
- static bool ParsePositiveInteger32(
- quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
- uint32_t* value);
+ static bool ParsePositiveInteger16(absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
+ uint16_t* value);
+ static bool ParsePositiveInteger32(absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
+ uint32_t* value);
};
} // namespace spdy
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format_test.cc
index d80de7df00e..a4127c8dc65 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format_test.cc
@@ -14,31 +14,29 @@ namespace test {
// Expose all private methods of class SpdyAltSvcWireFormat.
class SpdyAltSvcWireFormatPeer {
public:
- static void SkipWhiteSpace(quiche::QuicheStringPiece::const_iterator* c,
- quiche::QuicheStringPiece::const_iterator end) {
+ static void SkipWhiteSpace(absl::string_view::const_iterator* c,
+ absl::string_view::const_iterator end) {
SpdyAltSvcWireFormat::SkipWhiteSpace(c, end);
}
- static bool PercentDecode(quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
+ static bool PercentDecode(absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
std::string* output) {
return SpdyAltSvcWireFormat::PercentDecode(c, end, output);
}
- static bool ParseAltAuthority(quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
+ static bool ParseAltAuthority(absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
std::string* host,
uint16_t* port) {
return SpdyAltSvcWireFormat::ParseAltAuthority(c, end, host, port);
}
- static bool ParsePositiveInteger16(
- quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
- uint16_t* max_age) {
+ static bool ParsePositiveInteger16(absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
+ uint16_t* max_age) {
return SpdyAltSvcWireFormat::ParsePositiveInteger16(c, end, max_age);
}
- static bool ParsePositiveInteger32(
- quiche::QuicheStringPiece::const_iterator c,
- quiche::QuicheStringPiece::const_iterator end,
- uint32_t* max_age) {
+ static bool ParsePositiveInteger32(absl::string_view::const_iterator c,
+ absl::string_view::const_iterator end,
+ uint32_t* max_age) {
return SpdyAltSvcWireFormat::ParsePositiveInteger32(c, end, max_age);
}
};
@@ -389,8 +387,8 @@ TEST(SpdyAltSvcWireFormatTest, ParseTruncatedHeaderFieldValue) {
// Test SkipWhiteSpace().
TEST(SpdyAltSvcWireFormatTest, SkipWhiteSpace) {
- quiche::QuicheStringPiece input("a \tb ");
- quiche::QuicheStringPiece::const_iterator c = input.begin();
+ absl::string_view input("a \tb ");
+ absl::string_view::const_iterator c = input.begin();
test::SpdyAltSvcWireFormatPeer::SkipWhiteSpace(&c, input.end());
ASSERT_EQ(input.begin(), c);
++c;
@@ -403,19 +401,19 @@ TEST(SpdyAltSvcWireFormatTest, SkipWhiteSpace) {
// Test PercentDecode() on valid input.
TEST(SpdyAltSvcWireFormatTest, PercentDecodeValid) {
- quiche::QuicheStringPiece input("");
+ absl::string_view input("");
std::string output;
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::PercentDecode(
input.begin(), input.end(), &output));
EXPECT_EQ("", output);
- input = quiche::QuicheStringPiece("foo");
+ input = absl::string_view("foo");
output.clear();
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::PercentDecode(
input.begin(), input.end(), &output));
EXPECT_EQ("foo", output);
- input = quiche::QuicheStringPiece("%2ca%5Cb");
+ input = absl::string_view("%2ca%5Cb");
output.clear();
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::PercentDecode(
input.begin(), input.end(), &output));
@@ -426,7 +424,7 @@ TEST(SpdyAltSvcWireFormatTest, PercentDecodeValid) {
TEST(SpdyAltSvcWireFormatTest, PercentDecodeInvalid) {
const char* invalid_input_array[] = {"a%", "a%x", "a%b", "%J22", "%9z"};
for (const char* invalid_input : invalid_input_array) {
- quiche::QuicheStringPiece input(invalid_input);
+ absl::string_view input(invalid_input);
std::string output;
EXPECT_FALSE(test::SpdyAltSvcWireFormatPeer::PercentDecode(
input.begin(), input.end(), &output))
@@ -436,7 +434,7 @@ TEST(SpdyAltSvcWireFormatTest, PercentDecodeInvalid) {
// Test ParseAltAuthority() on valid input.
TEST(SpdyAltSvcWireFormatTest, ParseAltAuthorityValid) {
- quiche::QuicheStringPiece input(":42");
+ absl::string_view input(":42");
std::string host;
uint16_t port;
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::ParseAltAuthority(
@@ -444,13 +442,13 @@ TEST(SpdyAltSvcWireFormatTest, ParseAltAuthorityValid) {
EXPECT_TRUE(host.empty());
EXPECT_EQ(42, port);
- input = quiche::QuicheStringPiece("foo:137");
+ input = absl::string_view("foo:137");
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::ParseAltAuthority(
input.begin(), input.end(), &host, &port));
EXPECT_EQ("foo", host);
EXPECT_EQ(137, port);
- input = quiche::QuicheStringPiece("[2003:8:0:16::509d:9615]:443");
+ input = absl::string_view("[2003:8:0:16::509d:9615]:443");
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::ParseAltAuthority(
input.begin(), input.end(), &host, &port));
EXPECT_EQ("[2003:8:0:16::509d:9615]", host);
@@ -477,7 +475,7 @@ TEST(SpdyAltSvcWireFormatTest, ParseAltAuthorityInvalid) {
"[2003:8:0:16::509d:9615:443",
"2003:8:0:16::509d:9615]:443"};
for (const char* invalid_input : invalid_input_array) {
- quiche::QuicheStringPiece input(invalid_input);
+ absl::string_view input(invalid_input);
std::string host;
uint16_t port;
EXPECT_FALSE(test::SpdyAltSvcWireFormatPeer::ParseAltAuthority(
@@ -488,13 +486,13 @@ TEST(SpdyAltSvcWireFormatTest, ParseAltAuthorityInvalid) {
// Test ParseInteger() on valid input.
TEST(SpdyAltSvcWireFormatTest, ParseIntegerValid) {
- quiche::QuicheStringPiece input("3");
+ absl::string_view input("3");
uint16_t value;
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::ParsePositiveInteger16(
input.begin(), input.end(), &value));
EXPECT_EQ(3, value);
- input = quiche::QuicheStringPiece("1337");
+ input = absl::string_view("1337");
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::ParsePositiveInteger16(
input.begin(), input.end(), &value));
EXPECT_EQ(1337, value);
@@ -505,7 +503,7 @@ TEST(SpdyAltSvcWireFormatTest, ParseIntegerValid) {
TEST(SpdyAltSvcWireFormatTest, ParseIntegerInvalid) {
const char* invalid_input_array[] = {"", " ", "a", "0", "00", "1 ", "12b"};
for (const char* invalid_input : invalid_input_array) {
- quiche::QuicheStringPiece input(invalid_input);
+ absl::string_view input(invalid_input);
uint16_t value;
EXPECT_FALSE(test::SpdyAltSvcWireFormatPeer::ParsePositiveInteger16(
input.begin(), input.end(), &value))
@@ -516,39 +514,39 @@ TEST(SpdyAltSvcWireFormatTest, ParseIntegerInvalid) {
// Test ParseIntegerValid() around overflow limit.
TEST(SpdyAltSvcWireFormatTest, ParseIntegerOverflow) {
// Largest possible uint16_t value.
- quiche::QuicheStringPiece input("65535");
+ absl::string_view input("65535");
uint16_t value16;
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::ParsePositiveInteger16(
input.begin(), input.end(), &value16));
EXPECT_EQ(65535, value16);
// Overflow uint16_t, ParsePositiveInteger16() should return false.
- input = quiche::QuicheStringPiece("65536");
+ input = absl::string_view("65536");
ASSERT_FALSE(test::SpdyAltSvcWireFormatPeer::ParsePositiveInteger16(
input.begin(), input.end(), &value16));
// However, even if overflow is not checked for, 65536 overflows to 0, which
// returns false anyway. Check for a larger number which overflows to 1.
- input = quiche::QuicheStringPiece("65537");
+ input = absl::string_view("65537");
ASSERT_FALSE(test::SpdyAltSvcWireFormatPeer::ParsePositiveInteger16(
input.begin(), input.end(), &value16));
// Largest possible uint32_t value.
- input = quiche::QuicheStringPiece("4294967295");
+ input = absl::string_view("4294967295");
uint32_t value32;
ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::ParsePositiveInteger32(
input.begin(), input.end(), &value32));
EXPECT_EQ(4294967295, value32);
// Overflow uint32_t, ParsePositiveInteger32() should return false.
- input = quiche::QuicheStringPiece("4294967296");
+ input = absl::string_view("4294967296");
ASSERT_FALSE(test::SpdyAltSvcWireFormatPeer::ParsePositiveInteger32(
input.begin(), input.end(), &value32));
// However, even if overflow is not checked for, 4294967296 overflows to 0,
// which returns false anyway. Check for a larger number which overflows to
// 1.
- input = quiche::QuicheStringPiece("4294967297");
+ input = absl::string_view("4294967297");
ASSERT_FALSE(test::SpdyAltSvcWireFormatPeer::ParsePositiveInteger32(
input.begin(), input.end(), &value32));
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_deframer_visitor.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_deframer_visitor.cc
index 9e20e3e0188..835fea9d354 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_deframer_visitor.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_deframer_visitor.cc
@@ -11,10 +11,11 @@
#include <limits>
#include <memory>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_macros.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
#include "net/third_party/quiche/src/spdy/core/mock_spdy_framer_visitor.h"
+#include "net/third_party/quiche/src/spdy/core/recording_headers_handler.h"
#include "net/third_party/quiche/src/spdy/core/spdy_frame_reader.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
#include "net/third_party/quiche/src/spdy/core/spdy_test_utils.h"
@@ -138,7 +139,7 @@ class SpdyTestDeframerImpl : public SpdyTestDeframer,
// alphabetical order for ease of navigation, and are not in same order
// as in SpdyFramerVisitorInterface.
void OnAltSvc(SpdyStreamId stream_id,
- quiche::QuicheStringPiece origin,
+ absl::string_view origin,
const SpdyAltSvcWireFormat::AlternativeServiceVector&
altsvc_vector) override;
void OnContinuation(SpdyStreamId stream_id, bool end) override;
@@ -185,8 +186,7 @@ class SpdyTestDeframerImpl : public SpdyTestDeframer,
// Callbacks defined in SpdyHeadersHandlerInterface.
void OnHeaderBlockStart() override;
- void OnHeader(quiche::QuicheStringPiece key,
- quiche::QuicheStringPiece value) override;
+ void OnHeader(absl::string_view key, absl::string_view value) override;
void OnHeaderBlockEnd(size_t header_bytes_parsed,
size_t compressed_header_bytes_parsed) override;
@@ -227,7 +227,7 @@ class SpdyTestDeframerImpl : public SpdyTestDeframer,
std::unique_ptr<std::string> goaway_description_;
std::unique_ptr<StringPairVector> headers_;
std::unique_ptr<SettingVector> settings_;
- std::unique_ptr<TestHeadersHandler> headers_handler_;
+ std::unique_ptr<RecordingHeadersHandler> headers_handler_;
std::unique_ptr<SpdyGoAwayIR> goaway_ir_;
std::unique_ptr<SpdyHeadersIR> headers_ir_;
@@ -411,7 +411,7 @@ bool SpdyTestDeframerImpl::AtFrameEnd() {
void SpdyTestDeframerImpl::OnAltSvc(
SpdyStreamId stream_id,
- quiche::QuicheStringPiece origin,
+ absl::string_view origin,
const SpdyAltSvcWireFormat::AlternativeServiceVector& altsvc_vector) {
SPDY_DVLOG(1) << "OnAltSvc stream_id: " << stream_id;
CHECK_EQ(frame_type_, UNSET)
@@ -532,7 +532,7 @@ void SpdyTestDeframerImpl::OnHeaders(SpdyStreamId stream_id,
end_ = end;
headers_ = std::make_unique<StringPairVector>();
- headers_handler_ = std::make_unique<TestHeadersHandler>();
+ headers_handler_ = std::make_unique<RecordingHeadersHandler>();
headers_ir_ = std::make_unique<SpdyHeadersIR>(stream_id);
headers_ir_->set_fin(fin);
if (has_priority) {
@@ -588,7 +588,7 @@ void SpdyTestDeframerImpl::OnPushPromise(SpdyStreamId stream_id,
end_ = end;
headers_ = std::make_unique<StringPairVector>();
- headers_handler_ = std::make_unique<TestHeadersHandler>();
+ headers_handler_ = std::make_unique<RecordingHeadersHandler>();
push_promise_ir_ =
std::make_unique<SpdyPushPromiseIR>(stream_id, promised_stream_id);
}
@@ -757,8 +757,8 @@ void SpdyTestDeframerImpl::OnHeaderBlockStart() {
got_hpack_end_ = false;
}
-void SpdyTestDeframerImpl::OnHeader(quiche::QuicheStringPiece key,
- quiche::QuicheStringPiece value) {
+void SpdyTestDeframerImpl::OnHeader(absl::string_view key,
+ absl::string_view value) {
CHECK(frame_type_ == HEADERS || frame_type_ == CONTINUATION ||
frame_type_ == PUSH_PROMISE)
<< " frame_type_=" << Http2FrameTypeToString(frame_type_);
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_deframer_visitor.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_deframer_visitor.h
index 27535236aef..f17df98720f 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_deframer_visitor.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_deframer_visitor.h
@@ -45,7 +45,7 @@
// framer.set_visitor(the_deframer.get());
//
// // Process frames.
-// QuicheStringPiece input = ...
+// absl::string_view input = ...
// while (!input.empty() && !framer.HasError()) {
// size_t consumed = framer.ProcessInput(input.data(), input.size());
// input.remove_prefix(consumed);
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder.cc
index 492cd438d4c..93fb2843a38 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder.cc
@@ -120,8 +120,7 @@ bool SpdyFrameBuilder::BeginNewFrameInternal(uint8_t raw_frame_type,
return success;
}
-bool SpdyFrameBuilder::WriteStringPiece32(
- const quiche::QuicheStringPiece value) {
+bool SpdyFrameBuilder::WriteStringPiece32(const absl::string_view value) {
if (!WriteUInt32(value.size())) {
return false;
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder.h
index 4853d44eff3..9079a72ad14 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder.h
@@ -9,12 +9,12 @@
#include <cstdint>
#include <memory>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "net/third_party/quiche/src/common/quiche_endian.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
#include "net/third_party/quiche/src/spdy/core/zero_copy_output_buffer.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_bug_tracker.h"
-#include "net/third_party/quiche/src/spdy/platform/api/spdy_endianness_util.h"
namespace spdy {
@@ -83,24 +83,26 @@ class QUICHE_EXPORT_PRIVATE SpdyFrameBuilder {
// host to network form.
bool WriteUInt8(uint8_t value) { return WriteBytes(&value, sizeof(value)); }
bool WriteUInt16(uint16_t value) {
- value = SpdyHostToNet16(value);
+ value = quiche::QuicheEndian::HostToNet16(value);
return WriteBytes(&value, sizeof(value));
}
bool WriteUInt24(uint32_t value) {
- value = SpdyHostToNet32(value);
+ value = quiche::QuicheEndian::HostToNet32(value);
return WriteBytes(reinterpret_cast<char*>(&value) + 1, sizeof(value) - 1);
}
bool WriteUInt32(uint32_t value) {
- value = SpdyHostToNet32(value);
+ value = quiche::QuicheEndian::HostToNet32(value);
return WriteBytes(&value, sizeof(value));
}
bool WriteUInt64(uint64_t value) {
- uint32_t upper = SpdyHostToNet32(static_cast<uint32_t>(value >> 32));
- uint32_t lower = SpdyHostToNet32(static_cast<uint32_t>(value));
+ uint32_t upper =
+ quiche::QuicheEndian::HostToNet32(static_cast<uint32_t>(value >> 32));
+ uint32_t lower =
+ quiche::QuicheEndian::HostToNet32(static_cast<uint32_t>(value));
return (WriteBytes(&upper, sizeof(upper)) &&
WriteBytes(&lower, sizeof(lower)));
}
- bool WriteStringPiece32(const quiche::QuicheStringPiece value);
+ bool WriteStringPiece32(const absl::string_view value);
bool WriteBytes(const void* data, uint32_t data_len);
private:
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder_test.cc
index b10932334cc..8f6a7b40551 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_builder_test.cc
@@ -48,8 +48,8 @@ TEST(SpdyFrameBuilderTest, GetWritableBuffer) {
SpdySerializedFrame frame(builder.take());
char expected[kBuilderSize];
memset(expected, ~1, kBuilderSize);
- EXPECT_EQ(quiche::QuicheStringPiece(expected, kBuilderSize),
- quiche::QuicheStringPiece(frame.data(), kBuilderSize));
+ EXPECT_EQ(absl::string_view(expected, kBuilderSize),
+ absl::string_view(frame.data(), kBuilderSize));
}
// Verifies that SpdyFrameBuilder::GetWritableBuffer() can be used to build a
@@ -66,8 +66,8 @@ TEST(SpdyFrameBuilderTest, GetWritableOutput) {
SpdySerializedFrame frame(output.Begin(), kBuilderSize, false);
char expected[kBuilderSize];
memset(expected, ~1, kBuilderSize);
- EXPECT_EQ(quiche::QuicheStringPiece(expected, kBuilderSize),
- quiche::QuicheStringPiece(frame.data(), kBuilderSize));
+ EXPECT_EQ(absl::string_view(expected, kBuilderSize),
+ absl::string_view(frame.data(), kBuilderSize));
}
// Verifies the case that the buffer's capacity is too small.
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader.cc
index 253f90639de..a53a8acb9a2 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader.cc
@@ -4,8 +4,8 @@
#include "net/third_party/quiche/src/spdy/core/spdy_frame_reader.h"
+#include "net/third_party/quiche/src/common/quiche_endian.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
-#include "net/third_party/quiche/src/spdy/platform/api/spdy_endianness_util.h"
namespace spdy {
@@ -36,7 +36,8 @@ bool SpdyFrameReader::ReadUInt16(uint16_t* result) {
}
// Read into result.
- *result = SpdyNetToHost16(*(reinterpret_cast<const uint16_t*>(data_ + ofs_)));
+ *result = quiche::QuicheEndian::NetToHost16(
+ *(reinterpret_cast<const uint16_t*>(data_ + ofs_)));
// Iterate.
ofs_ += 2;
@@ -52,7 +53,8 @@ bool SpdyFrameReader::ReadUInt32(uint32_t* result) {
}
// Read into result.
- *result = SpdyNetToHost32(*(reinterpret_cast<const uint32_t*>(data_ + ofs_)));
+ *result = quiche::QuicheEndian::NetToHost32(
+ *(reinterpret_cast<const uint32_t*>(data_ + ofs_)));
// Iterate.
ofs_ += 4;
@@ -68,10 +70,10 @@ bool SpdyFrameReader::ReadUInt64(uint64_t* result) {
}
// Read into result. Network byte order is big-endian.
- uint64_t upper =
- SpdyNetToHost32(*(reinterpret_cast<const uint32_t*>(data_ + ofs_)));
- uint64_t lower =
- SpdyNetToHost32(*(reinterpret_cast<const uint32_t*>(data_ + ofs_ + 4)));
+ uint64_t upper = quiche::QuicheEndian::NetToHost32(
+ *(reinterpret_cast<const uint32_t*>(data_ + ofs_)));
+ uint64_t lower = quiche::QuicheEndian::NetToHost32(
+ *(reinterpret_cast<const uint32_t*>(data_ + ofs_ + 4)));
*result = (upper << 32) + lower;
// Iterate.
@@ -101,7 +103,7 @@ bool SpdyFrameReader::ReadUInt24(uint32_t* result) {
// Read into result.
*result = 0;
memcpy(reinterpret_cast<char*>(result) + 1, data_ + ofs_, 3);
- *result = SpdyNetToHost32(*result);
+ *result = quiche::QuicheEndian::NetToHost32(*result);
// Iterate.
ofs_ += 3;
@@ -109,7 +111,7 @@ bool SpdyFrameReader::ReadUInt24(uint32_t* result) {
return true;
}
-bool SpdyFrameReader::ReadStringPiece16(quiche::QuicheStringPiece* result) {
+bool SpdyFrameReader::ReadStringPiece16(absl::string_view* result) {
// Read resultant length.
uint16_t result_len;
if (!ReadUInt16(&result_len)) {
@@ -124,7 +126,7 @@ bool SpdyFrameReader::ReadStringPiece16(quiche::QuicheStringPiece* result) {
}
// Set result.
- *result = quiche::QuicheStringPiece(data_ + ofs_, result_len);
+ *result = absl::string_view(data_ + ofs_, result_len);
// Iterate.
ofs_ += result_len;
@@ -132,7 +134,7 @@ bool SpdyFrameReader::ReadStringPiece16(quiche::QuicheStringPiece* result) {
return true;
}
-bool SpdyFrameReader::ReadStringPiece32(quiche::QuicheStringPiece* result) {
+bool SpdyFrameReader::ReadStringPiece32(absl::string_view* result) {
// Read resultant length.
uint32_t result_len;
if (!ReadUInt32(&result_len)) {
@@ -147,7 +149,7 @@ bool SpdyFrameReader::ReadStringPiece32(quiche::QuicheStringPiece* result) {
}
// Set result.
- *result = quiche::QuicheStringPiece(data_ + ofs_, result_len);
+ *result = absl::string_view(data_ + ofs_, result_len);
// Iterate.
ofs_ += result_len;
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader.h
index 0ed5be48884..e097ee33905 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader.h
@@ -7,8 +7,8 @@
#include <cstdint>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace spdy {
@@ -73,7 +73,7 @@ class QUICHE_EXPORT_PRIVATE SpdyFrameReader {
//
// Forwards the internal iterator on success.
// Returns true on success, false otherwise.
- bool ReadStringPiece16(quiche::QuicheStringPiece* result);
+ bool ReadStringPiece16(absl::string_view* result);
// Reads a string prefixed with 32-bit length into the given output parameter.
//
@@ -82,7 +82,7 @@ class QUICHE_EXPORT_PRIVATE SpdyFrameReader {
//
// Forwards the internal iterator on success.
// Returns true on success, false otherwise.
- bool ReadStringPiece32(quiche::QuicheStringPiece* result);
+ bool ReadStringPiece32(absl::string_view* result);
// Reads a given number of bytes into the given buffer. The buffer
// must be of adequate size.
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader_test.cc
index 0bbe7f62cf2..1e46c48f9af 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_frame_reader_test.cc
@@ -6,17 +6,17 @@
#include <cstdint>
-#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
+#include "absl/base/macros.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
-#include "net/third_party/quiche/src/spdy/platform/api/spdy_endianness_util.h"
+#include "net/third_party/quiche/src/common/quiche_endian.h"
namespace spdy {
TEST(SpdyFrameReaderTest, ReadUInt16) {
// Frame data in network byte order.
const uint16_t kFrameData[] = {
- SpdyHostToNet16(1),
- SpdyHostToNet16(1 << 15),
+ quiche::QuicheEndian::HostToNet16(1),
+ quiche::QuicheEndian::HostToNet16(1 << 15),
};
SpdyFrameReader frame_reader(reinterpret_cast<const char*>(kFrameData),
@@ -36,12 +36,12 @@ TEST(SpdyFrameReaderTest, ReadUInt16) {
TEST(SpdyFrameReaderTest, ReadUInt32) {
// Frame data in network byte order.
const uint32_t kFrameData[] = {
- SpdyHostToNet32(1),
- SpdyHostToNet32(0x80000000),
+ quiche::QuicheEndian::HostToNet32(1),
+ quiche::QuicheEndian::HostToNet32(0x80000000),
};
SpdyFrameReader frame_reader(reinterpret_cast<const char*>(kFrameData),
- QUICHE_ARRAYSIZE(kFrameData) * sizeof(uint32_t));
+ ABSL_ARRAYSIZE(kFrameData) * sizeof(uint32_t));
EXPECT_FALSE(frame_reader.IsDoneReading());
uint32_t uint32_val;
@@ -64,10 +64,10 @@ TEST(SpdyFrameReaderTest, ReadStringPiece16) {
0x20, 0x31, 0x2c, 0x20, 0x32, 0x2c, 0x20, 0x33, // "Testing, 1, 2, 3"
};
- SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ SpdyFrameReader frame_reader(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
- quiche::QuicheStringPiece stringpiece_val;
+ absl::string_view stringpiece_val;
EXPECT_TRUE(frame_reader.ReadStringPiece16(&stringpiece_val));
EXPECT_FALSE(frame_reader.IsDoneReading());
EXPECT_EQ(0, stringpiece_val.compare("Hi"));
@@ -87,10 +87,10 @@ TEST(SpdyFrameReaderTest, ReadStringPiece32) {
0x20, 0x34, 0x2c, 0x20, 0x35, 0x2c, 0x20, 0x36, // "Testing, 4, 5, 6"
};
- SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ SpdyFrameReader frame_reader(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
- quiche::QuicheStringPiece stringpiece_val;
+ absl::string_view stringpiece_val;
EXPECT_TRUE(frame_reader.ReadStringPiece32(&stringpiece_val));
EXPECT_FALSE(frame_reader.IsDoneReading());
EXPECT_EQ(0, stringpiece_val.compare("foo"));
@@ -106,7 +106,7 @@ TEST(SpdyFrameReaderTest, ReadUInt16WithBufferTooSmall) {
0x00, // part of a uint16_t
};
- SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ SpdyFrameReader frame_reader(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
uint16_t uint16_val;
@@ -119,7 +119,7 @@ TEST(SpdyFrameReaderTest, ReadUInt32WithBufferTooSmall) {
0x00, 0x00, 0x00, // part of a uint32_t
};
- SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ SpdyFrameReader frame_reader(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
uint32_t uint32_val;
@@ -139,10 +139,10 @@ TEST(SpdyFrameReaderTest, ReadStringPiece16WithBufferTooSmall) {
0x48, 0x69, // "Hi"
};
- SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ SpdyFrameReader frame_reader(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
- quiche::QuicheStringPiece stringpiece_val;
+ absl::string_view stringpiece_val;
EXPECT_FALSE(frame_reader.ReadStringPiece16(&stringpiece_val));
// Also make sure that trying to read a uint16_t, which technically could
@@ -158,10 +158,10 @@ TEST(SpdyFrameReaderTest, ReadStringPiece16WithBufferWayTooSmall) {
0x00, // part of a uint16_t
};
- SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ SpdyFrameReader frame_reader(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
- quiche::QuicheStringPiece stringpiece_val;
+ absl::string_view stringpiece_val;
EXPECT_FALSE(frame_reader.ReadStringPiece16(&stringpiece_val));
// Also make sure that trying to read a uint16_t, which technically could
@@ -178,10 +178,10 @@ TEST(SpdyFrameReaderTest, ReadStringPiece32WithBufferTooSmall) {
0x48, 0x69, // "Hi"
};
- SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ SpdyFrameReader frame_reader(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
- quiche::QuicheStringPiece stringpiece_val;
+ absl::string_view stringpiece_val;
EXPECT_FALSE(frame_reader.ReadStringPiece32(&stringpiece_val));
// Also make sure that trying to read a uint16_t, which technically could
@@ -197,10 +197,10 @@ TEST(SpdyFrameReaderTest, ReadStringPiece32WithBufferWayTooSmall) {
0x00, 0x00, 0x00, // part of a uint32_t
};
- SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ SpdyFrameReader frame_reader(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
- quiche::QuicheStringPiece stringpiece_val;
+ absl::string_view stringpiece_val;
EXPECT_FALSE(frame_reader.ReadStringPiece32(&stringpiece_val));
// Also make sure that trying to read a uint16_t, which technically could
@@ -216,18 +216,18 @@ TEST(SpdyFrameReaderTest, ReadBytes) {
0x48, 0x69, // "Hi"
};
- SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ SpdyFrameReader frame_reader(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
char dest1[3] = {};
- EXPECT_TRUE(frame_reader.ReadBytes(&dest1, QUICHE_ARRAYSIZE(dest1)));
+ EXPECT_TRUE(frame_reader.ReadBytes(&dest1, ABSL_ARRAYSIZE(dest1)));
EXPECT_FALSE(frame_reader.IsDoneReading());
- EXPECT_EQ("foo", quiche::QuicheStringPiece(dest1, QUICHE_ARRAYSIZE(dest1)));
+ EXPECT_EQ("foo", absl::string_view(dest1, ABSL_ARRAYSIZE(dest1)));
char dest2[2] = {};
- EXPECT_TRUE(frame_reader.ReadBytes(&dest2, QUICHE_ARRAYSIZE(dest2)));
+ EXPECT_TRUE(frame_reader.ReadBytes(&dest2, ABSL_ARRAYSIZE(dest2)));
EXPECT_TRUE(frame_reader.IsDoneReading());
- EXPECT_EQ("Hi", quiche::QuicheStringPiece(dest2, QUICHE_ARRAYSIZE(dest2)));
+ EXPECT_EQ("Hi", absl::string_view(dest2, ABSL_ARRAYSIZE(dest2)));
}
TEST(SpdyFrameReaderTest, ReadBytesWithBufferTooSmall) {
@@ -236,11 +236,11 @@ TEST(SpdyFrameReaderTest, ReadBytesWithBufferTooSmall) {
0x01,
};
- SpdyFrameReader frame_reader(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ SpdyFrameReader frame_reader(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_FALSE(frame_reader.IsDoneReading());
- char dest[QUICHE_ARRAYSIZE(kFrameData) + 2] = {};
- EXPECT_FALSE(frame_reader.ReadBytes(&dest, QUICHE_ARRAYSIZE(kFrameData) + 1));
+ char dest[ABSL_ARRAYSIZE(kFrameData) + 2] = {};
+ EXPECT_FALSE(frame_reader.ReadBytes(&dest, ABSL_ARRAYSIZE(kFrameData) + 1));
EXPECT_STREQ("", dest);
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_framer.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_framer.cc
index 7b3d388cfb4..d425bddaf09 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_framer.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_framer.cc
@@ -11,9 +11,8 @@
#include <new>
#include <utility>
+#include "absl/memory/memory.h"
#include "net/third_party/quiche/src/http2/platform/api/http2_macros.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_ptr_util.h"
-#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
#include "net/third_party/quiche/src/spdy/core/spdy_bitmasks.h"
#include "net/third_party/quiche/src/spdy/core/spdy_frame_builder.h"
#include "net/third_party/quiche/src/spdy/core/spdy_frame_reader.h"
@@ -46,7 +45,7 @@ const size_t kPadLengthFieldSize = 1;
// The size of one parameter in SETTINGS frame.
const size_t kOneSettingParameterSize = 6;
-size_t GetUncompressedSerializedLength(const SpdyHeaderBlock& headers) {
+size_t GetUncompressedSerializedLength(const Http2HeaderBlock& headers) {
const size_t num_name_value_pairs_size = sizeof(uint32_t);
const size_t length_of_name_size = num_name_value_pairs_size;
const size_t length_of_value_size = num_name_value_pairs_size;
@@ -414,12 +413,12 @@ std::unique_ptr<SpdyFrameSequence> SpdyFramer::CreateIterator(
switch (frame_ir->frame_type()) {
case SpdyFrameType::HEADERS: {
return std::make_unique<SpdyHeaderFrameIterator>(
- framer, quiche::QuicheWrapUnique(
+ framer, absl::WrapUnique(
static_cast<const SpdyHeadersIR*>(frame_ir.release())));
}
case SpdyFrameType::PUSH_PROMISE: {
return std::make_unique<SpdyPushPromiseFrameIterator>(
- framer, quiche::QuicheWrapUnique(
+ framer, absl::WrapUnique(
static_cast<const SpdyPushPromiseIR*>(frame_ir.release())));
}
case SpdyFrameType::DATA: {
@@ -1269,7 +1268,7 @@ size_t SpdyFramer::SerializeFrame(const SpdyFrameIR& frame,
HpackEncoder* SpdyFramer::GetHpackEncoder() {
if (hpack_encoder_ == nullptr) {
- hpack_encoder_ = std::make_unique<HpackEncoder>(ObtainHpackHuffmanTable());
+ hpack_encoder_ = std::make_unique<HpackEncoder>();
if (!compression_enabled()) {
hpack_encoder_->DisableCompression();
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_framer.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_framer.h
index f16e3bd1916..99c20376830 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_framer.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_framer.h
@@ -13,8 +13,8 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h"
#include "net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h"
#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_framer_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_framer_test.cc
index e36a17e6591..6a14d0c436c 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_framer_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_framer_test.cc
@@ -13,11 +13,11 @@
#include <utility>
#include <vector>
-#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
+#include "absl/base/macros.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
#include "net/third_party/quiche/src/spdy/core/array_output_buffer.h"
-#include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h"
#include "net/third_party/quiche/src/spdy/core/mock_spdy_framer_visitor.h"
+#include "net/third_party/quiche/src/spdy/core/recording_headers_handler.h"
#include "net/third_party/quiche/src/spdy/core/spdy_bitmasks.h"
#include "net/third_party/quiche/src/spdy/core/spdy_frame_builder.h"
#include "net/third_party/quiche/src/spdy/core/spdy_frame_reader.h"
@@ -288,7 +288,7 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
SPDY_VLOG(1) << "OnStreamFrameData(" << stream_id << ", data, " << len
<< ", "
<< ") data:\n"
- << SpdyHexDump(quiche::QuicheStringPiece(data, len));
+ << SpdyHexDump(absl::string_view(data, len));
EXPECT_EQ(header_stream_id_, stream_id);
data_bytes_ += len;
@@ -316,7 +316,7 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
SpdyHeadersHandlerInterface* OnHeaderFrameStart(
SpdyStreamId /*stream_id*/) override {
if (headers_handler_ == nullptr) {
- headers_handler_ = std::make_unique<TestHeadersHandler>();
+ headers_handler_ = std::make_unique<RecordingHeadersHandler>();
}
return headers_handler_.get();
}
@@ -324,7 +324,7 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
void OnHeaderFrameEnd(SpdyStreamId /*stream_id*/) override {
CHECK(headers_handler_ != nullptr);
headers_ = headers_handler_->decoded_block().Clone();
- header_bytes_received_ = headers_handler_->header_bytes_parsed();
+ header_bytes_received_ = headers_handler_->uncompressed_header_bytes();
headers_handler_.reset();
}
@@ -404,7 +404,7 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
}
void OnAltSvc(SpdyStreamId stream_id,
- quiche::QuicheStringPiece origin,
+ absl::string_view origin,
const SpdyAltSvcWireFormat::AlternativeServiceVector&
altsvc_vector) override {
SPDY_VLOG(1) << "OnAltSvc(" << stream_id << ", \"" << origin
@@ -532,8 +532,8 @@ class TestSpdyVisitor : public SpdyFramerVisitorInterface,
SpdyStreamId header_stream_id_;
SpdyFrameType header_control_type_;
bool header_buffer_valid_;
- std::unique_ptr<TestHeadersHandler> headers_handler_;
- SpdyHeaderBlock headers_;
+ std::unique_ptr<RecordingHeadersHandler> headers_handler_;
+ Http2HeaderBlock headers_;
bool header_has_priority_;
SpdyStreamId header_parent_stream_id_;
bool header_exclusive_;
@@ -1103,10 +1103,10 @@ TEST_P(SpdyFramerTest, MultiValueHeader) {
SpdyFramer framer(SpdyFramer::DISABLE_COMPRESSION);
std::string value("value1\0value2", 13);
// TODO(jgraettinger): If this pattern appears again, move to test class.
- SpdyHeaderBlock header_set;
+ Http2HeaderBlock header_set;
header_set["name"] = value;
std::string buffer;
- HpackEncoder encoder(ObtainHpackHuffmanTable());
+ HpackEncoder encoder;
encoder.DisableCompression();
encoder.EncodeHeaderSet(header_set, &buffer);
// Frame builder with plentiful buffer size.
@@ -1126,7 +1126,7 @@ TEST_P(SpdyFramerTest, MultiValueHeader) {
control_frame.size());
EXPECT_THAT(visitor.headers_, testing::ElementsAre(testing::Pair(
- "name", quiche::QuicheStringPiece(value))));
+ "name", absl::string_view(value))));
}
TEST_P(SpdyFramerTest, CompressEmptyHeaders) {
@@ -1316,7 +1316,7 @@ TEST_P(SpdyFramerTest, UnclosedStreamDataCompressorsOneByteAtATime) {
const char bytes[] = "this is a test test test test test!";
SpdyDataIR data_ir(/* stream_id = */ 1,
- quiche::QuicheStringPiece(bytes, QUICHE_ARRAYSIZE(bytes)));
+ absl::string_view(bytes, ABSL_ARRAYSIZE(bytes)));
data_ir.set_fin(true);
SpdySerializedFrame send_frame(framer_.SerializeData(data_ir));
@@ -1336,8 +1336,7 @@ TEST_P(SpdyFramerTest, UnclosedStreamDataCompressorsOneByteAtATime) {
EXPECT_EQ(0, visitor.error_count_);
EXPECT_EQ(1, visitor.headers_frame_count_);
- EXPECT_EQ(QUICHE_ARRAYSIZE(bytes),
- static_cast<unsigned>(visitor.data_bytes_));
+ EXPECT_EQ(ABSL_ARRAYSIZE(bytes), static_cast<unsigned>(visitor.data_bytes_));
EXPECT_EQ(0, visitor.fin_frame_count_);
EXPECT_EQ(0, visitor.fin_flag_count_);
EXPECT_EQ(1, visitor.end_of_stream_count_);
@@ -1362,8 +1361,7 @@ TEST_P(SpdyFramerTest, WindowUpdateFrame) {
0x12, 0x34, 0x56, 0x78, // Increment: 305419896
};
- CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ CompareFrame(kDescription, frame, kH2FrameData, ABSL_ARRAYSIZE(kH2FrameData));
}
TEST_P(SpdyFramerTest, CreateDataFrame) {
@@ -1384,7 +1382,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
SpdyDataIR data_ir(/* stream_id = */ 1, bytes);
SpdySerializedFrame frame(framer_.SerializeData(data_ir));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
SpdyDataIR data_header_ir(/* stream_id = */ 1);
data_header_ir.SetDataShallow(bytes);
@@ -1440,7 +1438,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
data_ir.set_padding_len(248);
SpdySerializedFrame frame(framer_.SerializeData(data_ir));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
frame = framer_.SerializeDataFrameHeaderWithPaddingLengthField(data_ir);
CompareCharArraysWithHexError(
@@ -1470,7 +1468,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
data_ir.set_padding_len(8);
SpdySerializedFrame frame(framer_.SerializeData(data_ir));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
frame = framer_.SerializeDataFrameHeaderWithPaddingLengthField(data_ir);
CompareCharArraysWithHexError(
@@ -1500,7 +1498,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
data_ir.set_padding_len(1);
SpdySerializedFrame frame(framer_.SerializeData(data_ir));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
frame = framer_.SerializeDataFrameHeaderWithPaddingLengthField(data_ir);
CompareCharArraysWithHexError(
@@ -1520,7 +1518,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
SpdyDataIR data_ir(/* stream_id = */ 1, "\xff");
SpdySerializedFrame frame(framer_.SerializeData(data_ir));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1537,7 +1535,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
data_ir.set_fin(true);
SpdySerializedFrame frame(framer_.SerializeData(data_ir));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1551,7 +1549,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
SpdyDataIR data_ir(/* stream_id = */ 1, "");
SpdySerializedFrame frame(framer_.SerializeData(data_ir));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
frame = framer_.SerializeDataFrameHeaderWithPaddingLengthField(data_ir);
CompareCharArraysWithHexError(
@@ -1573,7 +1571,7 @@ TEST_P(SpdyFramerTest, CreateDataFrame) {
data_ir.set_fin(true);
SpdySerializedFrame frame(framer_.SerializeData(data_ir));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
}
@@ -1594,7 +1592,7 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1615,7 +1613,7 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1636,7 +1634,7 @@ TEST_P(SpdyFramerTest, CreateRstStream) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
}
@@ -1664,7 +1662,7 @@ TEST_P(SpdyFramerTest, CreateSettings) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1700,7 +1698,7 @@ TEST_P(SpdyFramerTest, CreateSettings) {
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1720,7 +1718,7 @@ TEST_P(SpdyFramerTest, CreateSettings) {
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
}
@@ -1753,7 +1751,7 @@ TEST_P(SpdyFramerTest, CreatePingFrame) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
// Tests SpdyPingIR when the ping is an ack.
ping_ir.set_is_ack(true);
@@ -1764,7 +1762,7 @@ TEST_P(SpdyFramerTest, CreatePingFrame) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameDataWithAck,
- QUICHE_ARRAYSIZE(kH2FrameDataWithAck));
+ ABSL_ARRAYSIZE(kH2FrameDataWithAck));
}
}
@@ -1788,7 +1786,7 @@ TEST_P(SpdyFramerTest, CreateGoAway) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1811,7 +1809,7 @@ TEST_P(SpdyFramerTest, CreateGoAway) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
}
@@ -1846,7 +1844,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders(
&framer, headers, use_output_ ? &output_ : nullptr));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1878,7 +1876,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders(
&framer, headers, use_output_ ? &output_ : nullptr));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1910,7 +1908,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders(
&framer, headers_ir, use_output_ ? &output_ : nullptr));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1947,7 +1945,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders(
&framer, headers_ir, use_output_ ? &output_ : nullptr));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -1987,7 +1985,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders(
&framer, headers_ir, use_output_ ? &output_ : nullptr));
CompareFrame(kDescription, frame, kV4FrameData,
- QUICHE_ARRAYSIZE(kV4FrameData));
+ ABSL_ARRAYSIZE(kV4FrameData));
}
{
@@ -2027,7 +2025,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders(
&framer, headers_ir, use_output_ ? &output_ : nullptr));
CompareFrame(kDescription, frame, kV4FrameData,
- QUICHE_ARRAYSIZE(kV4FrameData));
+ ABSL_ARRAYSIZE(kV4FrameData));
}
{
@@ -2065,7 +2063,7 @@ TEST_P(SpdyFramerTest, CreateHeadersUncompressed) {
SpdySerializedFrame frame(SpdyFramerPeer::SerializeHeaders(
&framer, headers_ir, use_output_ ? &output_ : nullptr));
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
}
@@ -2088,7 +2086,7 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -2110,7 +2108,7 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
{
@@ -2132,7 +2130,7 @@ TEST_P(SpdyFramerTest, CreateWindowUpdate) {
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
CompareFrame(kDescription, frame, kH2FrameData,
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
}
}
@@ -2170,7 +2168,7 @@ TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) {
push_promise.SetHeader("foo", "bar");
SpdySerializedFrame frame(SpdyFramerPeer::SerializePushPromise(
&framer, push_promise, use_output_ ? &output_ : nullptr));
- CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ CompareFrame(kDescription, frame, kFrameData, ABSL_ARRAYSIZE(kFrameData));
}
{
@@ -2210,7 +2208,7 @@ TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) {
SpdySerializedFrame frame(SpdyFramerPeer::SerializePushPromise(
&framer, push_promise, use_output_ ? &output_ : nullptr));
- CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ CompareFrame(kDescription, frame, kFrameData, ABSL_ARRAYSIZE(kFrameData));
}
{
@@ -2270,7 +2268,7 @@ TEST_P(SpdyFramerTest, CreatePushPromiseUncompressed) {
SpdySerializedFrame frame(SpdyFramerPeer::SerializePushPromise(
&framer, push_promise, use_output_ ? &output_ : nullptr));
- CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ CompareFrame(kDescription, frame, kFrameData, ABSL_ARRAYSIZE(kFrameData));
}
}
@@ -2307,11 +2305,11 @@ TEST_P(SpdyFramerTest, CreateContinuationUncompressed) {
};
// frame-format on
- SpdyHeaderBlock header_block;
+ Http2HeaderBlock header_block;
header_block["bar"] = "foo";
header_block["foo"] = "bar";
auto buffer = std::make_unique<std::string>();
- HpackEncoder encoder(ObtainHpackHuffmanTable());
+ HpackEncoder encoder;
encoder.DisableCompression();
encoder.EncodeHeaderSet(header_block, buffer.get());
@@ -2324,7 +2322,7 @@ TEST_P(SpdyFramerTest, CreateContinuationUncompressed) {
ASSERT_TRUE(framer.SerializeContinuation(continuation, &output_));
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
- CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ CompareFrame(kDescription, frame, kFrameData, ABSL_ARRAYSIZE(kFrameData));
}
// Test that if we send an unexpected CONTINUATION
@@ -2456,17 +2454,16 @@ TEST_P(SpdyFramerTest, CreatePushPromiseThenContinuationUncompressed) {
// Partially compare the PUSH_PROMISE frame against the template.
const unsigned char* frame_data =
reinterpret_cast<const unsigned char*>(frame.data());
- CompareCharArraysWithHexError(
- kDescription, frame_data,
- QUICHE_ARRAYSIZE(kPartialPushPromiseFrameData),
- kPartialPushPromiseFrameData,
- QUICHE_ARRAYSIZE(kPartialPushPromiseFrameData));
+ CompareCharArraysWithHexError(kDescription, frame_data,
+ ABSL_ARRAYSIZE(kPartialPushPromiseFrameData),
+ kPartialPushPromiseFrameData,
+ ABSL_ARRAYSIZE(kPartialPushPromiseFrameData));
// Compare the CONTINUATION frame against the template.
frame_data += kHttp2MaxControlFrameSendSize;
CompareCharArraysWithHexError(
- kDescription, frame_data, QUICHE_ARRAYSIZE(kContinuationFrameData),
- kContinuationFrameData, QUICHE_ARRAYSIZE(kContinuationFrameData));
+ kDescription, frame_data, ABSL_ARRAYSIZE(kContinuationFrameData),
+ kContinuationFrameData, ABSL_ARRAYSIZE(kContinuationFrameData));
}
}
@@ -2493,7 +2490,7 @@ TEST_P(SpdyFramerTest, CreateAltSvc) {
EXPECT_EQ(framer_.SerializeFrame(altsvc_ir, &output_), frame.size());
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
- CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ CompareFrame(kDescription, frame, kFrameData, ABSL_ARRAYSIZE(kFrameData));
}
TEST_P(SpdyFramerTest, CreatePriority) {
@@ -2515,7 +2512,7 @@ TEST_P(SpdyFramerTest, CreatePriority) {
EXPECT_EQ(framer_.SerializeFrame(priority_ir, &output_), frame.size());
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
- CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ CompareFrame(kDescription, frame, kFrameData, ABSL_ARRAYSIZE(kFrameData));
}
TEST_P(SpdyFramerTest, CreateUnknown) {
@@ -2542,7 +2539,7 @@ TEST_P(SpdyFramerTest, CreateUnknown) {
EXPECT_EQ(framer_.SerializeFrame(unknown_ir, &output_), frame.size());
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
- CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ CompareFrame(kDescription, frame, kFrameData, ABSL_ARRAYSIZE(kFrameData));
}
// Test serialization of a SpdyUnknownIR with a defined type, a length field
@@ -2574,7 +2571,7 @@ TEST_P(SpdyFramerTest, CreateUnknownUnchecked) {
EXPECT_EQ(framer_.SerializeFrame(unknown_ir, &output_), frame.size());
frame = SpdySerializedFrame(output_.Begin(), output_.Size(), false);
}
- CompareFrame(kDescription, frame, kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ CompareFrame(kDescription, frame, kFrameData, ABSL_ARRAYSIZE(kFrameData));
}
TEST_P(SpdyFramerTest, ReadCompressedHeadersHeaderBlock) {
@@ -3610,7 +3607,7 @@ TEST_P(SpdyFramerTest, ReadUnknownExtensionFrame) {
// Simulate the case where the stream id validation checks out.
visitor.on_unknown_frame_result_ = true;
- visitor.SimulateInFramer(unknown_frame, QUICHE_ARRAYSIZE(unknown_frame));
+ visitor.SimulateInFramer(unknown_frame, ABSL_ARRAYSIZE(unknown_frame));
EXPECT_EQ(0, visitor.error_count_);
// Follow it up with a valid control frame to make sure we handle
@@ -3646,7 +3643,7 @@ TEST_P(SpdyFramerTest, ReadUnknownExtensionFrameWithExtension) {
TestSpdyVisitor visitor(SpdyFramer::DISABLE_COMPRESSION);
TestExtension extension;
visitor.set_extension_visitor(&extension);
- visitor.SimulateInFramer(unknown_frame, QUICHE_ARRAYSIZE(unknown_frame));
+ visitor.SimulateInFramer(unknown_frame, ABSL_ARRAYSIZE(unknown_frame));
EXPECT_EQ(0, visitor.error_count_);
EXPECT_EQ(0x7fffffffu, extension.stream_id_);
EXPECT_EQ(20u, extension.length_);
@@ -3677,7 +3674,7 @@ TEST_P(SpdyFramerTest, ReadGarbageWithValidLength) {
0xff, 0xff, 0xff, 0xff, //
};
TestSpdyVisitor visitor(SpdyFramer::DISABLE_COMPRESSION);
- visitor.SimulateInFramer(kFrameData, QUICHE_ARRAYSIZE(kFrameData));
+ visitor.SimulateInFramer(kFrameData, ABSL_ARRAYSIZE(kFrameData));
EXPECT_EQ(1, visitor.error_count_);
}
@@ -3696,7 +3693,7 @@ TEST_P(SpdyFramerTest, ReadGarbageHPACKEncoding) {
};
TestSpdyVisitor visitor(SpdyFramer::DISABLE_COMPRESSION);
- visitor.SimulateInFramer(kInput, QUICHE_ARRAYSIZE(kInput));
+ visitor.SimulateInFramer(kInput, ABSL_ARRAYSIZE(kInput));
EXPECT_EQ(1, visitor.error_count_);
}
@@ -4221,7 +4218,7 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
EXPECT_CALL(visitor, OnRstStream(1, ERROR_CODE_NO_ERROR));
deframer_.ProcessInput(reinterpret_cast<const char*>(kH2RstStreamInvalid),
- QUICHE_ARRAYSIZE(kH2RstStreamInvalid));
+ ABSL_ARRAYSIZE(kH2RstStreamInvalid));
EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state());
EXPECT_EQ(Http2DecoderAdapter::SPDY_NO_ERROR, deframer_.spdy_framer_error())
<< Http2DecoderAdapter::SpdyFramerErrorToString(
@@ -4231,7 +4228,7 @@ TEST_P(SpdyFramerTest, RstStreamStatusBounds) {
EXPECT_CALL(visitor, OnRstStream(1, ERROR_CODE_INTERNAL_ERROR));
deframer_.ProcessInput(
reinterpret_cast<const char*>(kH2RstStreamNumStatusCodes),
- QUICHE_ARRAYSIZE(kH2RstStreamNumStatusCodes));
+ ABSL_ARRAYSIZE(kH2RstStreamNumStatusCodes));
EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state());
EXPECT_EQ(Http2DecoderAdapter::SPDY_NO_ERROR, deframer_.spdy_framer_error())
<< Http2DecoderAdapter::SpdyFramerErrorToString(
@@ -4254,7 +4251,7 @@ TEST_P(SpdyFramerTest, GoAwayStatusBounds) {
EXPECT_CALL(visitor, OnGoAway(1, ERROR_CODE_INTERNAL_ERROR));
deframer_.ProcessInput(reinterpret_cast<const char*>(kH2FrameData),
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state());
EXPECT_EQ(Http2DecoderAdapter::SPDY_NO_ERROR, deframer_.spdy_framer_error())
<< Http2DecoderAdapter::SpdyFramerErrorToString(
@@ -4278,7 +4275,7 @@ TEST_P(SpdyFramerTest, GoAwayStreamIdBounds) {
EXPECT_CALL(visitor, OnGoAway(0x7fffffff, ERROR_CODE_NO_ERROR));
deframer_.ProcessInput(reinterpret_cast<const char*>(kH2FrameData),
- QUICHE_ARRAYSIZE(kH2FrameData));
+ ABSL_ARRAYSIZE(kH2FrameData));
EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state());
EXPECT_EQ(Http2DecoderAdapter::SPDY_NO_ERROR, deframer_.spdy_framer_error())
<< Http2DecoderAdapter::SpdyFramerErrorToString(
@@ -4299,8 +4296,8 @@ TEST_P(SpdyFramerTest, OnAltSvcWithOrigin) {
SpdyAltSvcWireFormat::AlternativeServiceVector altsvc_vector;
altsvc_vector.push_back(altsvc1);
altsvc_vector.push_back(altsvc2);
- EXPECT_CALL(visitor, OnAltSvc(kStreamId, quiche::QuicheStringPiece("o_r|g!n"),
- altsvc_vector));
+ EXPECT_CALL(visitor,
+ OnAltSvc(kStreamId, absl::string_view("o_r|g!n"), altsvc_vector));
SpdyAltSvcIR altsvc_ir(kStreamId);
altsvc_ir.set_origin("o_r|g!n");
@@ -4334,8 +4331,8 @@ TEST_P(SpdyFramerTest, OnAltSvcNoOrigin) {
SpdyAltSvcWireFormat::AlternativeServiceVector altsvc_vector;
altsvc_vector.push_back(altsvc1);
altsvc_vector.push_back(altsvc2);
- EXPECT_CALL(visitor, OnAltSvc(kStreamId, quiche::QuicheStringPiece(""),
- altsvc_vector));
+ EXPECT_CALL(visitor,
+ OnAltSvc(kStreamId, absl::string_view(""), altsvc_vector));
SpdyAltSvcIR altsvc_ir(kStreamId);
altsvc_ir.add_altsvc(altsvc1);
@@ -4771,8 +4768,7 @@ TEST_P(SpdyFramerTest, SpdyFrameIRSize) {
SpdyFramer framer(SpdyFramer::DISABLE_COMPRESSION);
const char bytes[] = "this is a very short data frame";
- SpdyDataIR data_ir(1,
- quiche::QuicheStringPiece(bytes, QUICHE_ARRAYSIZE(bytes)));
+ SpdyDataIR data_ir(1, absl::string_view(bytes, ABSL_ARRAYSIZE(bytes)));
CheckFrameAndIRSize(&data_ir, &framer, &output_);
SpdyRstStreamIR rst_ir(/* stream_id = */ 1, ERROR_CODE_PROTOCOL_ERROR);
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block.cc
index d7e3faa9ba0..23dd9996c34 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block.cc
@@ -27,35 +27,34 @@ const size_t kInitialMapBuckets = 11;
const char kCookieKey[] = "cookie";
const char kNullSeparator = 0;
-quiche::QuicheStringPiece SeparatorForKey(quiche::QuicheStringPiece key) {
+absl::string_view SeparatorForKey(absl::string_view key) {
if (key == kCookieKey) {
- static quiche::QuicheStringPiece cookie_separator = "; ";
+ static absl::string_view cookie_separator = "; ";
return cookie_separator;
} else {
- return quiche::QuicheStringPiece(&kNullSeparator, 1);
+ return absl::string_view(&kNullSeparator, 1);
}
}
} // namespace
-SpdyHeaderBlock::HeaderValue::HeaderValue(
- SpdyHeaderStorage* storage,
- quiche::QuicheStringPiece key,
- quiche::QuicheStringPiece initial_value)
+Http2HeaderBlock::HeaderValue::HeaderValue(SpdyHeaderStorage* storage,
+ absl::string_view key,
+ absl::string_view initial_value)
: storage_(storage),
fragments_({initial_value}),
pair_({key, {}}),
size_(initial_value.size()),
separator_size_(SeparatorForKey(key).size()) {}
-SpdyHeaderBlock::HeaderValue::HeaderValue(HeaderValue&& other)
+Http2HeaderBlock::HeaderValue::HeaderValue(HeaderValue&& other)
: storage_(other.storage_),
fragments_(std::move(other.fragments_)),
pair_(std::move(other.pair_)),
size_(other.size_),
separator_size_(other.separator_size_) {}
-SpdyHeaderBlock::HeaderValue& SpdyHeaderBlock::HeaderValue::operator=(
+Http2HeaderBlock::HeaderValue& Http2HeaderBlock::HeaderValue::operator=(
HeaderValue&& other) {
storage_ = other.storage_;
fragments_ = std::move(other.fragments_);
@@ -65,16 +64,15 @@ SpdyHeaderBlock::HeaderValue& SpdyHeaderBlock::HeaderValue::operator=(
return *this;
}
-void SpdyHeaderBlock::HeaderValue::set_storage(SpdyHeaderStorage* storage) {
+void Http2HeaderBlock::HeaderValue::set_storage(SpdyHeaderStorage* storage) {
storage_ = storage;
}
-SpdyHeaderBlock::HeaderValue::~HeaderValue() = default;
+Http2HeaderBlock::HeaderValue::~HeaderValue() = default;
-quiche::QuicheStringPiece SpdyHeaderBlock::HeaderValue::ConsolidatedValue()
- const {
+absl::string_view Http2HeaderBlock::HeaderValue::ConsolidatedValue() const {
if (fragments_.empty()) {
- return quiche::QuicheStringPiece();
+ return absl::string_view();
}
if (fragments_.size() > 1) {
fragments_ = {
@@ -83,27 +81,27 @@ quiche::QuicheStringPiece SpdyHeaderBlock::HeaderValue::ConsolidatedValue()
return fragments_[0];
}
-void SpdyHeaderBlock::HeaderValue::Append(quiche::QuicheStringPiece fragment) {
+void Http2HeaderBlock::HeaderValue::Append(absl::string_view fragment) {
size_ += (fragment.size() + separator_size_);
fragments_.push_back(fragment);
}
-const std::pair<quiche::QuicheStringPiece, quiche::QuicheStringPiece>&
-SpdyHeaderBlock::HeaderValue::as_pair() const {
+const std::pair<absl::string_view, absl::string_view>&
+Http2HeaderBlock::HeaderValue::as_pair() const {
pair_.second = ConsolidatedValue();
return pair_;
}
-SpdyHeaderBlock::iterator::iterator(MapType::const_iterator it) : it_(it) {}
+Http2HeaderBlock::iterator::iterator(MapType::const_iterator it) : it_(it) {}
-SpdyHeaderBlock::iterator::iterator(const iterator& other) = default;
+Http2HeaderBlock::iterator::iterator(const iterator& other) = default;
-SpdyHeaderBlock::iterator::~iterator() = default;
+Http2HeaderBlock::iterator::~iterator() = default;
-SpdyHeaderBlock::ValueProxy::ValueProxy(
- SpdyHeaderBlock* block,
- SpdyHeaderBlock::MapType::iterator lookup_result,
- const quiche::QuicheStringPiece key,
+Http2HeaderBlock::ValueProxy::ValueProxy(
+ Http2HeaderBlock* block,
+ Http2HeaderBlock::MapType::iterator lookup_result,
+ const absl::string_view key,
size_t* spdy_header_block_value_size)
: block_(block),
lookup_result_(lookup_result),
@@ -111,7 +109,7 @@ SpdyHeaderBlock::ValueProxy::ValueProxy(
spdy_header_block_value_size_(spdy_header_block_value_size),
valid_(true) {}
-SpdyHeaderBlock::ValueProxy::ValueProxy(ValueProxy&& other)
+Http2HeaderBlock::ValueProxy::ValueProxy(ValueProxy&& other)
: block_(other.block_),
lookup_result_(other.lookup_result_),
key_(other.key_),
@@ -120,8 +118,8 @@ SpdyHeaderBlock::ValueProxy::ValueProxy(ValueProxy&& other)
other.valid_ = false;
}
-SpdyHeaderBlock::ValueProxy& SpdyHeaderBlock::ValueProxy::operator=(
- SpdyHeaderBlock::ValueProxy&& other) {
+Http2HeaderBlock::ValueProxy& Http2HeaderBlock::ValueProxy::operator=(
+ Http2HeaderBlock::ValueProxy&& other) {
block_ = other.block_;
lookup_result_ = other.lookup_result_;
key_ = other.key_;
@@ -131,18 +129,18 @@ SpdyHeaderBlock::ValueProxy& SpdyHeaderBlock::ValueProxy::operator=(
return *this;
}
-SpdyHeaderBlock::ValueProxy::~ValueProxy() {
+Http2HeaderBlock::ValueProxy::~ValueProxy() {
// If the ValueProxy is destroyed while lookup_result_ == block_->end(),
// the assignment operator was never used, and the block's SpdyHeaderStorage
// can reclaim the memory used by the key. This makes lookup-only access to
- // SpdyHeaderBlock through operator[] memory-neutral.
+ // Http2HeaderBlock through operator[] memory-neutral.
if (valid_ && lookup_result_ == block_->map_.end()) {
block_->storage_.Rewind(key_);
}
}
-SpdyHeaderBlock::ValueProxy& SpdyHeaderBlock::ValueProxy::operator=(
- quiche::QuicheStringPiece value) {
+Http2HeaderBlock::ValueProxy& Http2HeaderBlock::ValueProxy::operator=(
+ absl::string_view value) {
*spdy_header_block_value_size_ += value.size();
SpdyHeaderStorage* storage = &block_->storage_;
if (lookup_result_ == block_->map_.end()) {
@@ -160,8 +158,7 @@ SpdyHeaderBlock::ValueProxy& SpdyHeaderBlock::ValueProxy::operator=(
return *this;
}
-bool SpdyHeaderBlock::ValueProxy::operator==(
- quiche::QuicheStringPiece value) const {
+bool Http2HeaderBlock::ValueProxy::operator==(absl::string_view value) const {
if (lookup_result_ == block_->map_.end()) {
return false;
} else {
@@ -169,7 +166,7 @@ bool SpdyHeaderBlock::ValueProxy::operator==(
}
}
-std::string SpdyHeaderBlock::ValueProxy::as_string() const {
+std::string Http2HeaderBlock::ValueProxy::as_string() const {
if (lookup_result_ == block_->map_.end()) {
return "";
} else {
@@ -177,9 +174,9 @@ std::string SpdyHeaderBlock::ValueProxy::as_string() const {
}
}
-SpdyHeaderBlock::SpdyHeaderBlock() : map_(kInitialMapBuckets) {}
+Http2HeaderBlock::Http2HeaderBlock() : map_(kInitialMapBuckets) {}
-SpdyHeaderBlock::SpdyHeaderBlock(SpdyHeaderBlock&& other)
+Http2HeaderBlock::Http2HeaderBlock(Http2HeaderBlock&& other)
: map_(kInitialMapBuckets) {
map_.swap(other.map_);
storage_ = std::move(other.storage_);
@@ -190,9 +187,9 @@ SpdyHeaderBlock::SpdyHeaderBlock(SpdyHeaderBlock&& other)
value_size_ = other.value_size_;
}
-SpdyHeaderBlock::~SpdyHeaderBlock() = default;
+Http2HeaderBlock::~Http2HeaderBlock() = default;
-SpdyHeaderBlock& SpdyHeaderBlock::operator=(SpdyHeaderBlock&& other) {
+Http2HeaderBlock& Http2HeaderBlock::operator=(Http2HeaderBlock&& other) {
map_.swap(other.map_);
storage_ = std::move(other.storage_);
for (auto& p : map_) {
@@ -203,23 +200,23 @@ SpdyHeaderBlock& SpdyHeaderBlock::operator=(SpdyHeaderBlock&& other) {
return *this;
}
-SpdyHeaderBlock SpdyHeaderBlock::Clone() const {
- SpdyHeaderBlock copy;
+Http2HeaderBlock Http2HeaderBlock::Clone() const {
+ Http2HeaderBlock copy;
for (const auto& p : *this) {
copy.AppendHeader(p.first, p.second);
}
return copy;
}
-bool SpdyHeaderBlock::operator==(const SpdyHeaderBlock& other) const {
+bool Http2HeaderBlock::operator==(const Http2HeaderBlock& other) const {
return size() == other.size() && std::equal(begin(), end(), other.begin());
}
-bool SpdyHeaderBlock::operator!=(const SpdyHeaderBlock& other) const {
+bool Http2HeaderBlock::operator!=(const Http2HeaderBlock& other) const {
return !(operator==(other));
}
-std::string SpdyHeaderBlock::DebugString() const {
+std::string Http2HeaderBlock::DebugString() const {
if (empty()) {
return "{}";
}
@@ -232,7 +229,7 @@ std::string SpdyHeaderBlock::DebugString() const {
return output;
}
-void SpdyHeaderBlock::erase(quiche::QuicheStringPiece key) {
+void Http2HeaderBlock::erase(absl::string_view key) {
auto iter = map_.find(key);
if (iter != map_.end()) {
SPDY_DVLOG(1) << "Erasing header with name: " << key;
@@ -242,14 +239,14 @@ void SpdyHeaderBlock::erase(quiche::QuicheStringPiece key) {
}
}
-void SpdyHeaderBlock::clear() {
+void Http2HeaderBlock::clear() {
key_size_ = 0;
value_size_ = 0;
map_.clear();
storage_.Clear();
}
-void SpdyHeaderBlock::insert(const SpdyHeaderBlock::value_type& value) {
+void Http2HeaderBlock::insert(const Http2HeaderBlock::value_type& value) {
// TODO(birenroy): Write new value in place of old value, if it fits.
value_size_ += value.second.size();
@@ -267,14 +264,14 @@ void SpdyHeaderBlock::insert(const SpdyHeaderBlock::value_type& value) {
}
}
-SpdyHeaderBlock::ValueProxy SpdyHeaderBlock::operator[](
- const quiche::QuicheStringPiece key) {
+Http2HeaderBlock::ValueProxy Http2HeaderBlock::operator[](
+ const absl::string_view key) {
SPDY_DVLOG(2) << "Operator[] saw key: " << key;
- quiche::QuicheStringPiece out_key;
+ absl::string_view out_key;
auto iter = map_.find(key);
if (iter == map_.end()) {
// We write the key first, to assure that the ValueProxy has a
- // reference to a valid QuicheStringPiece in its operator=.
+ // reference to a valid absl::string_view in its operator=.
out_key = WriteKey(key);
SPDY_DVLOG(2) << "Key written as: " << std::hex
<< static_cast<const void*>(key.data()) << ", " << std::dec
@@ -285,9 +282,8 @@ SpdyHeaderBlock::ValueProxy SpdyHeaderBlock::operator[](
return ValueProxy(this, iter, out_key, &value_size_);
}
-void SpdyHeaderBlock::AppendValueOrAddHeader(
- const quiche::QuicheStringPiece key,
- const quiche::QuicheStringPiece value) {
+void Http2HeaderBlock::AppendValueOrAddHeader(const absl::string_view key,
+ const absl::string_view value) {
value_size_ += value.size();
auto iter = map_.find(key);
@@ -303,26 +299,25 @@ void SpdyHeaderBlock::AppendValueOrAddHeader(
iter->second.Append(storage_.Write(value));
}
-size_t SpdyHeaderBlock::EstimateMemoryUsage() const {
+size_t Http2HeaderBlock::EstimateMemoryUsage() const {
// TODO(xunjieli): https://crbug.com/669108. Also include |map_| when EMU()
// supports linked_hash_map.
return SpdyEstimateMemoryUsage(storage_);
}
-void SpdyHeaderBlock::AppendHeader(const quiche::QuicheStringPiece key,
- const quiche::QuicheStringPiece value) {
+void Http2HeaderBlock::AppendHeader(const absl::string_view key,
+ const absl::string_view value) {
auto backed_key = WriteKey(key);
map_.emplace(std::make_pair(
backed_key, HeaderValue(&storage_, backed_key, storage_.Write(value))));
}
-quiche::QuicheStringPiece SpdyHeaderBlock::WriteKey(
- const quiche::QuicheStringPiece key) {
+absl::string_view Http2HeaderBlock::WriteKey(const absl::string_view key) {
key_size_ += key.size();
return storage_.Write(key);
}
-size_t SpdyHeaderBlock::bytes_allocated() const {
+size_t Http2HeaderBlock::bytes_allocated() const {
return storage_.bytes_allocated();
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block.h
index 2348551f567..8961b497e82 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block.h
@@ -13,8 +13,8 @@
#include <utility>
#include <vector>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_header_storage.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_macros.h"
@@ -23,7 +23,7 @@
namespace spdy {
namespace test {
-class SpdyHeaderBlockPeer;
+class Http2HeaderBlockPeer;
class ValueProxyPeer;
} // namespace test
@@ -39,22 +39,22 @@ class ValueProxyPeer;
// names and values. This data structure preserves insertion order.
//
// Under the hood, this data structure uses large, contiguous blocks of memory
-// to store names and values. Lookups may be performed with QuicheStringPiece
-// keys, and values are returned as QuicheStringPieces (via ValueProxy, below).
-// Value QuicheStringPieces are valid as long as the SpdyHeaderBlock exists;
-// allocated memory is never freed until SpdyHeaderBlock's destruction.
+// to store names and values. Lookups may be performed with absl::string_view
+// keys, and values are returned as absl::string_views (via ValueProxy, below).
+// Value absl::string_views are valid as long as the Http2HeaderBlock exists;
+// allocated memory is never freed until Http2HeaderBlock's destruction.
//
// This implementation does not make much of an effort to minimize wasted space.
-// It's expected that keys are rarely deleted from a SpdyHeaderBlock.
-class QUICHE_EXPORT_PRIVATE SpdyHeaderBlock {
+// It's expected that keys are rarely deleted from a Http2HeaderBlock.
+class QUICHE_EXPORT_PRIVATE Http2HeaderBlock {
private:
// Stores a list of value fragments that can be joined later with a
// key-dependent separator.
class QUICHE_EXPORT_PRIVATE HeaderValue {
public:
HeaderValue(SpdyHeaderStorage* storage,
- quiche::QuicheStringPiece key,
- quiche::QuicheStringPiece initial_value);
+ absl::string_view key,
+ absl::string_view initial_value);
// Moves are allowed.
HeaderValue(HeaderValue&& other);
@@ -69,50 +69,46 @@ class QUICHE_EXPORT_PRIVATE SpdyHeaderBlock {
~HeaderValue();
// Consumes at most |fragment.size()| bytes of memory.
- void Append(quiche::QuicheStringPiece fragment);
+ void Append(absl::string_view fragment);
- quiche::QuicheStringPiece value() const { return as_pair().second; }
- const std::pair<quiche::QuicheStringPiece, quiche::QuicheStringPiece>&
- as_pair() const;
+ absl::string_view value() const { return as_pair().second; }
+ const std::pair<absl::string_view, absl::string_view>& as_pair() const;
// Size estimate including separators. Used when keys are erased from
- // SpdyHeaderBlock.
+ // Http2HeaderBlock.
size_t SizeEstimate() const { return size_; }
private:
// May allocate a large contiguous region of memory to hold the concatenated
// fragments and separators.
- quiche::QuicheStringPiece ConsolidatedValue() const;
+ absl::string_view ConsolidatedValue() const;
mutable SpdyHeaderStorage* storage_;
- mutable std::vector<quiche::QuicheStringPiece> fragments_;
+ mutable std::vector<absl::string_view> fragments_;
// The first element is the key; the second is the consolidated value.
- mutable std::pair<quiche::QuicheStringPiece, quiche::QuicheStringPiece>
- pair_;
+ mutable std::pair<absl::string_view, absl::string_view> pair_;
size_t size_ = 0;
size_t separator_size_ = 0;
};
- typedef SpdyLinkedHashMap<quiche::QuicheStringPiece,
+ typedef SpdyLinkedHashMap<absl::string_view,
HeaderValue,
SpdyStringPieceCaseHash,
SpdyStringPieceCaseEq>
MapType;
public:
- typedef std::pair<quiche::QuicheStringPiece, quiche::QuicheStringPiece>
- value_type;
+ typedef std::pair<absl::string_view, absl::string_view> value_type;
- // Provides iteration over a sequence of std::pair<QuicheStringPiece,
- // QuicheStringPiece>, even though the underlying MapType::value_type is
+ // Provides iteration over a sequence of std::pair<absl::string_view,
+ // absl::string_view>, even though the underlying MapType::value_type is
// different. Dereferencing the iterator will result in memory allocation for
// multi-value headers.
class QUICHE_EXPORT_PRIVATE iterator {
public:
// The following type definitions fulfill the requirements for iterator
// implementations.
- typedef std::pair<quiche::QuicheStringPiece, quiche::QuicheStringPiece>
- value_type;
+ typedef std::pair<absl::string_view, absl::string_view> value_type;
typedef value_type& reference;
typedef value_type* pointer;
typedef std::forward_iterator_tag iterator_category;
@@ -162,17 +158,17 @@ class QUICHE_EXPORT_PRIVATE SpdyHeaderBlock {
};
typedef iterator const_iterator;
- SpdyHeaderBlock();
- SpdyHeaderBlock(const SpdyHeaderBlock& other) = delete;
- SpdyHeaderBlock(SpdyHeaderBlock&& other);
- ~SpdyHeaderBlock();
+ Http2HeaderBlock();
+ Http2HeaderBlock(const Http2HeaderBlock& other) = delete;
+ Http2HeaderBlock(Http2HeaderBlock&& other);
+ ~Http2HeaderBlock();
- SpdyHeaderBlock& operator=(const SpdyHeaderBlock& other) = delete;
- SpdyHeaderBlock& operator=(SpdyHeaderBlock&& other);
- SpdyHeaderBlock Clone() const;
+ Http2HeaderBlock& operator=(const Http2HeaderBlock& other) = delete;
+ Http2HeaderBlock& operator=(Http2HeaderBlock&& other);
+ Http2HeaderBlock Clone() const;
- bool operator==(const SpdyHeaderBlock& other) const;
- bool operator!=(const SpdyHeaderBlock& other) const;
+ bool operator==(const Http2HeaderBlock& other) const;
+ bool operator!=(const Http2HeaderBlock& other) const;
// Provides a human readable multi-line representation of the stored header
// keys and values.
@@ -184,13 +180,11 @@ class QUICHE_EXPORT_PRIVATE SpdyHeaderBlock {
const_iterator end() const { return wrap_const_iterator(map_.end()); }
bool empty() const { return map_.empty(); }
size_t size() const { return map_.size(); }
- iterator find(quiche::QuicheStringPiece key) {
- return wrap_iterator(map_.find(key));
- }
- const_iterator find(quiche::QuicheStringPiece key) const {
+ iterator find(absl::string_view key) { return wrap_iterator(map_.find(key)); }
+ const_iterator find(absl::string_view key) const {
return wrap_const_iterator(map_.find(key));
}
- void erase(quiche::QuicheStringPiece key);
+ void erase(absl::string_view key);
// Clears both our MapType member and the memory used to hold headers.
void clear();
@@ -205,11 +199,11 @@ class QUICHE_EXPORT_PRIVATE SpdyHeaderBlock {
// existing header value, NUL ("\0") separated unless the key is cookie, in
// which case the separator is "; ".
// If there is no such key, a new header with the key and value is added.
- void AppendValueOrAddHeader(const quiche::QuicheStringPiece key,
- const quiche::QuicheStringPiece value);
+ void AppendValueOrAddHeader(const absl::string_view key,
+ const absl::string_view value);
- // This object provides automatic conversions that allow SpdyHeaderBlock to be
- // nearly a drop-in replacement for
+ // This object provides automatic conversions that allow Http2HeaderBlock to
+ // be nearly a drop-in replacement for
// SpdyLinkedHashMap<std::string, std::string>.
// It reads data from or writes data to a SpdyHeaderStorage.
class QUICHE_EXPORT_PRIVATE ValueProxy {
@@ -224,33 +218,32 @@ class QUICHE_EXPORT_PRIVATE SpdyHeaderBlock {
ValueProxy(const ValueProxy& other) = delete;
ValueProxy& operator=(const ValueProxy& other) = delete;
- // Assignment modifies the underlying SpdyHeaderBlock.
- ValueProxy& operator=(quiche::QuicheStringPiece value);
+ // Assignment modifies the underlying Http2HeaderBlock.
+ ValueProxy& operator=(absl::string_view value);
- // Provides easy comparison against QuicheStringPiece.
- bool operator==(quiche::QuicheStringPiece value) const;
+ // Provides easy comparison against absl::string_view.
+ bool operator==(absl::string_view value) const;
std::string as_string() const;
private:
- friend class SpdyHeaderBlock;
+ friend class Http2HeaderBlock;
friend class test::ValueProxyPeer;
- ValueProxy(SpdyHeaderBlock* block,
- SpdyHeaderBlock::MapType::iterator lookup_result,
- const quiche::QuicheStringPiece key,
+ ValueProxy(Http2HeaderBlock* block,
+ Http2HeaderBlock::MapType::iterator lookup_result,
+ const absl::string_view key,
size_t* spdy_header_block_value_size);
- SpdyHeaderBlock* block_;
- SpdyHeaderBlock::MapType::iterator lookup_result_;
- quiche::QuicheStringPiece key_;
+ Http2HeaderBlock* block_;
+ Http2HeaderBlock::MapType::iterator lookup_result_;
+ absl::string_view key_;
size_t* spdy_header_block_value_size_;
bool valid_;
};
// Allows either lookup or mutation of the value associated with a key.
- SPDY_MUST_USE_RESULT ValueProxy
- operator[](const quiche::QuicheStringPiece key);
+ SPDY_MUST_USE_RESULT ValueProxy operator[](const absl::string_view key);
// Returns the estimate of dynamically allocated memory in bytes.
size_t EstimateMemoryUsage() const;
@@ -258,7 +251,7 @@ class QUICHE_EXPORT_PRIVATE SpdyHeaderBlock {
size_t TotalBytesUsed() const { return key_size_ + value_size_; }
private:
- friend class test::SpdyHeaderBlockPeer;
+ friend class test::Http2HeaderBlockPeer;
inline iterator wrap_iterator(MapType::const_iterator inner_iterator) const {
#if SPDY_HEADER_DEBUG
@@ -285,12 +278,11 @@ class QUICHE_EXPORT_PRIVATE SpdyHeaderBlock {
#endif // SPDY_HEADER_DEBUG
}
- void AppendHeader(const quiche::QuicheStringPiece key,
- const quiche::QuicheStringPiece value);
- quiche::QuicheStringPiece WriteKey(const quiche::QuicheStringPiece key);
+ void AppendHeader(const absl::string_view key, const absl::string_view value);
+ absl::string_view WriteKey(const absl::string_view key);
size_t bytes_allocated() const;
- // QuicheStringPieces held by |map_| point to memory owned by |storage_|.
+ // absl::string_views held by |map_| point to memory owned by |storage_|.
MapType map_;
SpdyHeaderStorage storage_;
@@ -298,6 +290,9 @@ class QUICHE_EXPORT_PRIVATE SpdyHeaderBlock {
size_t value_size_ = 0;
};
+// TODO(b/156770486): Remove this alias when the rename is complete.
+using SpdyHeaderBlock = Http2HeaderBlock;
+
} // namespace spdy
#endif // QUICHE_SPDY_CORE_SPDY_HEADER_BLOCK_H_
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block_test.cc
index b670c2ae650..9fd7b6871c5 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_block_test.cc
@@ -17,20 +17,19 @@ namespace test {
class ValueProxyPeer {
public:
- static quiche::QuicheStringPiece key(SpdyHeaderBlock::ValueProxy* p) {
+ static absl::string_view key(Http2HeaderBlock::ValueProxy* p) {
return p->key_;
}
};
-std::pair<quiche::QuicheStringPiece, quiche::QuicheStringPiece> Pair(
- quiche::QuicheStringPiece k,
- quiche::QuicheStringPiece v) {
+std::pair<absl::string_view, absl::string_view> Pair(absl::string_view k,
+ absl::string_view v) {
return std::make_pair(k, v);
}
-// This test verifies that SpdyHeaderBlock behaves correctly when empty.
-TEST(SpdyHeaderBlockTest, EmptyBlock) {
- SpdyHeaderBlock block;
+// This test verifies that Http2HeaderBlock behaves correctly when empty.
+TEST(Http2HeaderBlockTest, EmptyBlock) {
+ Http2HeaderBlock block;
EXPECT_TRUE(block.empty());
EXPECT_EQ(0u, block.size());
EXPECT_EQ(block.end(), block.find("foo"));
@@ -40,21 +39,21 @@ TEST(SpdyHeaderBlockTest, EmptyBlock) {
block.erase("bar");
}
-TEST(SpdyHeaderBlockTest, KeyMemoryReclaimedOnLookup) {
- SpdyHeaderBlock block;
- quiche::QuicheStringPiece copied_key1;
+TEST(Http2HeaderBlockTest, KeyMemoryReclaimedOnLookup) {
+ Http2HeaderBlock block;
+ absl::string_view copied_key1;
{
auto proxy1 = block["some key name"];
copied_key1 = ValueProxyPeer::key(&proxy1);
}
- quiche::QuicheStringPiece copied_key2;
+ absl::string_view copied_key2;
{
auto proxy2 = block["some other key name"];
copied_key2 = ValueProxyPeer::key(&proxy2);
}
// Because proxy1 was never used to modify the block, the memory used for the
// key could be reclaimed and used for the second call to operator[].
- // Therefore, we expect the pointers of the two QuicheStringPieces to be
+ // Therefore, we expect the pointers of the two absl::string_views to be
// equal.
EXPECT_EQ(copied_key1.data(), copied_key2.data());
@@ -63,7 +62,7 @@ TEST(SpdyHeaderBlockTest, KeyMemoryReclaimedOnLookup) {
block["some other key name"] = "some value";
}
// Nothing should blow up when proxy1 is destructed, and we should be able to
- // modify and access the SpdyHeaderBlock.
+ // modify and access the Http2HeaderBlock.
block["key"] = "value";
EXPECT_EQ("value", block["key"]);
EXPECT_EQ("some value", block["some other key name"]);
@@ -71,8 +70,8 @@ TEST(SpdyHeaderBlockTest, KeyMemoryReclaimedOnLookup) {
}
// This test verifies that headers can be set in a variety of ways.
-TEST(SpdyHeaderBlockTest, AddHeaders) {
- SpdyHeaderBlock block;
+TEST(Http2HeaderBlockTest, AddHeaders) {
+ Http2HeaderBlock block;
block["foo"] = std::string(300, 'x');
block["bar"] = "baz";
block["qux"] = "qux1";
@@ -90,29 +89,29 @@ TEST(SpdyHeaderBlockTest, AddHeaders) {
EXPECT_EQ(block.end(), block.find("key"));
}
-// This test verifies that SpdyHeaderBlock can be copied using Clone().
-TEST(SpdyHeaderBlockTest, CopyBlocks) {
- SpdyHeaderBlock block1;
+// This test verifies that Http2HeaderBlock can be copied using Clone().
+TEST(Http2HeaderBlockTest, CopyBlocks) {
+ Http2HeaderBlock block1;
block1["foo"] = std::string(300, 'x');
block1["bar"] = "baz";
block1.insert(std::make_pair("qux", "qux1"));
- SpdyHeaderBlock block2 = block1.Clone();
- SpdyHeaderBlock block3(block1.Clone());
+ Http2HeaderBlock block2 = block1.Clone();
+ Http2HeaderBlock block3(block1.Clone());
EXPECT_EQ(block1, block2);
EXPECT_EQ(block1, block3);
}
-TEST(SpdyHeaderBlockTest, Equality) {
+TEST(Http2HeaderBlockTest, Equality) {
// Test equality and inequality operators.
- SpdyHeaderBlock block1;
+ Http2HeaderBlock block1;
block1["foo"] = "bar";
- SpdyHeaderBlock block2;
+ Http2HeaderBlock block2;
block2["foo"] = "bar";
- SpdyHeaderBlock block3;
+ Http2HeaderBlock block3;
block3["baz"] = "qux";
EXPECT_EQ(block1, block2);
@@ -122,28 +121,28 @@ TEST(SpdyHeaderBlockTest, Equality) {
EXPECT_NE(block1, block2);
}
-SpdyHeaderBlock ReturnTestHeaderBlock() {
- SpdyHeaderBlock block;
+Http2HeaderBlock ReturnTestHeaderBlock() {
+ Http2HeaderBlock block;
block["foo"] = "bar";
block.insert(std::make_pair("foo2", "baz"));
return block;
}
// Test that certain methods do not crash on moved-from instances.
-TEST(SpdyHeaderBlockTest, MovedFromIsValid) {
- SpdyHeaderBlock block1;
+TEST(Http2HeaderBlockTest, MovedFromIsValid) {
+ Http2HeaderBlock block1;
block1["foo"] = "bar";
- SpdyHeaderBlock block2(std::move(block1));
+ Http2HeaderBlock block2(std::move(block1));
EXPECT_THAT(block2, ElementsAre(Pair("foo", "bar")));
block1["baz"] = "qux"; // NOLINT testing post-move behavior
- SpdyHeaderBlock block3(std::move(block1));
+ Http2HeaderBlock block3(std::move(block1));
block1["foo"] = "bar"; // NOLINT testing post-move behavior
- SpdyHeaderBlock block4(std::move(block1));
+ Http2HeaderBlock block4(std::move(block1));
block1.clear(); // NOLINT testing post-move behavior
EXPECT_TRUE(block1.empty());
@@ -151,7 +150,7 @@ TEST(SpdyHeaderBlockTest, MovedFromIsValid) {
block1["foo"] = "bar";
EXPECT_THAT(block1, ElementsAre(Pair("foo", "bar")));
- SpdyHeaderBlock block5 = ReturnTestHeaderBlock();
+ Http2HeaderBlock block5 = ReturnTestHeaderBlock();
block5.AppendValueOrAddHeader("foo", "bar2");
EXPECT_THAT(block5, ElementsAre(Pair("foo", std::string("bar\0bar2", 8)),
Pair("foo2", "baz")));
@@ -159,8 +158,8 @@ TEST(SpdyHeaderBlockTest, MovedFromIsValid) {
// This test verifies that headers can be appended to no matter how they were
// added originally.
-TEST(SpdyHeaderBlockTest, AppendHeaders) {
- SpdyHeaderBlock block;
+TEST(Http2HeaderBlockTest, AppendHeaders) {
+ Http2HeaderBlock block;
block["foo"] = "foo";
block.AppendValueOrAddHeader("foo", "bar");
EXPECT_EQ(Pair("foo", std::string("foo\0bar", 7)), *block.find("foo"));
@@ -193,31 +192,31 @@ TEST(SpdyHeaderBlockTest, AppendHeaders) {
EXPECT_EQ("singleton", block["h4"]);
}
-TEST(SpdyHeaderBlockTest, CompareValueToStringPiece) {
- SpdyHeaderBlock block;
+TEST(Http2HeaderBlockTest, CompareValueToStringPiece) {
+ Http2HeaderBlock block;
block["foo"] = "foo";
block.AppendValueOrAddHeader("foo", "bar");
const auto& val = block["foo"];
const char expected[] = "foo\0bar";
- EXPECT_TRUE(quiche::QuicheStringPiece(expected, 7) == val);
- EXPECT_TRUE(val == quiche::QuicheStringPiece(expected, 7));
- EXPECT_FALSE(quiche::QuicheStringPiece(expected, 3) == val);
- EXPECT_FALSE(val == quiche::QuicheStringPiece(expected, 3));
+ EXPECT_TRUE(absl::string_view(expected, 7) == val);
+ EXPECT_TRUE(val == absl::string_view(expected, 7));
+ EXPECT_FALSE(absl::string_view(expected, 3) == val);
+ EXPECT_FALSE(val == absl::string_view(expected, 3));
const char not_expected[] = "foo\0barextra";
- EXPECT_FALSE(quiche::QuicheStringPiece(not_expected, 12) == val);
- EXPECT_FALSE(val == quiche::QuicheStringPiece(not_expected, 12));
+ EXPECT_FALSE(absl::string_view(not_expected, 12) == val);
+ EXPECT_FALSE(val == absl::string_view(not_expected, 12));
const auto& val2 = block["foo2"];
- EXPECT_FALSE(quiche::QuicheStringPiece(expected, 7) == val2);
- EXPECT_FALSE(val2 == quiche::QuicheStringPiece(expected, 7));
- EXPECT_FALSE(quiche::QuicheStringPiece("") == val2);
- EXPECT_FALSE(val2 == quiche::QuicheStringPiece(""));
+ EXPECT_FALSE(absl::string_view(expected, 7) == val2);
+ EXPECT_FALSE(val2 == absl::string_view(expected, 7));
+ EXPECT_FALSE(absl::string_view("") == val2);
+ EXPECT_FALSE(val2 == absl::string_view(""));
}
-// This test demonstrates that the SpdyHeaderBlock data structure does not place
-// any limitations on the characters present in the header names.
-TEST(SpdyHeaderBlockTest, UpperCaseNames) {
- SpdyHeaderBlock block;
+// This test demonstrates that the Http2HeaderBlock data structure does not
+// place any limitations on the characters present in the header names.
+TEST(Http2HeaderBlockTest, UpperCaseNames) {
+ Http2HeaderBlock block;
block["Foo"] = "foo";
block.AppendValueOrAddHeader("Foo", "bar");
EXPECT_NE(block.end(), block.find("foo"));
@@ -231,7 +230,7 @@ TEST(SpdyHeaderBlockTest, UpperCaseNames) {
}
namespace {
-size_t SpdyHeaderBlockSize(const SpdyHeaderBlock& block) {
+size_t Http2HeaderBlockSize(const Http2HeaderBlock& block) {
size_t size = 0;
for (const auto& pair : block) {
size += pair.first.size() + pair.second.size();
@@ -240,38 +239,38 @@ size_t SpdyHeaderBlockSize(const SpdyHeaderBlock& block) {
}
} // namespace
-// Tests SpdyHeaderBlock SizeEstimate().
-TEST(SpdyHeaderBlockTest, TotalBytesUsed) {
- SpdyHeaderBlock block;
+// Tests Http2HeaderBlock SizeEstimate().
+TEST(Http2HeaderBlockTest, TotalBytesUsed) {
+ Http2HeaderBlock block;
const size_t value_size = 300;
block["foo"] = std::string(value_size, 'x');
- EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+ EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
block.insert(std::make_pair("key", std::string(value_size, 'x')));
- EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+ EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
block.AppendValueOrAddHeader("abc", std::string(value_size, 'x'));
- EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+ EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
// Replace value for existing key.
block["foo"] = std::string(value_size, 'x');
- EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+ EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
block.insert(std::make_pair("key", std::string(value_size, 'x')));
- EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+ EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
// Add value for existing key.
block.AppendValueOrAddHeader("abc", std::string(value_size, 'x'));
- EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block));
+ EXPECT_EQ(block.TotalBytesUsed(), Http2HeaderBlockSize(block));
- // Copies/clones SpdyHeaderBlock.
+ // Copies/clones Http2HeaderBlock.
size_t block_size = block.TotalBytesUsed();
- SpdyHeaderBlock block_copy = std::move(block);
+ Http2HeaderBlock block_copy = std::move(block);
EXPECT_EQ(block_size, block_copy.TotalBytesUsed());
// Erases key.
block_copy.erase("foo");
- EXPECT_EQ(block_copy.TotalBytesUsed(), SpdyHeaderBlockSize(block_copy));
+ EXPECT_EQ(block_copy.TotalBytesUsed(), Http2HeaderBlockSize(block_copy));
block_copy.erase("key");
- EXPECT_EQ(block_copy.TotalBytesUsed(), SpdyHeaderBlockSize(block_copy));
+ EXPECT_EQ(block_copy.TotalBytesUsed(), Http2HeaderBlockSize(block_copy));
block_copy.erase("abc");
- EXPECT_EQ(block_copy.TotalBytesUsed(), SpdyHeaderBlockSize(block_copy));
+ EXPECT_EQ(block_copy.TotalBytesUsed(), Http2HeaderBlockSize(block_copy));
}
} // namespace test
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage.cc
index 90493e11b5a..29ed0a45b87 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage.cc
@@ -14,34 +14,33 @@ const size_t kDefaultStorageBlockSize = 2048;
SpdyHeaderStorage::SpdyHeaderStorage() : arena_(kDefaultStorageBlockSize) {}
-quiche::QuicheStringPiece SpdyHeaderStorage::Write(
- const quiche::QuicheStringPiece s) {
- return quiche::QuicheStringPiece(arena_.Memdup(s.data(), s.size()), s.size());
+absl::string_view SpdyHeaderStorage::Write(const absl::string_view s) {
+ return absl::string_view(arena_.Memdup(s.data(), s.size()), s.size());
}
-void SpdyHeaderStorage::Rewind(const quiche::QuicheStringPiece s) {
+void SpdyHeaderStorage::Rewind(const absl::string_view s) {
arena_.Free(const_cast<char*>(s.data()), s.size());
}
-quiche::QuicheStringPiece SpdyHeaderStorage::WriteFragments(
- const std::vector<quiche::QuicheStringPiece>& fragments,
- quiche::QuicheStringPiece separator) {
+absl::string_view SpdyHeaderStorage::WriteFragments(
+ const std::vector<absl::string_view>& fragments,
+ absl::string_view separator) {
if (fragments.empty()) {
- return quiche::QuicheStringPiece();
+ return absl::string_view();
}
size_t total_size = separator.size() * (fragments.size() - 1);
- for (const quiche::QuicheStringPiece& fragment : fragments) {
+ for (const absl::string_view& fragment : fragments) {
total_size += fragment.size();
}
char* dst = arena_.Alloc(total_size);
size_t written = Join(dst, fragments, separator);
DCHECK_EQ(written, total_size);
- return quiche::QuicheStringPiece(dst, total_size);
+ return absl::string_view(dst, total_size);
}
size_t Join(char* dst,
- const std::vector<quiche::QuicheStringPiece>& fragments,
- quiche::QuicheStringPiece separator) {
+ const std::vector<absl::string_view>& fragments,
+ absl::string_view separator) {
if (fragments.empty()) {
return 0;
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage.h
index aace3c06ab4..4e5a6abe7ef 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage.h
@@ -1,15 +1,15 @@
#ifndef QUICHE_SPDY_CORE_SPDY_HEADER_STORAGE_H_
#define QUICHE_SPDY_CORE_SPDY_HEADER_STORAGE_H_
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_simple_arena.h"
namespace spdy {
-// This class provides a backing store for QuicheStringPieces. It previously
+// This class provides a backing store for absl::string_views. It previously
// used custom allocation logic, but now uses an UnsafeArena instead. It has the
-// property that QuicheStringPieces that refer to data in SpdyHeaderStorage are
+// property that absl::string_views that refer to data in SpdyHeaderStorage are
// never invalidated until the SpdyHeaderStorage is deleted or Clear() is
// called.
//
@@ -26,20 +26,20 @@ class QUICHE_EXPORT_PRIVATE SpdyHeaderStorage {
SpdyHeaderStorage(SpdyHeaderStorage&& other) = default;
SpdyHeaderStorage& operator=(SpdyHeaderStorage&& other) = default;
- quiche::QuicheStringPiece Write(quiche::QuicheStringPiece s);
+ absl::string_view Write(absl::string_view s);
// If |s| points to the most recent allocation from arena_, the arena will
// reclaim the memory. Otherwise, this method is a no-op.
- void Rewind(quiche::QuicheStringPiece s);
+ void Rewind(absl::string_view s);
void Clear() { arena_.Reset(); }
// Given a list of fragments and a separator, writes the fragments joined by
- // the separator to a contiguous region of memory. Returns a QuicheStringPiece
+ // the separator to a contiguous region of memory. Returns a absl::string_view
// pointing to the region of memory.
- quiche::QuicheStringPiece WriteFragments(
- const std::vector<quiche::QuicheStringPiece>& fragments,
- quiche::QuicheStringPiece separator);
+ absl::string_view WriteFragments(
+ const std::vector<absl::string_view>& fragments,
+ absl::string_view separator);
size_t bytes_allocated() const { return arena_.status().bytes_allocated(); }
@@ -53,8 +53,8 @@ class QUICHE_EXPORT_PRIVATE SpdyHeaderStorage {
// enough to hold the result. Returns the number of bytes written.
QUICHE_EXPORT_PRIVATE size_t
Join(char* dst,
- const std::vector<quiche::QuicheStringPiece>& fragments,
- quiche::QuicheStringPiece separator);
+ const std::vector<absl::string_view>& fragments,
+ absl::string_view separator);
} // namespace spdy
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage_test.cc
index 71af6be43aa..af8cd06bb5a 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_header_storage_test.cc
@@ -6,29 +6,29 @@ namespace spdy {
namespace test {
TEST(JoinTest, JoinEmpty) {
- std::vector<quiche::QuicheStringPiece> empty;
- quiche::QuicheStringPiece separator = ", ";
+ std::vector<absl::string_view> empty;
+ absl::string_view separator = ", ";
char buf[10] = "";
size_t written = Join(buf, empty, separator);
EXPECT_EQ(0u, written);
}
TEST(JoinTest, JoinOne) {
- std::vector<quiche::QuicheStringPiece> v = {"one"};
- quiche::QuicheStringPiece separator = ", ";
+ std::vector<absl::string_view> v = {"one"};
+ absl::string_view separator = ", ";
char buf[15];
size_t written = Join(buf, v, separator);
EXPECT_EQ(3u, written);
- EXPECT_EQ("one", quiche::QuicheStringPiece(buf, written));
+ EXPECT_EQ("one", absl::string_view(buf, written));
}
TEST(JoinTest, JoinMultiple) {
- std::vector<quiche::QuicheStringPiece> v = {"one", "two", "three"};
- quiche::QuicheStringPiece separator = ", ";
+ std::vector<absl::string_view> v = {"one", "two", "three"};
+ absl::string_view separator = ", ";
char buf[15];
size_t written = Join(buf, v, separator);
EXPECT_EQ(15u, written);
- EXPECT_EQ("one, two, three", quiche::QuicheStringPiece(buf, written));
+ EXPECT_EQ("one, two, three", absl::string_view(buf, written));
}
} // namespace test
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_headers_handler_interface.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_headers_handler_interface.h
index 870997758be..39bda07dc6b 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_headers_handler_interface.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_headers_handler_interface.h
@@ -7,8 +7,8 @@
#include <stddef.h>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace spdy {
@@ -25,8 +25,7 @@ class QUICHE_EXPORT_PRIVATE SpdyHeadersHandlerInterface {
// A callback method which notifies on a header key value pair. Multiple
// values for a given key will be emitted as multiple calls to OnHeader.
- virtual void OnHeader(quiche::QuicheStringPiece key,
- quiche::QuicheStringPiece value) = 0;
+ virtual void OnHeader(absl::string_view key, absl::string_view value) = 0;
// A callback method which notifies when the parser finishes handling a
// header block (i.e. the containing frame has the END_HEADERS flag set).
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_intrusive_list_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_intrusive_list_test.cc
index e158d44a7f3..5f5243bddb3 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_intrusive_list_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_intrusive_list_test.cc
@@ -409,8 +409,7 @@ TEST(NewIntrusiveListTest, HandleInheritanceHierarchies) {
}
}
-
-class IntrusiveListTagTypeTest : public testing::Test {
+class IntrusiveListTagTypeTest : public QuicheTest {
protected:
struct Tag {};
class Element : public SpdyIntrusiveLink<Element, Tag> {};
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_no_op_visitor.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_no_op_visitor.h
index 93a32357719..26bab9cba8b 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_no_op_visitor.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_no_op_visitor.h
@@ -11,7 +11,7 @@
#include <cstdint>
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/spdy/core/http2_frame_decoder_adapter.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
@@ -61,7 +61,7 @@ class SpdyNoOpVisitor : public SpdyFramerVisitorInterface,
bool /*end*/) override {}
void OnContinuation(SpdyStreamId /*stream_id*/, bool /*end*/) override {}
void OnAltSvc(SpdyStreamId /*stream_id*/,
- quiche::QuicheStringPiece /*origin*/,
+ absl::string_view /*origin*/,
const SpdyAltSvcWireFormat::AlternativeServiceVector&
/*altsvc_vector*/) override {}
void OnPriority(SpdyStreamId /*stream_id*/,
@@ -82,8 +82,8 @@ class SpdyNoOpVisitor : public SpdyFramerVisitorInterface,
// SpdyHeadersHandlerInterface methods:
void OnHeaderBlockStart() override {}
- void OnHeader(quiche::QuicheStringPiece /*key*/,
- quiche::QuicheStringPiece /*value*/) override {}
+ void OnHeader(absl::string_view /*key*/,
+ absl::string_view /*value*/) override {}
void OnHeaderBlockEnd(size_t /* uncompressed_header_bytes */,
size_t /* compressed_header_bytes */) override {}
};
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece.h
index fe9639f73f2..2822410da55 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece.h
@@ -9,8 +9,8 @@
#include <memory>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
namespace spdy {
@@ -27,8 +27,8 @@ struct QUICHE_EXPORT_PRIVATE SpdyPinnableBufferPiece {
const char* buffer() const { return buffer_; }
- explicit operator quiche::QuicheStringPiece() const {
- return quiche::QuicheStringPiece(buffer_, length_);
+ explicit operator absl::string_view() const {
+ return absl::string_view(buffer_, length_);
}
// Allocates and copies the buffer to internal storage.
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece_test.cc
index b30a7c0d916..42329d788a3 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece_test.cc
@@ -31,16 +31,14 @@ TEST_F(SpdyPinnableBufferPieceTest, Pin) {
EXPECT_TRUE(reader.ReadN(6, &piece));
// Piece points to underlying prefix storage.
- EXPECT_EQ(quiche::QuicheStringPiece("foobar"),
- quiche::QuicheStringPiece(piece));
+ EXPECT_EQ(absl::string_view("foobar"), absl::string_view(piece));
EXPECT_FALSE(piece.IsPinned());
EXPECT_EQ(prefix_.data(), piece.buffer());
piece.Pin();
// Piece now points to allocated storage.
- EXPECT_EQ(quiche::QuicheStringPiece("foobar"),
- quiche::QuicheStringPiece(piece));
+ EXPECT_EQ(absl::string_view("foobar"), absl::string_view(piece));
EXPECT_TRUE(piece.IsPinned());
EXPECT_NE(prefix_.data(), piece.buffer());
@@ -58,24 +56,22 @@ TEST_F(SpdyPinnableBufferPieceTest, Swap) {
piece1.Pin();
- EXPECT_EQ(quiche::QuicheStringPiece("foob"),
- quiche::QuicheStringPiece(piece1));
+ EXPECT_EQ(absl::string_view("foob"), absl::string_view(piece1));
EXPECT_TRUE(piece1.IsPinned());
- EXPECT_EQ(quiche::QuicheStringPiece("ar"), quiche::QuicheStringPiece(piece2));
+ EXPECT_EQ(absl::string_view("ar"), absl::string_view(piece2));
EXPECT_FALSE(piece2.IsPinned());
piece1.Swap(&piece2);
- EXPECT_EQ(quiche::QuicheStringPiece("ar"), quiche::QuicheStringPiece(piece1));
+ EXPECT_EQ(absl::string_view("ar"), absl::string_view(piece1));
EXPECT_FALSE(piece1.IsPinned());
- EXPECT_EQ(quiche::QuicheStringPiece("foob"),
- quiche::QuicheStringPiece(piece2));
+ EXPECT_EQ(absl::string_view("foob"), absl::string_view(piece2));
EXPECT_TRUE(piece2.IsPinned());
SpdyPinnableBufferPiece empty;
piece2.Swap(&empty);
- EXPECT_EQ(quiche::QuicheStringPiece(""), quiche::QuicheStringPiece(piece2));
+ EXPECT_EQ(absl::string_view(""), absl::string_view(piece2));
EXPECT_FALSE(piece2.IsPinned());
}
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_prefixed_buffer_reader_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_prefixed_buffer_reader_test.cc
index d48fde1abb7..83559567886 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_prefixed_buffer_reader_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_prefixed_buffer_reader_test.cc
@@ -6,7 +6,7 @@
#include <string>
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
namespace spdy {
@@ -46,8 +46,7 @@ TEST_F(SpdyPrefixedBufferReaderTest, ReadPieceFromPrefix) {
EXPECT_FALSE(reader.ReadN(10, &piece)); // Not enough buffer.
EXPECT_TRUE(reader.ReadN(6, &piece));
EXPECT_FALSE(piece.IsPinned());
- EXPECT_EQ(quiche::QuicheStringPiece("foobar"),
- quiche::QuicheStringPiece(piece));
+ EXPECT_EQ(absl::string_view("foobar"), absl::string_view(piece));
EXPECT_EQ(0u, reader.Available());
}
@@ -70,8 +69,7 @@ TEST_F(SpdyPrefixedBufferReaderTest, ReadPieceFromSuffix) {
EXPECT_FALSE(reader.ReadN(10, &piece)); // Not enough buffer.
EXPECT_TRUE(reader.ReadN(6, &piece));
EXPECT_FALSE(piece.IsPinned());
- EXPECT_EQ(quiche::QuicheStringPiece("foobar"),
- quiche::QuicheStringPiece(piece));
+ EXPECT_EQ(absl::string_view("foobar"), absl::string_view(piece));
EXPECT_EQ(0u, reader.Available());
}
@@ -94,8 +92,7 @@ TEST_F(SpdyPrefixedBufferReaderTest, ReadPieceSpanning) {
EXPECT_FALSE(reader.ReadN(10, &piece)); // Not enough buffer.
EXPECT_TRUE(reader.ReadN(6, &piece));
EXPECT_TRUE(piece.IsPinned());
- EXPECT_EQ(quiche::QuicheStringPiece("foobar"),
- quiche::QuicheStringPiece(piece));
+ EXPECT_EQ(absl::string_view("foobar"), absl::string_view(piece));
EXPECT_EQ(0u, reader.Available());
}
@@ -115,12 +112,12 @@ TEST_F(SpdyPrefixedBufferReaderTest, ReadMixed) {
EXPECT_EQ(6u, reader.Available());
EXPECT_TRUE(reader.ReadN(3, &piece));
- EXPECT_EQ(quiche::QuicheStringPiece("fhi"), quiche::QuicheStringPiece(piece));
+ EXPECT_EQ(absl::string_view("fhi"), absl::string_view(piece));
EXPECT_TRUE(piece.IsPinned());
EXPECT_EQ(3u, reader.Available());
EXPECT_TRUE(reader.ReadN(2, &piece));
- EXPECT_EQ(quiche::QuicheStringPiece("jk"), quiche::QuicheStringPiece(piece));
+ EXPECT_EQ(absl::string_view("jk"), absl::string_view(piece));
EXPECT_FALSE(piece.IsPinned());
EXPECT_EQ(1u, reader.Available());
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol.cc
index a4a72d67325..f9a18007088 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol.cc
@@ -276,12 +276,12 @@ bool SpdyFrameWithFinIR::fin() const {
SpdyFrameWithHeaderBlockIR::SpdyFrameWithHeaderBlockIR(
SpdyStreamId stream_id,
- SpdyHeaderBlock header_block)
+ Http2HeaderBlock header_block)
: SpdyFrameWithFinIR(stream_id), header_block_(std::move(header_block)) {}
SpdyFrameWithHeaderBlockIR::~SpdyFrameWithHeaderBlockIR() = default;
-SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id, quiche::QuicheStringPiece data)
+SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id, absl::string_view data)
: SpdyFrameWithFinIR(stream_id),
data_(nullptr),
data_len_(0),
@@ -291,7 +291,7 @@ SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id, quiche::QuicheStringPiece data)
}
SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id, const char* data)
- : SpdyDataIR(stream_id, quiche::QuicheStringPiece(data)) {}
+ : SpdyDataIR(stream_id, absl::string_view(data)) {}
SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id, std::string data)
: SpdyFrameWithFinIR(stream_id),
@@ -377,7 +377,7 @@ size_t SpdyPingIR::size() const {
SpdyGoAwayIR::SpdyGoAwayIR(SpdyStreamId last_good_stream_id,
SpdyErrorCode error_code,
- quiche::QuicheStringPiece description)
+ absl::string_view description)
: description_(description) {
set_last_good_stream_id(last_good_stream_id);
set_error_code(error_code);
@@ -388,7 +388,7 @@ SpdyGoAwayIR::SpdyGoAwayIR(SpdyStreamId last_good_stream_id,
const char* description)
: SpdyGoAwayIR(last_good_stream_id,
error_code,
- quiche::QuicheStringPiece(description)) {}
+ absl::string_view(description)) {}
SpdyGoAwayIR::SpdyGoAwayIR(SpdyStreamId last_good_stream_id,
SpdyErrorCode error_code,
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol.h
index 0bf8bb9d69f..a2b9c4d39ca 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol.h
@@ -19,8 +19,8 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_export.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
#include "net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h"
#include "net/third_party/quiche/src/spdy/core/spdy_bitmasks.h"
#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
@@ -492,31 +492,30 @@ class QUICHE_EXPORT_PRIVATE SpdyFrameWithHeaderBlockIR
public:
~SpdyFrameWithHeaderBlockIR() override;
- const SpdyHeaderBlock& header_block() const { return header_block_; }
- void set_header_block(SpdyHeaderBlock header_block) {
+ const Http2HeaderBlock& header_block() const { return header_block_; }
+ void set_header_block(Http2HeaderBlock header_block) {
// Deep copy.
header_block_ = std::move(header_block);
}
- void SetHeader(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
+ void SetHeader(absl::string_view name, absl::string_view value) {
header_block_[name] = value;
}
protected:
SpdyFrameWithHeaderBlockIR(SpdyStreamId stream_id,
- SpdyHeaderBlock header_block);
+ Http2HeaderBlock header_block);
SpdyFrameWithHeaderBlockIR(const SpdyFrameWithHeaderBlockIR&) = delete;
SpdyFrameWithHeaderBlockIR& operator=(const SpdyFrameWithHeaderBlockIR&) =
delete;
private:
- SpdyHeaderBlock header_block_;
+ Http2HeaderBlock header_block_;
};
class QUICHE_EXPORT_PRIVATE SpdyDataIR : public SpdyFrameWithFinIR {
public:
// Performs a deep copy on data.
- SpdyDataIR(SpdyStreamId stream_id, quiche::QuicheStringPiece data);
+ SpdyDataIR(SpdyStreamId stream_id, absl::string_view data);
// Performs a deep copy on data.
SpdyDataIR(SpdyStreamId stream_id, const char* data);
@@ -547,14 +546,14 @@ class QUICHE_EXPORT_PRIVATE SpdyDataIR : public SpdyFrameWithFinIR {
}
// Deep-copy of data (keep private copy).
- void SetDataDeep(quiche::QuicheStringPiece data) {
+ void SetDataDeep(absl::string_view data) {
data_store_ = std::make_unique<std::string>(data.data(), data.size());
data_ = data_store_->data();
data_len_ = data.size();
}
// Shallow-copy of data (do not keep private copy).
- void SetDataShallow(quiche::QuicheStringPiece data) {
+ void SetDataShallow(absl::string_view data) {
data_store_.reset();
data_ = data.data();
data_len_ = data.size();
@@ -660,7 +659,7 @@ class QUICHE_EXPORT_PRIVATE SpdyGoAwayIR : public SpdyFrameIR {
// this SpdyGoAwayIR.
SpdyGoAwayIR(SpdyStreamId last_good_stream_id,
SpdyErrorCode error_code,
- quiche::QuicheStringPiece description);
+ absl::string_view description);
// References description, doesn't copy it, so description must outlast
// this SpdyGoAwayIR.
@@ -689,7 +688,7 @@ class QUICHE_EXPORT_PRIVATE SpdyGoAwayIR : public SpdyFrameIR {
error_code_ = error_code;
}
- const quiche::QuicheStringPiece& description() const { return description_; }
+ const absl::string_view& description() const { return description_; }
void Visit(SpdyFrameVisitor* visitor) const override;
@@ -701,14 +700,14 @@ class QUICHE_EXPORT_PRIVATE SpdyGoAwayIR : public SpdyFrameIR {
SpdyStreamId last_good_stream_id_;
SpdyErrorCode error_code_;
const std::string description_store_;
- const quiche::QuicheStringPiece description_;
+ const absl::string_view description_;
};
class QUICHE_EXPORT_PRIVATE SpdyHeadersIR : public SpdyFrameWithHeaderBlockIR {
public:
explicit SpdyHeadersIR(SpdyStreamId stream_id)
- : SpdyHeadersIR(stream_id, SpdyHeaderBlock()) {}
- SpdyHeadersIR(SpdyStreamId stream_id, SpdyHeaderBlock header_block)
+ : SpdyHeadersIR(stream_id, Http2HeaderBlock()) {}
+ SpdyHeadersIR(SpdyStreamId stream_id, Http2HeaderBlock header_block)
: SpdyFrameWithHeaderBlockIR(stream_id, std::move(header_block)) {}
SpdyHeadersIR(const SpdyHeadersIR&) = delete;
SpdyHeadersIR& operator=(const SpdyHeadersIR&) = delete;
@@ -776,10 +775,10 @@ class QUICHE_EXPORT_PRIVATE SpdyPushPromiseIR
: public SpdyFrameWithHeaderBlockIR {
public:
SpdyPushPromiseIR(SpdyStreamId stream_id, SpdyStreamId promised_stream_id)
- : SpdyPushPromiseIR(stream_id, promised_stream_id, SpdyHeaderBlock()) {}
+ : SpdyPushPromiseIR(stream_id, promised_stream_id, Http2HeaderBlock()) {}
SpdyPushPromiseIR(SpdyStreamId stream_id,
SpdyStreamId promised_stream_id,
- SpdyHeaderBlock header_block)
+ Http2HeaderBlock header_block)
: SpdyFrameWithHeaderBlockIR(stream_id, std::move(header_block)),
promised_stream_id_(promised_stream_id),
padded_(false),
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol_test.cc
index c952bce0677..f4cbc42cc8d 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol_test.cc
@@ -226,8 +226,8 @@ TEST(SpdyStreamPrecedenceTest, Equals) {
TEST(SpdyDataIRTest, Construct) {
// Confirm that it makes a string of zero length from a
- // QuicheStringPiece(nullptr).
- quiche::QuicheStringPiece s1;
+ // absl::string_view(nullptr).
+ absl::string_view s1;
SpdyDataIR d1(/* stream_id = */ 1, s1);
EXPECT_EQ(0u, d1.data_len());
EXPECT_NE(nullptr, d1.data());
@@ -235,8 +235,8 @@ TEST(SpdyDataIRTest, Construct) {
// Confirms makes a copy of char array.
const char s2[] = "something";
SpdyDataIR d2(/* stream_id = */ 2, s2);
- EXPECT_EQ(quiche::QuicheStringPiece(d2.data(), d2.data_len()), s2);
- EXPECT_NE(quiche::QuicheStringPiece(d1.data(), d1.data_len()), s2);
+ EXPECT_EQ(absl::string_view(d2.data(), d2.data_len()), s2);
+ EXPECT_NE(absl::string_view(d1.data(), d1.data_len()), s2);
EXPECT_EQ((int)d1.data_len(), d1.flow_control_window_consumed());
// Confirm copies a const string.
@@ -249,20 +249,18 @@ TEST(SpdyDataIRTest, Construct) {
std::string bar = "bar";
SpdyDataIR d4(/* stream_id = */ 4, bar);
EXPECT_EQ("bar", bar);
- EXPECT_EQ("bar", quiche::QuicheStringPiece(d4.data(), d4.data_len()));
+ EXPECT_EQ("bar", absl::string_view(d4.data(), d4.data_len()));
// Confirm moves an rvalue reference. Note that the test string "baz" is too
// short to trigger the move optimization, and instead a copy occurs.
std::string baz = "the quick brown fox";
SpdyDataIR d5(/* stream_id = */ 5, std::move(baz));
EXPECT_EQ("", baz);
- EXPECT_EQ(quiche::QuicheStringPiece(d5.data(), d5.data_len()),
- "the quick brown fox");
+ EXPECT_EQ(absl::string_view(d5.data(), d5.data_len()), "the quick brown fox");
// Confirms makes a copy of string literal.
SpdyDataIR d7(/* stream_id = */ 7, "something else");
- EXPECT_EQ(quiche::QuicheStringPiece(d7.data(), d7.data_len()),
- "something else");
+ EXPECT_EQ(absl::string_view(d7.data(), d7.data_len()), "something else");
SpdyDataIR d8(/* stream_id = */ 8, "shawarma");
d8.set_padding_len(20);
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol_test_utils.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol_test_utils.cc
index 7390f50bdc6..37199f646d1 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol_test_utils.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_protocol_test_utils.cc
@@ -6,7 +6,7 @@
#include <cstdint>
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
namespace spdy {
namespace test {
@@ -47,8 +47,8 @@ namespace test {
if (expected.data() == nullptr) {
VERIFY_EQ(nullptr, actual.data());
} else {
- VERIFY_EQ(quiche::QuicheStringPiece(expected.data(), expected.data_len()),
- quiche::QuicheStringPiece(actual.data(), actual.data_len()));
+ VERIFY_EQ(absl::string_view(expected.data(), expected.data_len()),
+ absl::string_view(actual.data(), actual.data_len()));
}
VERIFY_SUCCESS(VerifySpdyFrameWithPaddingIREquals(expected, actual));
return ::testing::AssertionSuccess();
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_simple_arena_test.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_simple_arena_test.cc
index 7e66567b78f..b9e9f757168 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_simple_arena_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_simple_arena_test.cc
@@ -7,7 +7,7 @@
#include <string>
#include <vector>
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
namespace spdy {
@@ -27,7 +27,7 @@ TEST(SpdySimpleArenaTest, Memdup) {
char* c = arena.Memdup(kTestString, length);
EXPECT_NE(nullptr, c);
EXPECT_NE(c, kTestString);
- EXPECT_EQ(quiche::QuicheStringPiece(c, length), kTestString);
+ EXPECT_EQ(absl::string_view(c, length), kTestString);
}
TEST(SpdySimpleArenaTest, MemdupLargeString) {
@@ -36,7 +36,7 @@ TEST(SpdySimpleArenaTest, MemdupLargeString) {
char* c = arena.Memdup(kTestString, length);
EXPECT_NE(nullptr, c);
EXPECT_NE(c, kTestString);
- EXPECT_EQ(quiche::QuicheStringPiece(c, length), kTestString);
+ EXPECT_EQ(absl::string_view(c, length), kTestString);
}
TEST(SpdySimpleArenaTest, MultipleBlocks) {
@@ -44,9 +44,9 @@ TEST(SpdySimpleArenaTest, MultipleBlocks) {
std::vector<std::string> strings = {
"One decently long string.", "Another string.",
"A third string that will surely go in a different block."};
- std::vector<quiche::QuicheStringPiece> copies;
+ std::vector<absl::string_view> copies;
for (const std::string& s : strings) {
- quiche::QuicheStringPiece sp(arena.Memdup(s.data(), s.size()), s.size());
+ absl::string_view sp(arena.Memdup(s.data(), s.size()), s.size());
copies.push_back(sp);
}
EXPECT_EQ(strings.size(), copies.size());
@@ -63,7 +63,7 @@ TEST(SpdySimpleArenaTest, UseAfterReset) {
c = arena.Memdup(kTestString, length);
EXPECT_NE(nullptr, c);
EXPECT_NE(c, kTestString);
- EXPECT_EQ(quiche::QuicheStringPiece(c, length), kTestString);
+ EXPECT_EQ(absl::string_view(c, length), kTestString);
}
TEST(SpdySimpleArenaTest, Free) {
@@ -102,7 +102,7 @@ TEST(SpdySimpleArenaTest, Alloc) {
EXPECT_EQ(c1 + length, c2);
EXPECT_EQ(c2 + 2 * length, c3);
EXPECT_EQ(c3 + 3 * length, c4);
- EXPECT_EQ(quiche::QuicheStringPiece(c4, length), kTestString);
+ EXPECT_EQ(absl::string_view(c4, length), kTestString);
}
TEST(SpdySimpleArenaTest, Realloc) {
@@ -113,28 +113,28 @@ TEST(SpdySimpleArenaTest, Realloc) {
char* c2 = arena.Realloc(c1, length, 2 * length);
EXPECT_TRUE(c1);
EXPECT_EQ(c1, c2);
- EXPECT_EQ(quiche::QuicheStringPiece(c1, length), kTestString);
+ EXPECT_EQ(absl::string_view(c1, length), kTestString);
// Multiple reallocs.
char* c3 = arena.Memdup(kTestString, length);
EXPECT_EQ(c2 + 2 * length, c3);
- EXPECT_EQ(quiche::QuicheStringPiece(c3, length), kTestString);
+ EXPECT_EQ(absl::string_view(c3, length), kTestString);
char* c4 = arena.Realloc(c3, length, 2 * length);
EXPECT_EQ(c3, c4);
- EXPECT_EQ(quiche::QuicheStringPiece(c4, length), kTestString);
+ EXPECT_EQ(absl::string_view(c4, length), kTestString);
char* c5 = arena.Realloc(c4, 2 * length, 3 * length);
EXPECT_EQ(c4, c5);
- EXPECT_EQ(quiche::QuicheStringPiece(c5, length), kTestString);
+ EXPECT_EQ(absl::string_view(c5, length), kTestString);
char* c6 = arena.Memdup(kTestString, length);
EXPECT_EQ(c5 + 3 * length, c6);
- EXPECT_EQ(quiche::QuicheStringPiece(c6, length), kTestString);
+ EXPECT_EQ(absl::string_view(c6, length), kTestString);
// Realloc that does not fit in the remainder of the first block.
char* c7 = arena.Realloc(c6, length, kDefaultBlockSize);
- EXPECT_EQ(quiche::QuicheStringPiece(c7, length), kTestString);
+ EXPECT_EQ(absl::string_view(c7, length), kTestString);
arena.Free(c7, kDefaultBlockSize);
char* c8 = arena.Memdup(kTestString, length);
EXPECT_NE(c6, c7);
EXPECT_EQ(c7, c8);
- EXPECT_EQ(quiche::QuicheStringPiece(c8, length), kTestString);
+ EXPECT_EQ(absl::string_view(c8, length), kTestString);
}
} // namespace
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_test_utils.cc b/chromium/net/third_party/quiche/src/spdy/core/spdy_test_utils.cc
index 1d8db971f9c..5372bcdbf73 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_test_utils.cc
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_test_utils.cc
@@ -12,7 +12,7 @@
#include <vector>
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
-#include "net/third_party/quiche/src/spdy/platform/api/spdy_endianness_util.h"
+#include "net/third_party/quiche/src/common/quiche_endian.h"
#include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h"
namespace spdy {
@@ -95,26 +95,10 @@ void SetFrameFlags(SpdySerializedFrame* frame, uint8_t flags) {
void SetFrameLength(SpdySerializedFrame* frame, size_t length) {
CHECK_GT(1u << 14, length);
{
- int32_t wire_length = SpdyHostToNet32(length);
+ int32_t wire_length = quiche::QuicheEndian::HostToNet32(length);
memcpy(frame->data(), reinterpret_cast<char*>(&wire_length) + 1, 3);
}
}
-void TestHeadersHandler::OnHeaderBlockStart() {
- block_.clear();
-}
-
-void TestHeadersHandler::OnHeader(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) {
- block_.AppendValueOrAddHeader(name, value);
-}
-
-void TestHeadersHandler::OnHeaderBlockEnd(
- size_t header_bytes_parsed,
- size_t compressed_header_bytes_parsed) {
- header_bytes_parsed_ = header_bytes_parsed;
- compressed_header_bytes_parsed_ = compressed_header_bytes_parsed;
-}
-
} // namespace test
} // namespace spdy
diff --git a/chromium/net/third_party/quiche/src/spdy/core/spdy_test_utils.h b/chromium/net/third_party/quiche/src/spdy/core/spdy_test_utils.h
index b3c3aa5d38b..920838eb301 100644
--- a/chromium/net/third_party/quiche/src/spdy/core/spdy_test_utils.h
+++ b/chromium/net/third_party/quiche/src/spdy/core/spdy_test_utils.h
@@ -9,16 +9,14 @@
#include <cstdint>
#include <string>
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/spdy/core/spdy_header_block.h"
-#include "net/third_party/quiche/src/spdy/core/spdy_headers_handler_interface.h"
#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
-#include "net/third_party/quiche/src/spdy/platform/api/spdy_bug_tracker.h"
namespace spdy {
-inline bool operator==(quiche::QuicheStringPiece x,
- const SpdyHeaderBlock::ValueProxy& y) {
+inline bool operator==(absl::string_view x,
+ const Http2HeaderBlock::ValueProxy& y) {
return y.operator==(x);
}
@@ -39,34 +37,6 @@ void SetFrameFlags(SpdySerializedFrame* frame, uint8_t flags);
void SetFrameLength(SpdySerializedFrame* frame, size_t length);
-// A test implementation of SpdyHeadersHandlerInterface that correctly
-// reconstructs multiple header values for the same name.
-class TestHeadersHandler : public SpdyHeadersHandlerInterface {
- public:
- TestHeadersHandler() {}
- TestHeadersHandler(const TestHeadersHandler&) = delete;
- TestHeadersHandler& operator=(const TestHeadersHandler&) = delete;
-
- void OnHeaderBlockStart() override;
-
- void OnHeader(quiche::QuicheStringPiece name,
- quiche::QuicheStringPiece value) override;
-
- void OnHeaderBlockEnd(size_t header_bytes_parsed,
- size_t compressed_header_bytes_parsed) override;
-
- const SpdyHeaderBlock& decoded_block() const { return block_; }
- size_t header_bytes_parsed() const { return header_bytes_parsed_; }
- size_t compressed_header_bytes_parsed() const {
- return compressed_header_bytes_parsed_;
- }
-
- private:
- SpdyHeaderBlock block_;
- size_t header_bytes_parsed_ = 0;
- size_t compressed_header_bytes_parsed_ = 0;
-};
-
} // namespace test
} // namespace spdy
diff --git a/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_endianness_util.h b/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_endianness_util.h
deleted file mode 100644
index e4074d710ce..00000000000
--- a/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_endianness_util.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2018 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 QUICHE_SPDY_PLATFORM_API_SPDY_ENDIANNESS_UTIL_H_
-#define QUICHE_SPDY_PLATFORM_API_SPDY_ENDIANNESS_UTIL_H_
-
-#include <stdint.h>
-
-#include "net/spdy/platform/impl/spdy_endianness_util_impl.h"
-
-namespace spdy {
-
-// Converts the bytes in |x| from network to host order (endianness), and
-// returns the result.
-inline uint16_t SpdyNetToHost16(uint16_t x) {
- return SpdyNetToHost16Impl(x);
-}
-
-inline uint32_t SpdyNetToHost32(uint32_t x) {
- return SpdyNetToHost32Impl(x);
-}
-
-inline uint64_t SpdyNetToHost64(uint64_t x) {
- return SpdyNetToHost64Impl(x);
-}
-
-// Converts the bytes in |x| from host to network order (endianness), and
-// returns the result.
-inline uint16_t SpdyHostToNet16(uint16_t x) {
- return SpdyHostToNet16Impl(x);
-}
-
-inline uint32_t SpdyHostToNet32(uint32_t x) {
- return SpdyHostToNet32Impl(x);
-}
-
-inline uint64_t SpdyHostToNet64(uint64_t x) {
- return SpdyHostToNet64Impl(x);
-}
-
-} // namespace spdy
-
-#endif // QUICHE_SPDY_PLATFORM_API_SPDY_ENDIANNESS_UTIL_H_
diff --git a/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_mem_slice_test.cc b/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_mem_slice_test.cc
index 84313b0a7b2..fa41b5e4dd7 100644
--- a/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_mem_slice_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_mem_slice_test.cc
@@ -6,17 +6,13 @@
#include <utility>
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Weverything"
-
-#include "testing/gtest/include/gtest/gtest.h"
-#pragma clang diagnostic pop
+#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
namespace spdy {
namespace test {
namespace {
-class SpdyMemSliceTest : public ::testing::Test {
+class SpdyMemSliceTest : public QuicheTest {
public:
SpdyMemSliceTest() {
slice_ = SpdyMemSlice(1024);
diff --git a/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h b/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h
index b023f733e04..e7ee6a9ca98 100644
--- a/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h
+++ b/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h
@@ -14,7 +14,7 @@
// non-test code.
#include "net/third_party/quiche/src/spdy/platform/api/spdy_mem_slice.h"
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
#include "net/spdy/platform/impl/spdy_string_utils_impl.h"
namespace spdy {
@@ -28,12 +28,11 @@ inline char SpdyHexDigitToInt(char c) {
return SpdyHexDigitToIntImpl(c);
}
-inline std::string SpdyHexDecode(quiche::QuicheStringPiece data) {
+inline std::string SpdyHexDecode(absl::string_view data) {
return SpdyHexDecodeImpl(data);
}
-inline bool SpdyHexDecodeToUInt32(quiche::QuicheStringPiece data,
- uint32_t* out) {
+inline bool SpdyHexDecodeToUInt32(absl::string_view data, uint32_t* out) {
return SpdyHexDecodeToUInt32Impl(data, out);
}
@@ -45,7 +44,7 @@ inline std::string SpdyHexEncodeUInt32AndTrim(uint32_t data) {
return SpdyHexEncodeUInt32AndTrimImpl(data);
}
-inline std::string SpdyHexDump(quiche::QuicheStringPiece data) {
+inline std::string SpdyHexDump(absl::string_view data) {
return SpdyHexDumpImpl(data);
}
diff --git a/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_string_utils_test.cc b/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_string_utils_test.cc
index 4848bf0a54a..2f8c0220e84 100644
--- a/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_string_utils_test.cc
+++ b/chromium/net/third_party/quiche/src/spdy/platform/api/spdy_string_utils_test.cc
@@ -6,7 +6,7 @@
#include <cstdint>
-#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/common/platform/api/quiche_test.h"
namespace spdy {
@@ -22,7 +22,7 @@ TEST(SpdyStringUtilsTest, SpdyStrAppend) {
// Single string-like argument.
const char kFoo[] = "foo";
const std::string string_foo(kFoo);
- const quiche::QuicheStringPiece stringpiece_foo(string_foo);
+ const absl::string_view stringpiece_foo(string_foo);
SpdyStrAppend(&output, kFoo);
EXPECT_EQ("foo", output);
SpdyStrAppend(&output, string_foo);
@@ -38,7 +38,7 @@ TEST(SpdyStringUtilsTest, SpdyStrAppend) {
// Two string-like arguments.
const char kBar[] = "bar";
- const quiche::QuicheStringPiece stringpiece_bar(kBar);
+ const absl::string_view stringpiece_bar(kBar);
const std::string string_bar(kBar);
SpdyStrAppend(&output, kFoo, kBar);
EXPECT_EQ("foobar", output);