Remove SpdyString wrapper for std::string. This used to be needed before std::string was used internally. QuicString has already been removed at 238124961. gfe-relnote: n/a, no functional change. PiperOrigin-RevId: 263689054 Change-Id: Ib6f8d4c060f5f557caf88c75389cd2df727ac017
diff --git a/spdy/core/fifo_write_scheduler.h b/spdy/core/fifo_write_scheduler.h index 3c38bd5..aa904f6 100644 --- a/spdy/core/fifo_write_scheduler.h +++ b/spdy/core/fifo_write_scheduler.h
@@ -7,6 +7,7 @@ #include <map> #include <set> +#include <string> #include "net/third_party/quiche/src/spdy/core/write_scheduler.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h" @@ -46,7 +47,7 @@ size_t NumReadyStreams() const override; bool IsStreamReady(StreamIdType stream_id) const override; size_t NumRegisteredStreams() const override; - SpdyString DebugString() const override; + std::string DebugString() const override; private: std::set<StreamIdType> ready_streams_; @@ -208,7 +209,7 @@ } template <typename StreamIdType> -SpdyString FifoWriteScheduler<StreamIdType>::DebugString() const { +std::string FifoWriteScheduler<StreamIdType>::DebugString() const { return SpdyStrCat( "FifoWriteScheduler {num_streams=", registered_streams_.size(), " num_ready_streams=", NumReadyStreams(), "}");
diff --git a/spdy/core/hpack/hpack_decoder_adapter_test.cc b/spdy/core/hpack/hpack_decoder_adapter_test.cc index d016841..da3a56c 100644 --- a/spdy/core/hpack/hpack_decoder_adapter_test.cc +++ b/spdy/core/hpack/hpack_decoder_adapter_test.cc
@@ -8,6 +8,7 @@ #include <stdint.h> +#include <string> #include <tuple> #include <utility> #include <vector> @@ -22,7 +23,6 @@ #include "net/third_party/quiche/src/spdy/core/spdy_test_utils.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_arraysize.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" @@ -231,8 +231,8 @@ void expectEntry(size_t index, size_t size, - const SpdyString& name, - const SpdyString& value) { + const std::string& name, + const std::string& value) { const HpackStringPair* entry = decoder_peer_.GetTableEntry(index); EXPECT_EQ(name, entry->name) << "index " << index; EXPECT_EQ(value, entry->value); @@ -240,7 +240,7 @@ } SpdyHeaderBlock MakeHeaderBlock( - const std::vector<std::pair<SpdyString, SpdyString>>& headers) { + const std::vector<std::pair<std::string, std::string>>& headers) { SpdyHeaderBlock result; for (const auto& kv : headers) { result.AppendValueOrAddHeader(kv.first, kv.second); @@ -277,12 +277,12 @@ // limit is rejected. HandleControlFrameHeadersStart(); const size_t kMaxBufferSizeBytes = 50; - const SpdyString a_value = SpdyString(49, 'x'); + const std::string a_value = std::string(49, 'x'); decoder_.set_max_decode_buffer_size_bytes(kMaxBufferSizeBytes); HpackBlockBuilder hbb; hbb.AppendLiteralNameAndValue(HpackEntryType::kNeverIndexedLiteralHeader, false, "a", false, a_value); - const SpdyString& s = hbb.buffer(); + const std::string& s = hbb.buffer(); EXPECT_GT(s.size(), kMaxBufferSizeBytes); // Any one in input buffer must not exceed kMaxBufferSizeBytes. @@ -297,8 +297,8 @@ TEST_P(HpackDecoderAdapterTest, NameTooLong) { // Verify that a name longer than the allowed size generates an error. const size_t kMaxBufferSizeBytes = 50; - const SpdyString name = SpdyString(2 * kMaxBufferSizeBytes, 'x'); - const SpdyString value = "abc"; + const std::string name = std::string(2 * kMaxBufferSizeBytes, 'x'); + const std::string value = "abc"; decoder_.set_max_decode_buffer_size_bytes(kMaxBufferSizeBytes); @@ -307,7 +307,7 @@ false, name, false, value); const size_t fragment_size = (3 * kMaxBufferSizeBytes) / 2; - const SpdyString fragment = hbb.buffer().substr(0, fragment_size); + const std::string fragment = hbb.buffer().substr(0, fragment_size); HandleControlFrameHeadersStart(); EXPECT_FALSE(HandleControlFrameHeadersData(fragment)); @@ -316,8 +316,8 @@ TEST_P(HpackDecoderAdapterTest, HeaderTooLongToBuffer) { // Verify that a header longer than the allowed size generates an error if // it isn't all in one input buffer. - const SpdyString name = "some-key"; - const SpdyString value = "some-value"; + const std::string name = "some-key"; + const std::string value = "some-value"; const size_t kMaxBufferSizeBytes = name.size() + value.size() - 2; decoder_.set_max_decode_buffer_size_bytes(kMaxBufferSizeBytes); @@ -325,7 +325,7 @@ hbb.AppendLiteralNameAndValue(HpackEntryType::kNeverIndexedLiteralHeader, false, name, false, value); const size_t fragment_size = hbb.size() - 1; - const SpdyString fragment = hbb.buffer().substr(0, fragment_size); + const std::string fragment = hbb.buffer().substr(0, fragment_size); HandleControlFrameHeadersStart(); EXPECT_FALSE(HandleControlFrameHeadersData(fragment)); @@ -333,8 +333,8 @@ // Verify that a header block that exceeds the maximum length is rejected. TEST_P(HpackDecoderAdapterTest, HeaderBlockTooLong) { - const SpdyString name = "some-key"; - const SpdyString value = "some-value"; + const std::string name = "some-key"; + const std::string value = "some-value"; const size_t kMaxBufferSizeBytes = 1024; HpackBlockBuilder hbb; @@ -364,7 +364,7 @@ // No need to wait for more data. EXPECT_TRUE(HandleControlFrameHeadersData("\x82\x85\x82")); - std::vector<std::pair<SpdyString, SpdyString>> expected_headers = { + std::vector<std::pair<std::string, std::string>> expected_headers = { {":method", "GET"}, {":path", "/index.html"}, {":method", "GET"}}; SpdyHeaderBlock expected_block1 = MakeHeaderBlock(expected_headers); @@ -405,7 +405,7 @@ // Already-delimited headers are passed through. decoder_peer_.HandleHeaderRepresentation("passed-through", - SpdyString("foo\0baz", 7)); + std::string("foo\0baz", 7)); // Other headers are joined on \0. Case matters. decoder_peer_.HandleHeaderRepresentation("joined", "not joined"); @@ -492,7 +492,7 @@ TEST_P(HpackDecoderAdapterTest, ContextUpdateMaximumSize) { EXPECT_EQ(kDefaultHeaderTableSizeSetting, decoder_peer_.header_table_size_limit()); - SpdyString input; + std::string input; { // Maximum-size update with size 126. Succeeds. HpackOutputStream output_stream; @@ -529,7 +529,7 @@ // Two HeaderTableSizeUpdates may appear at the beginning of the block TEST_P(HpackDecoderAdapterTest, TwoTableSizeUpdates) { - SpdyString input; + std::string input; { // Should accept two table size updates, update to second one HpackOutputStream output_stream; @@ -546,7 +546,7 @@ // Three HeaderTableSizeUpdates should result in an error TEST_P(HpackDecoderAdapterTest, ThreeTableSizeUpdatesError) { - SpdyString input; + std::string input; { // Should reject three table size updates, update to second one HpackOutputStream output_stream; @@ -567,7 +567,7 @@ // HeaderTableSizeUpdates may only appear at the beginning of the block // Any other updates should result in an error TEST_P(HpackDecoderAdapterTest, TableSizeUpdateSecondError) { - SpdyString input; + std::string input; { // Should reject a table size update appearing after a different entry // The table size should remain as the default @@ -587,7 +587,7 @@ // HeaderTableSizeUpdates may only appear at the beginning of the block // Any other updates should result in an error TEST_P(HpackDecoderAdapterTest, TableSizeUpdateFirstThirdError) { - SpdyString input; + std::string input; { // Should reject the second table size update // if a different entry appears after the first update @@ -678,7 +678,7 @@ // | www.example.com // | -> :authority: www.example.com - SpdyString first = SpdyHexDecode("418cf1e3c2e5f23a6ba0ab90f4ff"); + std::string first = SpdyHexDecode("418cf1e3c2e5f23a6ba0ab90f4ff"); EXPECT_TRUE(DecodeHeaderBlock(first)); first.pop_back(); EXPECT_FALSE(DecodeHeaderBlock(first)); @@ -698,7 +698,7 @@ // | www.example.com // | -> :authority: www.example.com - SpdyString first = SpdyHexDecode("418cf1e3c2e5f23a6ba0ab90f4ff"); + std::string first = SpdyHexDecode("418cf1e3c2e5f23a6ba0ab90f4ff"); EXPECT_TRUE(DecodeHeaderBlock(first)); first = SpdyHexDecode("418df1e3c2e5f23a6ba0ab90f4ffff"); EXPECT_FALSE(DecodeHeaderBlock(first)); @@ -715,7 +715,7 @@ expected_header_set[":path"] = "/"; expected_header_set[":authority"] = "www.example.com"; - SpdyString encoded_header_set; + std::string encoded_header_set; EXPECT_TRUE( encoder.EncodeHeaderSet(expected_header_set, &encoded_header_set)); @@ -747,7 +747,7 @@ // | Decoded: // | www.example.com // | -> :authority: www.example.com - SpdyString first = SpdyHexDecode("828684418cf1e3c2e5f23a6ba0ab90f4ff"); + std::string first = SpdyHexDecode("828684418cf1e3c2e5f23a6ba0ab90f4ff"); const SpdyHeaderBlock& first_header_set = DecodeBlockExpectingSuccess(first); EXPECT_THAT(first_header_set, @@ -784,7 +784,7 @@ // | no-cache // | -> cache-control: no-cache - SpdyString second = SpdyHexDecode("828684be5886a8eb10649cbf"); + std::string second = SpdyHexDecode("828684be5886a8eb10649cbf"); const SpdyHeaderBlock& second_header_set = DecodeBlockExpectingSuccess(second); @@ -826,7 +826,7 @@ // | Decoded: // | custom-value // | -> custom-key: custom-value - SpdyString third = + std::string third = SpdyHexDecode("828785bf408825a849e95ba97d7f8925a849e95bb8e8b4bf"); const SpdyHeaderBlock& third_header_set = DecodeBlockExpectingSuccess(third); @@ -896,7 +896,7 @@ // | -> location: https://www.e // | xample.com - SpdyString first = SpdyHexDecode( + std::string first = SpdyHexDecode( "488264025885aec3771a4b6196d07abe" "941054d444a8200595040b8166e082a6" "2d1bff6e919d29ad171863c78f0b97c8" @@ -939,7 +939,7 @@ // | idx = 63 // | -> location: // | https://www.example.com - SpdyString second = SpdyHexDecode("4883640effc1c0bf"); + std::string second = SpdyHexDecode("4883640effc1c0bf"); const SpdyHeaderBlock& second_header_set = DecodeBlockExpectingSuccess(second); @@ -1011,7 +1011,7 @@ // | -> set-cookie: foo=ASDJKHQ // | KBZXOQWEOPIUAXQWEOIU; // | max-age=3600; version=1 - SpdyString third = SpdyHexDecode( + std::string third = SpdyHexDecode( "88c16196d07abe941054d444a8200595" "040b8166e084a62d1bffc05a839bd9ab" "77ad94e7821dd7f2e6c7b335dfdfcd5b" @@ -1096,7 +1096,7 @@ // SpdyHeaderBlock stores these 6 strings as '\0' separated values. // Make sure that is what happened. - SpdyString joined_values = expected_header_set[name].as_string(); + std::string joined_values = expected_header_set[name].as_string(); EXPECT_EQ(joined_values.size(), 2 * value1.size() + 2 * value2.size() + 2 * value3.size() + 5);
diff --git a/spdy/core/hpack/hpack_encoder.cc b/spdy/core/hpack/hpack_encoder.cc index d76ead0..f4f427c 100644 --- a/spdy/core/hpack/hpack_encoder.cc +++ b/spdy/core/hpack/hpack_encoder.cc
@@ -86,7 +86,7 @@ HpackEncoder::~HpackEncoder() = default; bool HpackEncoder::EncodeHeaderSet(const SpdyHeaderBlock& header_set, - SpdyString* output) { + std::string* output) { // Separate header set into pseudo-headers and regular headers. Representations pseudo_headers; Representations regular_headers; @@ -131,7 +131,7 @@ } void HpackEncoder::EncodeRepresentations(RepresentationIterator* iter, - SpdyString* output) { + std::string* output) { MaybeEmitTableSize(); while (iter->HasNext()) { const auto header = iter->Next(); @@ -291,7 +291,7 @@ // Encodes up to max_encoded_bytes of the current header block into the // given output string. - void Next(size_t max_encoded_bytes, SpdyString* output) override; + void Next(size_t max_encoded_bytes, std::string* output) override; private: HpackEncoder* encoder_; @@ -329,7 +329,7 @@ } void HpackEncoder::Encoderator::Next(size_t max_encoded_bytes, - SpdyString* output) { + std::string* output) { SPDY_BUG_IF(!has_next_) << "Encoderator::Next called with nothing left to encode."; const bool use_compression = encoder_->enable_compression_;
diff --git a/spdy/core/hpack/hpack_encoder.h b/spdy/core/hpack/hpack_encoder.h index c0cf968..a24d69b 100644 --- a/spdy/core/hpack/hpack_encoder.h +++ b/spdy/core/hpack/hpack_encoder.h
@@ -10,6 +10,7 @@ #include <functional> #include <map> #include <memory> +#include <string> #include <utility> #include <vector> @@ -17,7 +18,6 @@ #include "net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h" #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" // An HpackEncoder encodes header sets as outlined in @@ -53,7 +53,7 @@ // Encodes the given header set into the given string. Returns // whether or not the encoding was successful. - bool EncodeHeaderSet(const SpdyHeaderBlock& header_set, SpdyString* output); + bool EncodeHeaderSet(const SpdyHeaderBlock& header_set, std::string* output); class SPDY_EXPORT_PRIVATE ProgressiveEncoder { public: @@ -64,7 +64,7 @@ // Encodes up to max_encoded_bytes of the current header block into the // given output string. - virtual void Next(size_t max_encoded_bytes, SpdyString* output) = 0; + virtual void Next(size_t max_encoded_bytes, std::string* output) = 0; }; // Returns a ProgressiveEncoder which must be outlived by both the given @@ -106,7 +106,7 @@ class Encoderator; // Encodes a sequence of header name-value pairs as a single header block. - void EncodeRepresentations(RepresentationIterator* iter, SpdyString* output); + void EncodeRepresentations(RepresentationIterator* iter, std::string* output); // Emits a static/dynamic indexed representation (Section 7.1). void EmitIndex(const HpackEntry* entry);
diff --git a/spdy/core/hpack/hpack_encoder_test.cc b/spdy/core/hpack/hpack_encoder_test.cc index 4a70dc0..4683ccf 100644 --- a/spdy/core/hpack/hpack_encoder_test.cc +++ b/spdy/core/hpack/hpack_encoder_test.cc
@@ -42,7 +42,9 @@ return encoder_->huffman_table_; } void EmitString(SpdyStringPiece str) { encoder_->EmitString(str); } - void TakeString(SpdyString* out) { encoder_->output_stream_.TakeString(out); } + void TakeString(std::string* out) { + encoder_->output_stream_.TakeString(out); + } static void CookieToCrumbs(SpdyStringPiece cookie, std::vector<SpdyStringPiece>* out) { Representations tmp; @@ -69,7 +71,7 @@ // non-incremental encoding path. static bool EncodeHeaderSet(HpackEncoder* encoder, const SpdyHeaderBlock& header_set, - SpdyString* output, + std::string* output, bool use_incremental) { if (use_incremental) { return EncodeIncremental(encoder, header_set, output); @@ -80,14 +82,14 @@ static bool EncodeIncremental(HpackEncoder* encoder, const SpdyHeaderBlock& header_set, - SpdyString* output) { + std::string* output) { std::unique_ptr<HpackEncoder::ProgressiveEncoder> encoderator = encoder->EncodeHeaderSet(header_set); - SpdyString output_buffer; + std::string output_buffer; http2::test::Http2Random random; encoderator->Next(random.UniformInRange(0, 16), &output_buffer); while (encoderator->HasNext()) { - SpdyString second_buffer; + std::string second_buffer; encoderator->Next(random.UniformInRange(0, 16), &second_buffer); output_buffer.append(second_buffer); } @@ -180,7 +182,7 @@ expected_.AppendUint32(size); } void CompareWithExpectedEncoding(const SpdyHeaderBlock& header_set) { - SpdyString expected_out, actual_out; + std::string expected_out, actual_out; expected_.TakeString(&expected_out); EXPECT_TRUE(test::HpackEncoderPeer::EncodeHeaderSet( &encoder_, header_set, &actual_out, use_incremental_)); @@ -318,7 +320,7 @@ expected_.AppendUint32(6); expected_.AppendBytes("@@@@@@"); - SpdyString expected_out, actual_out; + std::string expected_out, actual_out; expected_.TakeString(&expected_out); peer_.TakeString(&actual_out); EXPECT_EQ(expected_out, actual_out); @@ -507,7 +509,7 @@ TEST_P(HpackEncoderTest, CrumbleNullByteDelimitedValue) { SpdyHeaderBlock headers; // A header field to be crumbled: "spam: foo\0bar". - headers["spam"] = SpdyString("foo\0bar", 7); + headers["spam"] = std::string("foo\0bar", 7); ExpectIndexedLiteral("spam", "foo"); expected_.AppendPrefix(kLiteralIncrementalIndexOpcode);
diff --git a/spdy/core/hpack/hpack_entry.cc b/spdy/core/hpack/hpack_entry.cc index 46e6086..0965739 100644 --- a/spdy/core/hpack/hpack_entry.cc +++ b/spdy/core/hpack/hpack_entry.cc
@@ -75,7 +75,7 @@ return Size(name(), value()); } -SpdyString HpackEntry::GetDebugString() const { +std::string HpackEntry::GetDebugString() const { return SpdyStrCat( "{ name: \"", name_ref_, "\", value: \"", value_ref_, "\", index: ", insertion_index_, " ",
diff --git a/spdy/core/hpack/hpack_entry.h b/spdy/core/hpack/hpack_entry.h index 61103fd..50ac3a7 100644 --- a/spdy/core/hpack/hpack_entry.h +++ b/spdy/core/hpack/hpack_entry.h
@@ -7,9 +7,9 @@ #include <cstddef> #include <cstdint> +#include <string> #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" // All section references below are to @@ -70,7 +70,7 @@ static size_t Size(SpdyStringPiece name, SpdyStringPiece value); size_t Size() const; - SpdyString GetDebugString() const; + std::string GetDebugString() const; int64_t time_added() const { return time_added_; } void set_time_added(int64_t now) { time_added_ = now; } @@ -86,8 +86,8 @@ }; // These members are not used for LOOKUP entries. - SpdyString name_; - SpdyString value_; + std::string name_; + std::string value_; // These members are always valid. For DYNAMIC and STATIC entries, they // always point to |name_| and |value_|.
diff --git a/spdy/core/hpack/hpack_entry_test.cc b/spdy/core/hpack/hpack_entry_test.cc index 224ac18..316fcb9 100644 --- a/spdy/core/hpack/hpack_entry_test.cc +++ b/spdy/core/hpack/hpack_entry_test.cc
@@ -42,7 +42,7 @@ return name_.size() + value_.size() + HpackEntry::kSizeOverhead; } - SpdyString name_, value_; + std::string name_, value_; private: // Referenced by HpackEntry instances.
diff --git a/spdy/core/hpack/hpack_header_table_test.cc b/spdy/core/hpack/hpack_header_table_test.cc index 4001174..a7d2482 100644 --- a/spdy/core/hpack/hpack_header_table_test.cc +++ b/spdy/core/hpack/hpack_header_table_test.cc
@@ -7,11 +7,11 @@ #include <algorithm> #include <cstdint> #include <set> +#include <string> #include <vector> #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_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" namespace spdy { @@ -75,8 +75,8 @@ // Returns an entry whose Size() is equal to the given one. static HpackEntry MakeEntryOfSize(uint32_t size) { EXPECT_GE(size, HpackEntry::kSizeOverhead); - SpdyString name((size - HpackEntry::kSizeOverhead) / 2, 'n'); - SpdyString value(size - HpackEntry::kSizeOverhead - name.size(), 'v'); + std::string name((size - HpackEntry::kSizeOverhead) / 2, 'n'); + std::string value(size - HpackEntry::kSizeOverhead - name.size(), 'v'); HpackEntry entry(name, value, false, 0); EXPECT_EQ(size, entry.Size()); return entry; @@ -121,7 +121,7 @@ } } - HpackEntry DynamicEntry(const SpdyString& name, const SpdyString& value) { + HpackEntry DynamicEntry(const std::string& name, const std::string& value) { peer_.AddDynamicEntry(name, value); return peer_.dynamic_entries().back(); } @@ -256,7 +256,7 @@ } TEST_F(HpackHeaderTableTest, SetSizes) { - SpdyString key = "key", value = "value"; + std::string key = "key", value = "value"; const HpackEntry* entry1 = table_.TryAddEntry(key, value); const HpackEntry* entry2 = table_.TryAddEntry(key, value); const HpackEntry* entry3 = table_.TryAddEntry(key, value); @@ -288,7 +288,7 @@ } TEST_F(HpackHeaderTableTest, EvictionCountForEntry) { - SpdyString key = "key", value = "value"; + std::string key = "key", value = "value"; const HpackEntry* entry1 = table_.TryAddEntry(key, value); const HpackEntry* entry2 = table_.TryAddEntry(key, value); size_t entry3_size = HpackEntry::Size(key, value); @@ -305,7 +305,7 @@ } TEST_F(HpackHeaderTableTest, EvictionCountToReclaim) { - SpdyString key = "key", value = "value"; + std::string key = "key", value = "value"; const HpackEntry* entry1 = table_.TryAddEntry(key, value); const HpackEntry* entry2 = table_.TryAddEntry(key, value);
diff --git a/spdy/core/hpack/hpack_huffman_table.h b/spdy/core/hpack/hpack_huffman_table.h index 80d9e52..a01c62f 100644 --- a/spdy/core/hpack/hpack_huffman_table.h +++ b/spdy/core/hpack/hpack_huffman_table.h
@@ -11,7 +11,6 @@ #include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" namespace spdy {
diff --git a/spdy/core/hpack/hpack_huffman_table_test.cc b/spdy/core/hpack/hpack_huffman_table_test.cc index efade41..de4d30c 100644 --- a/spdy/core/hpack/hpack_huffman_table_test.cc +++ b/spdy/core/hpack/hpack_huffman_table_test.cc
@@ -4,6 +4,7 @@ #include "net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h" +#include <string> #include <utility> #include "net/third_party/quiche/src/http2/hpack/huffman/hpack_huffman_decoder.h" @@ -41,8 +42,8 @@ protected: GenericHuffmanTableTest() : table_(), peer_(table_) {} - SpdyString EncodeString(SpdyStringPiece input) { - SpdyString result; + std::string EncodeString(SpdyStringPiece input) { + std::string result; HpackOutputStream output_stream; table_.EncodeString(input, &output_stream); @@ -188,7 +189,7 @@ } // Use http2::HpackHuffmanDecoder for roundtrip tests. - void DecodeString(const SpdyString& encoded, SpdyString* out) { + void DecodeString(const std::string& encoded, std::string* out) { http2::HpackHuffmanDecoder decoder; out->clear(); EXPECT_TRUE(decoder.Decode(encoded, out)); @@ -200,8 +201,8 @@ } TEST_F(HpackHuffmanTableTest, SpecRequestExamples) { - SpdyString buffer; - SpdyString test_table[] = { + std::string buffer; + std::string test_table[] = { SpdyHexDecode("f1e3c2e5f23a6ba0ab90f4ff"), "www.example.com", SpdyHexDecode("a8eb10649cbf"), @@ -213,8 +214,8 @@ }; // Round-trip each test example. for (size_t i = 0; i != SPDY_ARRAYSIZE(test_table); i += 2) { - const SpdyString& encodedFixture(test_table[i]); - const SpdyString& decodedFixture(test_table[i + 1]); + const std::string& encodedFixture(test_table[i]); + const std::string& decodedFixture(test_table[i + 1]); DecodeString(encodedFixture, &buffer); EXPECT_EQ(decodedFixture, buffer); buffer = EncodeString(decodedFixture); @@ -223,8 +224,8 @@ } TEST_F(HpackHuffmanTableTest, SpecResponseExamples) { - SpdyString buffer; - SpdyString test_table[] = { + std::string buffer; + std::string test_table[] = { SpdyHexDecode("6402"), "302", SpdyHexDecode("aec3771a4b"), @@ -242,8 +243,8 @@ }; // Round-trip each test example. for (size_t i = 0; i != SPDY_ARRAYSIZE(test_table); i += 2) { - const SpdyString& encodedFixture(test_table[i]); - const SpdyString& decodedFixture(test_table[i + 1]); + const std::string& encodedFixture(test_table[i]); + const std::string& decodedFixture(test_table[i + 1]); DecodeString(encodedFixture, &buffer); EXPECT_EQ(decodedFixture, buffer); buffer = EncodeString(decodedFixture); @@ -256,8 +257,8 @@ char c = static_cast<char>(i); char storage[3] = {c, c, c}; SpdyStringPiece input(storage, SPDY_ARRAYSIZE(storage)); - SpdyString buffer_in = EncodeString(input); - SpdyString buffer_out; + std::string buffer_in = EncodeString(input); + std::string buffer_out; DecodeString(buffer_in, &buffer_out); EXPECT_EQ(input, buffer_out); } @@ -270,21 +271,21 @@ storage[511 - i] = static_cast<char>(i); } SpdyStringPiece input(storage, SPDY_ARRAYSIZE(storage)); - SpdyString buffer_in = EncodeString(input); - SpdyString buffer_out; + std::string buffer_in = EncodeString(input); + std::string buffer_out; DecodeString(buffer_in, &buffer_out); EXPECT_EQ(input, buffer_out); } TEST_F(HpackHuffmanTableTest, EncodedSizeAgreesWithEncodeString) { - SpdyString test_table[] = { + std::string test_table[] = { "", "Mon, 21 Oct 2013 20:13:21 GMT", "https://www.example.com", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1", - SpdyString(1, '\0'), - SpdyString("foo\0bar", 7), - SpdyString(256, '\0'), + std::string(1, '\0'), + std::string("foo\0bar", 7), + std::string(256, '\0'), }; for (size_t i = 0; i != 256; ++i) { // Expand last |test_table| entry to cover all codes. @@ -292,7 +293,7 @@ } HpackOutputStream output_stream; - SpdyString encoding; + std::string encoding; for (size_t i = 0; i != SPDY_ARRAYSIZE(test_table); ++i) { table_.EncodeString(test_table[i], &output_stream); output_stream.TakeString(&encoding);
diff --git a/spdy/core/hpack/hpack_output_stream.cc b/spdy/core/hpack/hpack_output_stream.cc index fc01c3f..4ceaece 100644 --- a/spdy/core/hpack/hpack_output_stream.cc +++ b/spdy/core/hpack/hpack_output_stream.cc
@@ -63,7 +63,7 @@ } } -void HpackOutputStream::TakeString(SpdyString* output) { +void HpackOutputStream::TakeString(std::string* output) { // This must hold, since all public functions cause the buffer to // end on a byte boundary. DCHECK_EQ(bit_offset_, 0u); @@ -72,10 +72,11 @@ bit_offset_ = 0; } -void HpackOutputStream::BoundedTakeString(size_t max_size, SpdyString* output) { +void HpackOutputStream::BoundedTakeString(size_t max_size, + std::string* output) { if (buffer_.size() > max_size) { // Save off overflow bytes to temporary string (causes a copy). - SpdyString overflow(buffer_.data() + max_size, buffer_.size() - max_size); + std::string overflow(buffer_.data() + max_size, buffer_.size() - max_size); // Resize buffer down to the given limit. buffer_.resize(max_size);
diff --git a/spdy/core/hpack/hpack_output_stream.h b/spdy/core/hpack/hpack_output_stream.h index 0163146..5e65139 100644 --- a/spdy/core/hpack/hpack_output_stream.h +++ b/spdy/core/hpack/hpack_output_stream.h
@@ -7,10 +7,10 @@ #include <cstdint> #include <map> +#include <string> #include "net/third_party/quiche/src/spdy/core/hpack/hpack_constants.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" // All section references below are to @@ -49,11 +49,11 @@ void AppendUint32(uint32_t I); // Swaps the internal buffer with |output|, then resets state. - void TakeString(SpdyString* output); + void TakeString(std::string* output); // Gives up to |max_size| bytes of the internal buffer to |output|. Resets // internal state with the overflow. - void BoundedTakeString(size_t max_size, SpdyString* output); + void BoundedTakeString(size_t max_size, std::string* output); // Size in bytes of stream's internal buffer. size_t size() const { return buffer_.size(); } @@ -63,7 +63,7 @@ private: // The internal bit buffer. - SpdyString buffer_; + std::string buffer_; // If 0, the buffer ends on a byte boundary. If non-zero, the buffer // ends on the nth most significant bit. Guaranteed to be < 8.
diff --git a/spdy/core/hpack/hpack_output_stream_test.cc b/spdy/core/hpack/hpack_output_stream_test.cc index 9e1988d..4942417 100644 --- a/spdy/core/hpack/hpack_output_stream_test.cc +++ b/spdy/core/hpack/hpack_output_stream_test.cc
@@ -16,7 +16,7 @@ // significant bit, and that it can handle crossing a byte boundary. TEST(HpackOutputStreamTest, AppendBits) { HpackOutputStream output_stream; - SpdyString expected_str; + std::string expected_str; output_stream.AppendBits(0x1, 1); expected_str.append(1, 0x00); @@ -37,20 +37,20 @@ output_stream.AppendBits(0x0, 7); - SpdyString str; + std::string str; output_stream.TakeString(&str); EXPECT_EQ(expected_str, str); } // Utility function to return I as a string encoded with an N-bit // prefix. -SpdyString EncodeUint32(uint8_t N, uint32_t I) { +std::string EncodeUint32(uint8_t N, uint32_t I) { HpackOutputStream output_stream; if (N < 8) { output_stream.AppendBits(0x00, 8 - N); } output_stream.AppendUint32(I); - SpdyString str; + std::string str; output_stream.TakeString(&str); return str; } @@ -61,7 +61,7 @@ TEST(HpackOutputStreamTest, OneByteIntegersEightBitPrefix) { // Minimum. - EXPECT_EQ(SpdyString("\x00", 1), EncodeUint32(8, 0x00)); + EXPECT_EQ(std::string("\x00", 1), EncodeUint32(8, 0x00)); EXPECT_EQ("\x7f", EncodeUint32(8, 0x7f)); // Maximum. EXPECT_EQ("\xfe", EncodeUint32(8, 0xfe)); @@ -69,7 +69,7 @@ TEST(HpackOutputStreamTest, TwoByteIntegersEightBitPrefix) { // Minimum. - EXPECT_EQ(SpdyString("\xff\x00", 2), EncodeUint32(8, 0xff)); + EXPECT_EQ(std::string("\xff\x00", 2), EncodeUint32(8, 0xff)); EXPECT_EQ("\xff\x01", EncodeUint32(8, 0x0100)); // Maximum. EXPECT_EQ("\xff\x7f", EncodeUint32(8, 0x017e)); @@ -112,13 +112,13 @@ TEST(HpackOutputStreamTest, OneByteIntegersOneToSevenBitPrefixes) { // Minimums. - EXPECT_EQ(SpdyString("\x00", 1), EncodeUint32(7, 0x00)); - EXPECT_EQ(SpdyString("\x00", 1), EncodeUint32(6, 0x00)); - EXPECT_EQ(SpdyString("\x00", 1), EncodeUint32(5, 0x00)); - EXPECT_EQ(SpdyString("\x00", 1), EncodeUint32(4, 0x00)); - EXPECT_EQ(SpdyString("\x00", 1), EncodeUint32(3, 0x00)); - EXPECT_EQ(SpdyString("\x00", 1), EncodeUint32(2, 0x00)); - EXPECT_EQ(SpdyString("\x00", 1), EncodeUint32(1, 0x00)); + EXPECT_EQ(std::string("\x00", 1), EncodeUint32(7, 0x00)); + EXPECT_EQ(std::string("\x00", 1), EncodeUint32(6, 0x00)); + EXPECT_EQ(std::string("\x00", 1), EncodeUint32(5, 0x00)); + EXPECT_EQ(std::string("\x00", 1), EncodeUint32(4, 0x00)); + EXPECT_EQ(std::string("\x00", 1), EncodeUint32(3, 0x00)); + EXPECT_EQ(std::string("\x00", 1), EncodeUint32(2, 0x00)); + EXPECT_EQ(std::string("\x00", 1), EncodeUint32(1, 0x00)); // Maximums. EXPECT_EQ("\x7e", EncodeUint32(7, 0x7e)); @@ -127,18 +127,18 @@ EXPECT_EQ("\x0e", EncodeUint32(4, 0x0e)); EXPECT_EQ("\x06", EncodeUint32(3, 0x06)); EXPECT_EQ("\x02", EncodeUint32(2, 0x02)); - EXPECT_EQ(SpdyString("\x00", 1), EncodeUint32(1, 0x00)); + EXPECT_EQ(std::string("\x00", 1), EncodeUint32(1, 0x00)); } TEST(HpackOutputStreamTest, TwoByteIntegersOneToSevenBitPrefixes) { // Minimums. - EXPECT_EQ(SpdyString("\x7f\x00", 2), EncodeUint32(7, 0x7f)); - EXPECT_EQ(SpdyString("\x3f\x00", 2), EncodeUint32(6, 0x3f)); - EXPECT_EQ(SpdyString("\x1f\x00", 2), EncodeUint32(5, 0x1f)); - EXPECT_EQ(SpdyString("\x0f\x00", 2), EncodeUint32(4, 0x0f)); - EXPECT_EQ(SpdyString("\x07\x00", 2), EncodeUint32(3, 0x07)); - EXPECT_EQ(SpdyString("\x03\x00", 2), EncodeUint32(2, 0x03)); - EXPECT_EQ(SpdyString("\x01\x00", 2), EncodeUint32(1, 0x01)); + EXPECT_EQ(std::string("\x7f\x00", 2), EncodeUint32(7, 0x7f)); + EXPECT_EQ(std::string("\x3f\x00", 2), EncodeUint32(6, 0x3f)); + EXPECT_EQ(std::string("\x1f\x00", 2), EncodeUint32(5, 0x1f)); + EXPECT_EQ(std::string("\x0f\x00", 2), EncodeUint32(4, 0x0f)); + EXPECT_EQ(std::string("\x07\x00", 2), EncodeUint32(3, 0x07)); + EXPECT_EQ(std::string("\x03\x00", 2), EncodeUint32(2, 0x03)); + EXPECT_EQ(std::string("\x01\x00", 2), EncodeUint32(1, 0x01)); // Maximums. EXPECT_EQ("\x7f\x7f", EncodeUint32(7, 0xfe)); @@ -236,9 +236,9 @@ HpackOutputStream output_stream; output_stream.AppendBits(0x7f, 7); output_stream.AppendUint32(0x01); - SpdyString str; + std::string str; output_stream.TakeString(&str); - EXPECT_EQ(SpdyString("\xff\x00", 2), str); + EXPECT_EQ(std::string("\xff\x00", 2), str); } TEST(HpackOutputStreamTest, AppendBytes) { @@ -247,7 +247,7 @@ output_stream.AppendBytes("buffer1"); output_stream.AppendBytes("buffer2"); - SpdyString str; + std::string str; output_stream.TakeString(&str); EXPECT_EQ("buffer1buffer2", str); } @@ -258,7 +258,7 @@ output_stream.AppendBytes("buffer12"); output_stream.AppendBytes("buffer456"); - SpdyString str; + std::string str; output_stream.BoundedTakeString(9, &str); EXPECT_EQ("buffer12b", str);
diff --git a/spdy/core/hpack/hpack_round_trip_test.cc b/spdy/core/hpack/hpack_round_trip_test.cc index c035812..bae0fd2 100644 --- a/spdy/core/hpack/hpack_round_trip_test.cc +++ b/spdy/core/hpack/hpack_round_trip_test.cc
@@ -12,7 +12,6 @@ #include "net/third_party/quiche/src/spdy/core/hpack/hpack_decoder_adapter.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h" #include "net/third_party/quiche/src/spdy/core/spdy_test_utils.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" namespace spdy { @@ -34,7 +33,7 @@ } bool RoundTrip(const SpdyHeaderBlock& header_set) { - SpdyString encoded; + std::string encoded; encoder_.EncodeHeaderSet(header_set, &encoded); bool success = true; @@ -111,7 +110,7 @@ headers["set-cookie"] = "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU;" " max-age=3600; version=1"; - headers["multivalue"] = SpdyString("foo\0bar", 7); + headers["multivalue"] = std::string("foo\0bar", 7); EXPECT_TRUE(RoundTrip(headers)); } } @@ -144,7 +143,7 @@ headers[":scheme"] = "https"; headers["custom-key"] = "custom-value"; headers["cookie"] = "baz=bing; fizzle=fazzle; garbage"; - headers["multivalue"] = SpdyString("foo\0bar", 7); + headers["multivalue"] = std::string("foo\0bar", 7); EXPECT_TRUE(RoundTrip(headers)); } } @@ -153,7 +152,7 @@ // Grow vectors of names & values, which are seeded with fixtures and then // expanded with dynamically generated data. Samples are taken using the // exponential distribution. - std::vector<SpdyString> pseudo_header_names, random_header_names; + std::vector<std::string> pseudo_header_names, random_header_names; pseudo_header_names.push_back(":authority"); pseudo_header_names.push_back(":path"); pseudo_header_names.push_back(":status"); @@ -161,7 +160,7 @@ // TODO(jgraettinger): Enable "cookie" as a name fixture. Crumbs may be // reconstructed in any order, which breaks the simple validation used here. - std::vector<SpdyString> values; + std::vector<std::string> values; values.push_back("/"); values.push_back("/index.html"); values.push_back("200"); @@ -180,7 +179,7 @@ std::min(header_count, 1 + SampleExponential(7, 50)); EXPECT_LE(pseudo_header_count, header_count); for (size_t j = 0; j != header_count; ++j) { - SpdyString name, value; + std::string name, value; // Pseudo headers must be added before regular headers. if (j < pseudo_header_count) { // Choose one of the defined pseudo headers at random. @@ -204,7 +203,8 @@ // Randomly reuse an existing value, or generate a new one. size_t value_index = SampleExponential(20, 200); if (value_index >= values.size()) { - SpdyString newvalue = random_.RandString(1 + SampleExponential(15, 75)); + std::string newvalue = + random_.RandString(1 + SampleExponential(15, 75)); // Currently order is not preserved in the encoder. In particular, // when a value is decomposed at \0 delimiters, its parts might get // encoded out of order if some but not all of them already exist in
diff --git a/spdy/core/http2_priority_write_scheduler.h b/spdy/core/http2_priority_write_scheduler.h index c46f6af..1255839 100644 --- a/spdy/core/http2_priority_write_scheduler.h +++ b/spdy/core/http2_priority_write_scheduler.h
@@ -11,6 +11,7 @@ #include <memory> #include <queue> #include <set> +#include <string> #include <tuple> #include <unordered_map> #include <utility> @@ -24,7 +25,6 @@ #include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_map_util.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_ptr_util.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h" namespace spdy { @@ -77,7 +77,7 @@ size_t NumReadyStreams() const override; bool IsStreamReady(StreamIdType stream_id) const override; size_t NumRegisteredStreams() const override; - SpdyString DebugString() const override; + std::string DebugString() const override; private: friend class test::Http2PriorityWriteSchedulerPeer<StreamIdType>; @@ -713,7 +713,7 @@ } template <typename StreamIdType> -SpdyString Http2PriorityWriteScheduler<StreamIdType>::DebugString() const { +std::string Http2PriorityWriteScheduler<StreamIdType>::DebugString() const { return SpdyStrCat("Http2PriorityWriteScheduler {num_registered_streams=", NumRegisteredStreams(), " num_ready_streams=", NumReadyStreams(), "}");
diff --git a/spdy/core/lifo_write_scheduler.h b/spdy/core/lifo_write_scheduler.h index c4f620c..b532c86 100644 --- a/spdy/core/lifo_write_scheduler.h +++ b/spdy/core/lifo_write_scheduler.h
@@ -7,10 +7,10 @@ #include <map> #include <set> +#include <string> #include "net/third_party/quiche/src/spdy/core/write_scheduler.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h" namespace spdy { @@ -80,7 +80,7 @@ size_t NumReadyStreams() const override { return ready_streams_.size(); } bool IsStreamReady(StreamIdType stream_id) const override; size_t NumRegisteredStreams() const override; - SpdyString DebugString() const override; + std::string DebugString() const override; private: friend class test::LifoWriteSchedulerPeer<StreamIdType>; @@ -197,7 +197,7 @@ } template <typename StreamIdType> -SpdyString LifoWriteScheduler<StreamIdType>::DebugString() const { +std::string LifoWriteScheduler<StreamIdType>::DebugString() const { return SpdyStrCat( "LifoWriteScheduler {num_streams=", registered_streams_.size(), " num_ready_streams=", NumReadyStreams(), "}");
diff --git a/spdy/core/priority_write_scheduler.h b/spdy/core/priority_write_scheduler.h index e438583..15939e0 100644 --- a/spdy/core/priority_write_scheduler.h +++ b/spdy/core/priority_write_scheduler.h
@@ -8,6 +8,7 @@ #include <algorithm> #include <cstddef> #include <cstdint> +#include <string> #include <tuple> #include <unordered_map> #include <utility> @@ -19,7 +20,6 @@ #include "net/third_party/quiche/src/spdy/platform/api/spdy_bug_tracker.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_macros.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h" namespace spdy { @@ -260,7 +260,7 @@ size_t NumRegisteredStreams() const override { return stream_infos_.size(); } - SpdyString DebugString() const override { + std::string DebugString() const override { return SpdyStrCat( "PriorityWriteScheduler {num_streams=", stream_infos_.size(), " num_ready_streams=", NumReadyStreams(), "}");
diff --git a/spdy/core/spdy_alt_svc_wire_format.cc b/spdy/core/spdy_alt_svc_wire_format.cc index d230ae0..fcbfd16 100644 --- a/spdy/core/spdy_alt_svc_wire_format.cc +++ b/spdy/core/spdy_alt_svc_wire_format.cc
@@ -38,8 +38,8 @@ SpdyAltSvcWireFormat::AlternativeService::AlternativeService() = default; SpdyAltSvcWireFormat::AlternativeService::AlternativeService( - const SpdyString& protocol_id, - const SpdyString& host, + const std::string& protocol_id, + const std::string& host, uint16_t port, uint32_t max_age, VersionVector version) @@ -71,7 +71,7 @@ // Parse protocol-id. SpdyStringPiece::const_iterator percent_encoded_protocol_id_end = std::find(c, value.end(), '='); - SpdyString protocol_id; + std::string protocol_id; if (percent_encoded_protocol_id_end == c || !PercentDecode(c, percent_encoded_protocol_id_end, &protocol_id)) { return false; @@ -105,7 +105,7 @@ return false; } DCHECK_EQ('"', *c); - SpdyString host; + std::string host; uint16_t port; if (!ParseAltAuthority(alt_authority_begin, c, &host, &port)) { return false; @@ -129,7 +129,7 @@ if (c == parameters_end) { break; } - SpdyString parameter_name; + std::string parameter_name; for (; c != parameters_end && *c != '=' && *c != ' ' && *c != '\t'; ++c) { parameter_name.push_back(tolower(*c)); } @@ -211,13 +211,13 @@ } // static -SpdyString SpdyAltSvcWireFormat::SerializeHeaderFieldValue( +std::string SpdyAltSvcWireFormat::SerializeHeaderFieldValue( const AlternativeServiceVector& altsvc_vector) { if (altsvc_vector.empty()) { - return SpdyString("clear"); + return std::string("clear"); } const char kNibbleToHex[] = "0123456789ABCDEF"; - SpdyString value; + std::string value; for (const AlternativeService& altsvc : altsvc_vector) { if (!value.empty()) { value.push_back(','); @@ -300,7 +300,7 @@ // static bool SpdyAltSvcWireFormat::PercentDecode(SpdyStringPiece::const_iterator c, SpdyStringPiece::const_iterator end, - SpdyString* output) { + std::string* output) { output->clear(); for (; c != end; ++c) { if (*c != '%') { @@ -328,7 +328,7 @@ bool SpdyAltSvcWireFormat::ParseAltAuthority( SpdyStringPiece::const_iterator c, SpdyStringPiece::const_iterator end, - SpdyString* host, + std::string* host, uint16_t* port) { host->clear(); if (c == end) {
diff --git a/spdy/core/spdy_alt_svc_wire_format.h b/spdy/core/spdy_alt_svc_wire_format.h index ac834bc..13142ef 100644 --- a/spdy/core/spdy_alt_svc_wire_format.h +++ b/spdy/core/spdy_alt_svc_wire_format.h
@@ -11,11 +11,11 @@ #define QUICHE_SPDY_CORE_SPDY_ALT_SVC_WIRE_FORMAT_H_ #include <cstdint> +#include <string> #include <vector> #include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" namespace spdy { @@ -29,8 +29,8 @@ using VersionVector = SpdyInlinedVector<uint32_t, 8>; struct SPDY_EXPORT_PRIVATE AlternativeService { - SpdyString protocol_id; - SpdyString host; + std::string protocol_id; + std::string host; // Default is 0: invalid port. uint16_t port = 0; @@ -40,8 +40,8 @@ VersionVector version; AlternativeService(); - AlternativeService(const SpdyString& protocol_id, - const SpdyString& host, + AlternativeService(const std::string& protocol_id, + const std::string& host, uint16_t port, uint32_t max_age, VersionVector version); @@ -62,7 +62,7 @@ friend class test::SpdyAltSvcWireFormatPeer; static bool ParseHeaderFieldValue(SpdyStringPiece value, AlternativeServiceVector* altsvc_vector); - static SpdyString SerializeHeaderFieldValue( + static std::string SerializeHeaderFieldValue( const AlternativeServiceVector& altsvc_vector); private: @@ -70,10 +70,10 @@ SpdyStringPiece::const_iterator end); static bool PercentDecode(SpdyStringPiece::const_iterator c, SpdyStringPiece::const_iterator end, - SpdyString* output); + std::string* output); static bool ParseAltAuthority(SpdyStringPiece::const_iterator c, SpdyStringPiece::const_iterator end, - SpdyString* host, + std::string* host, uint16_t* port); static bool ParsePositiveInteger16(SpdyStringPiece::const_iterator c, SpdyStringPiece::const_iterator end,
diff --git a/spdy/core/spdy_alt_svc_wire_format_test.cc b/spdy/core/spdy_alt_svc_wire_format_test.cc index bda5bc5..7b5e0bb 100644 --- a/spdy/core/spdy_alt_svc_wire_format_test.cc +++ b/spdy/core/spdy_alt_svc_wire_format_test.cc
@@ -20,12 +20,12 @@ } static bool PercentDecode(SpdyStringPiece::const_iterator c, SpdyStringPiece::const_iterator end, - SpdyString* output) { + std::string* output) { return SpdyAltSvcWireFormat::PercentDecode(c, end, output); } static bool ParseAltAuthority(SpdyStringPiece::const_iterator c, SpdyStringPiece::const_iterator end, - SpdyString* host, + std::string* host, uint16_t* port) { return SpdyAltSvcWireFormat::ParseAltAuthority(c, end, host, port); } @@ -49,7 +49,7 @@ // random case, and corresponding AlternativeService entries. void FuzzHeaderFieldValue( int i, - SpdyString* header_field_value, + std::string* header_field_value, SpdyAltSvcWireFormat::AlternativeService* expected_altsvc) { if (!header_field_value->empty()) { header_field_value->push_back(','); @@ -132,7 +132,7 @@ // canonical form, that is, what SerializeHeaderFieldValue() should output. void FuzzAlternativeService(int i, SpdyAltSvcWireFormat::AlternativeService* altsvc, - SpdyString* expected_header_field_value) { + std::string* expected_header_field_value) { if (!expected_header_field_value->empty()) { expected_header_field_value->push_back(','); } @@ -183,7 +183,7 @@ // separator, etc. Single alternative service at a time. TEST(SpdyAltSvcWireFormatTest, ParseHeaderFieldValue) { for (int i = 0; i < 1 << 13; ++i) { - SpdyString header_field_value; + std::string header_field_value; SpdyAltSvcWireFormat::AlternativeService expected_altsvc; FuzzHeaderFieldValue(i, &header_field_value, &expected_altsvc); SpdyAltSvcWireFormat::AlternativeServiceVector altsvc_vector; @@ -197,7 +197,7 @@ EXPECT_EQ(expected_altsvc.version, altsvc_vector[0].version); // Roundtrip test starting with |altsvc_vector|. - SpdyString reserialized_header_field_value = + std::string reserialized_header_field_value = SpdyAltSvcWireFormat::SerializeHeaderFieldValue(altsvc_vector); SpdyAltSvcWireFormat::AlternativeServiceVector roundtrip_altsvc_vector; ASSERT_TRUE(SpdyAltSvcWireFormat::ParseHeaderFieldValue( @@ -217,7 +217,7 @@ // separator, etc. Possibly multiple alternative service at a time. TEST(SpdyAltSvcWireFormatTest, ParseHeaderFieldValueMultiple) { for (int i = 0; i < 1 << 13;) { - SpdyString header_field_value; + std::string header_field_value; SpdyAltSvcWireFormat::AlternativeServiceVector expected_altsvc_vector; // This will generate almost two hundred header field values with two, // three, four, five, six, and seven alternative services each, and @@ -242,7 +242,7 @@ } // Roundtrip test starting with |altsvc_vector|. - SpdyString reserialized_header_field_value = + std::string reserialized_header_field_value = SpdyAltSvcWireFormat::SerializeHeaderFieldValue(altsvc_vector); SpdyAltSvcWireFormat::AlternativeServiceVector roundtrip_altsvc_vector; ASSERT_TRUE(SpdyAltSvcWireFormat::ParseHeaderFieldValue( @@ -276,7 +276,7 @@ TEST(SpdyAltSvcWireFormatTest, RoundTrip) { for (int i = 0; i < 1 << 3; ++i) { SpdyAltSvcWireFormat::AlternativeService altsvc; - SpdyString expected_header_field_value; + std::string expected_header_field_value; FuzzAlternativeService(i, &altsvc, &expected_header_field_value); // Test ParseHeaderFieldValue(). @@ -304,7 +304,7 @@ // parameter. Multiple alternative services at a time. TEST(SpdyAltSvcWireFormatTest, RoundTripMultiple) { SpdyAltSvcWireFormat::AlternativeServiceVector altsvc_vector; - SpdyString expected_header_field_value; + std::string expected_header_field_value; for (int i = 0; i < 1 << 3; ++i) { SpdyAltSvcWireFormat::AlternativeService altsvc; FuzzAlternativeService(i, &altsvc, &expected_header_field_value); @@ -374,7 +374,7 @@ SpdyAltSvcWireFormat::AlternativeServiceVector altsvc_vector; const char* field_value_array[] = {"a=\":137\"", "a=\"foo:137\"", "a%25=\"foo\\\"bar\\\\baz:137\""}; - for (const SpdyString& field_value : field_value_array) { + for (const std::string& field_value : field_value_array) { for (size_t len = 1; len < field_value.size(); ++len) { EXPECT_FALSE(SpdyAltSvcWireFormat::ParseHeaderFieldValue( field_value.substr(0, len), &altsvc_vector)) @@ -402,7 +402,7 @@ // Test PercentDecode() on valid input. TEST(SpdyAltSvcWireFormatTest, PercentDecodeValid) { SpdyStringPiece input(""); - SpdyString output; + std::string output; ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::PercentDecode( input.begin(), input.end(), &output)); EXPECT_EQ("", output); @@ -425,7 +425,7 @@ const char* invalid_input_array[] = {"a%", "a%x", "a%b", "%J22", "%9z"}; for (const char* invalid_input : invalid_input_array) { SpdyStringPiece input(invalid_input); - SpdyString output; + std::string output; EXPECT_FALSE(test::SpdyAltSvcWireFormatPeer::PercentDecode( input.begin(), input.end(), &output)) << input; @@ -435,7 +435,7 @@ // Test ParseAltAuthority() on valid input. TEST(SpdyAltSvcWireFormatTest, ParseAltAuthorityValid) { SpdyStringPiece input(":42"); - SpdyString host; + std::string host; uint16_t port; ASSERT_TRUE(test::SpdyAltSvcWireFormatPeer::ParseAltAuthority( input.begin(), input.end(), &host, &port)); @@ -476,7 +476,7 @@ "2003:8:0:16::509d:9615]:443"}; for (const char* invalid_input : invalid_input_array) { SpdyStringPiece input(invalid_input); - SpdyString host; + std::string host; uint16_t port; EXPECT_FALSE(test::SpdyAltSvcWireFormatPeer::ParseAltAuthority( input.begin(), input.end(), &host, &port))
diff --git a/spdy/core/spdy_deframer_visitor.cc b/spdy/core/spdy_deframer_visitor.cc index 39a2e51..0ea2020 100644 --- a/spdy/core/spdy_deframer_visitor.cc +++ b/spdy/core/spdy_deframer_visitor.cc
@@ -214,7 +214,7 @@ bool fin_ = false; bool got_hpack_end_ = false; - std::unique_ptr<SpdyString> data_; + std::unique_ptr<std::string> data_; // Total length of the data frame. size_t data_len_ = 0; @@ -223,7 +223,7 @@ // Length field). size_t padding_len_ = 0; - std::unique_ptr<SpdyString> goaway_description_; + std::unique_ptr<std::string> goaway_description_; std::unique_ptr<StringPairVector> headers_; std::unique_ptr<SettingVector> settings_; std::unique_ptr<TestHeadersHandler> headers_handler_; @@ -417,7 +417,7 @@ << " frame_type_=" << Http2FrameTypeToString(frame_type_); CHECK_GT(stream_id, 0u); auto ptr = SpdyMakeUnique<SpdyAltSvcIR>(stream_id); - ptr->set_origin(SpdyString(origin)); + ptr->set_origin(std::string(origin)); for (auto& altsvc : altsvc_vector) { ptr->add_altsvc(altsvc); } @@ -456,7 +456,7 @@ stream_id_ = stream_id; fin_ = fin; data_len_ = length; - data_ = SpdyMakeUnique<SpdyString>(); + data_ = SpdyMakeUnique<std::string>(); } // The SpdyFramer will not process any more data at this point. @@ -482,7 +482,7 @@ frame_type_ = GOAWAY; goaway_ir_ = SpdyMakeUnique<SpdyGoAwayIR>(last_good_stream_id, error_code, ""); - goaway_description_ = SpdyMakeUnique<SpdyString>(); + goaway_description_ = SpdyMakeUnique<std::string>(); } // If len==0 then we've reached the end of the GOAWAY frame. @@ -761,7 +761,8 @@ frame_type_ == PUSH_PROMISE) << " frame_type_=" << Http2FrameTypeToString(frame_type_); CHECK(!got_hpack_end_); - HTTP2_DIE_IF_NULL(headers_)->emplace_back(SpdyString(key), SpdyString(value)); + HTTP2_DIE_IF_NULL(headers_)->emplace_back(std::string(key), + std::string(value)); HTTP2_DIE_IF_NULL(headers_handler_)->OnHeader(key, value); }
diff --git a/spdy/core/spdy_deframer_visitor.h b/spdy/core/spdy_deframer_visitor.h index 272a4f6..f95d513 100644 --- a/spdy/core/spdy_deframer_visitor.h +++ b/spdy/core/spdy_deframer_visitor.h
@@ -68,8 +68,8 @@ // are met. #include <cstdint> - #include <memory> +#include <string> #include <type_traits> #include <utility> #include <vector> @@ -79,7 +79,6 @@ #include "net/third_party/quiche/src/spdy/core/spdy_protocol_test_utils.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.h" namespace spdy { namespace test { @@ -91,7 +90,7 @@ // particular the order of each header entry, though it doesn't expose the // inner details of the HPACK block, such as the type of encoding selected // for each header entry, nor dynamic table size changes. -typedef std::pair<SpdyString, SpdyString> StringPair; +typedef std::pair<std::string, std::string> StringPair; typedef std::vector<StringPair> StringPairVector; // Forward decl.
diff --git a/spdy/core/spdy_framer.cc b/spdy/core/spdy_framer.cc index 7891d72..59f7c3b 100644 --- a/spdy/core/spdy_framer.cc +++ b/spdy/core/spdy_framer.cc
@@ -96,7 +96,7 @@ // block. Does not need or use the SpdyHeaderBlock inside SpdyHeadersIR. // Return false if the serialization fails. |encoding| should not be empty. bool SerializeHeadersGivenEncoding(const SpdyHeadersIR& headers, - const SpdyString& encoding, + const std::string& encoding, const bool end_headers, ZeroCopyOutputBuffer* output) { const size_t frame_size = @@ -124,7 +124,7 @@ } if (ret && headers.padding_payload_len() > 0) { - SpdyString padding(headers.padding_payload_len(), 0); + std::string padding(headers.padding_payload_len(), 0); ret &= builder.WriteBytes(padding.data(), padding.length()); } @@ -138,7 +138,7 @@ // encoded header block. Does not need or use the SpdyHeaderBlock inside // SpdyPushPromiseIR. bool SerializePushPromiseGivenEncoding(const SpdyPushPromiseIR& push_promise, - const SpdyString& encoding, + const std::string& encoding, const bool end_headers, ZeroCopyOutputBuffer* output) { const size_t frame_size = @@ -155,7 +155,7 @@ ok = ok && builder.WriteUInt32(push_promise.promised_stream_id()) && builder.WriteBytes(encoding.data(), encoding.size()); if (ok && push_promise.padding_payload_len() > 0) { - SpdyString padding(push_promise.padding_payload_len(), 0); + std::string padding(push_promise.padding_payload_len(), 0); ok = builder.WriteBytes(padding.data(), padding.length()); } @@ -166,7 +166,7 @@ } bool WritePayloadWithContinuation(SpdyFrameBuilder* builder, - const SpdyString& hpack_encoding, + const std::string& hpack_encoding, SpdyStreamId stream_id, SpdyFrameType type, int padding_payload_len) { @@ -191,7 +191,7 @@ bool ret = builder->WriteBytes(&hpack_encoding[0], hpack_encoding.size() - bytes_remaining); if (padding_payload_len > 0) { - SpdyString padding = SpdyString(padding_payload_len, 0); + std::string padding = std::string(padding_payload_len, 0); ret &= builder->WriteBytes(padding.data(), padding.length()); } @@ -262,7 +262,7 @@ } void SerializeAltSvcBuilderHelper(const SpdyAltSvcIR& altsvc_ir, - SpdyString* value, + std::string* value, size_t* size) { *size = kGetAltSvcFrameMinimumSize; *size = *size + altsvc_ir.origin().length(); @@ -301,7 +301,7 @@ const size_t size_without_block = is_first_frame_ ? GetFrameSizeSansBlock() : kContinuationFrameMinimumSize; - auto encoding = SpdyMakeUnique<SpdyString>(); + auto encoding = SpdyMakeUnique<std::string>(); encoder_->Next(kHttp2MaxControlFrameSendSize - size_without_block, encoding.get()); has_next_frame_ = encoder_->HasNext(); @@ -353,7 +353,7 @@ } bool SpdyFramer::SpdyHeaderFrameIterator::SerializeGivenEncoding( - const SpdyString& encoding, + const std::string& encoding, ZeroCopyOutputBuffer* output) const { return SerializeHeadersGivenEncoding(*headers_ir_, encoding, !has_next_frame(), output); @@ -378,7 +378,7 @@ } bool SpdyFramer::SpdyPushPromiseFrameIterator::SerializeGivenEncoding( - const SpdyString& encoding, + const std::string& encoding, ZeroCopyOutputBuffer* output) const { return SerializePushPromiseGivenEncoding(*push_promise_ir_, encoding, !has_next_frame(), output); @@ -446,7 +446,7 @@ } builder.WriteBytes(data_ir.data(), data_ir.data_len()); if (data_ir.padding_payload_len() > 0) { - SpdyString padding(data_ir.padding_payload_len(), 0); + std::string padding(data_ir.padding_payload_len(), 0); builder.WriteBytes(padding.data(), padding.length()); } DCHECK_EQ(size_with_padding, builder.length()); @@ -552,7 +552,7 @@ void SpdyFramer::SerializeHeadersBuilderHelper(const SpdyHeadersIR& headers, uint8_t* flags, size_t* size, - SpdyString* hpack_encoding, + std::string* hpack_encoding, int* weight, size_t* length_field) { if (headers.fin()) { @@ -608,7 +608,7 @@ // The size of this frame, including padding (if there is any) and // variable-length header block. size_t size = 0; - SpdyString hpack_encoding; + std::string hpack_encoding; int weight = 0; size_t length_field = 0; SerializeHeadersBuilderHelper(headers, &flags, &size, &hpack_encoding, @@ -658,7 +658,7 @@ void SpdyFramer::SerializePushPromiseBuilderHelper( const SpdyPushPromiseIR& push_promise, uint8_t* flags, - SpdyString* hpack_encoding, + std::string* hpack_encoding, size_t* size) { *flags = 0; // This will get overwritten if we overflow into a CONTINUATION frame. @@ -686,7 +686,7 @@ const SpdyPushPromiseIR& push_promise) { uint8_t flags = 0; size_t size = 0; - SpdyString hpack_encoding; + std::string hpack_encoding; SerializePushPromiseBuilderHelper(push_promise, &flags, &hpack_encoding, &size); @@ -725,7 +725,7 @@ SpdySerializedFrame SpdyFramer::SerializeContinuation( const SpdyContinuationIR& continuation) const { - const SpdyString& encoding = continuation.encoding(); + const std::string& encoding = continuation.encoding(); size_t frame_size = kContinuationFrameMinimumSize + encoding.size(); SpdyFrameBuilder builder(frame_size); uint8_t flags = continuation.end_headers() ? HEADERS_FLAG_END_HEADERS : 0; @@ -738,7 +738,7 @@ } SpdySerializedFrame SpdyFramer::SerializeAltSvc(const SpdyAltSvcIR& altsvc_ir) { - SpdyString value; + std::string value; size_t size = 0; SerializeAltSvcBuilderHelper(altsvc_ir, &value, &size); SpdyFrameBuilder builder(size); @@ -942,8 +942,8 @@ ok = ok && builder.WriteBytes(data_ir.data(), data_ir.data_len()); if (data_ir.padding_payload_len() > 0) { - SpdyString padding; - padding = SpdyString(data_ir.padding_payload_len(), 0); + std::string padding; + padding = std::string(data_ir.padding_payload_len(), 0); ok = ok && builder.WriteBytes(padding.data(), padding.length()); } DCHECK_EQ(size_with_padding, builder.length()); @@ -1054,7 +1054,7 @@ // The size of this frame, including padding (if there is any) and // variable-length header block. size_t size = 0; - SpdyString hpack_encoding; + std::string hpack_encoding; int weight = 0; size_t length_field = 0; SerializeHeadersBuilderHelper(headers, &flags, &size, &hpack_encoding, @@ -1107,7 +1107,7 @@ ZeroCopyOutputBuffer* output) { uint8_t flags = 0; size_t size = 0; - SpdyString hpack_encoding; + std::string hpack_encoding; SerializePushPromiseBuilderHelper(push_promise, &flags, &hpack_encoding, &size); @@ -1148,7 +1148,7 @@ bool SpdyFramer::SerializeContinuation(const SpdyContinuationIR& continuation, ZeroCopyOutputBuffer* output) const { - const SpdyString& encoding = continuation.encoding(); + const std::string& encoding = continuation.encoding(); size_t frame_size = kContinuationFrameMinimumSize + encoding.size(); SpdyFrameBuilder builder(frame_size, output); uint8_t flags = continuation.end_headers() ? HEADERS_FLAG_END_HEADERS : 0; @@ -1163,7 +1163,7 @@ bool SpdyFramer::SerializeAltSvc(const SpdyAltSvcIR& altsvc_ir, ZeroCopyOutputBuffer* output) { - SpdyString value; + std::string value; size_t size = 0; SerializeAltSvcBuilderHelper(altsvc_ir, &value, &size); SpdyFrameBuilder builder(size, output);
diff --git a/spdy/core/spdy_framer.h b/spdy/core/spdy_framer.h index e268994..45d1f86 100644 --- a/spdy/core/spdy_framer.h +++ b/spdy/core/spdy_framer.h
@@ -10,6 +10,7 @@ #include <cstdint> #include <map> #include <memory> +#include <string> #include <utility> #include "net/third_party/quiche/src/spdy/core/hpack/hpack_encoder.h" @@ -19,7 +20,6 @@ #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_export.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" namespace spdy { @@ -258,7 +258,7 @@ protected: virtual size_t GetFrameSizeSansBlock() const = 0; - virtual bool SerializeGivenEncoding(const SpdyString& encoding, + virtual bool SerializeGivenEncoding(const std::string& encoding, ZeroCopyOutputBuffer* output) const = 0; SpdyFramer* GetFramer() const { return framer_; } @@ -291,7 +291,7 @@ private: const SpdyFrameIR& GetIR() const override; size_t GetFrameSizeSansBlock() const override; - bool SerializeGivenEncoding(const SpdyString& encoding, + bool SerializeGivenEncoding(const std::string& encoding, ZeroCopyOutputBuffer* output) const override; const std::unique_ptr<const SpdyHeadersIR> headers_ir_; @@ -313,7 +313,7 @@ private: const SpdyFrameIR& GetIR() const override; size_t GetFrameSizeSansBlock() const override; - bool SerializeGivenEncoding(const SpdyString& encoding, + bool SerializeGivenEncoding(const std::string& encoding, ZeroCopyOutputBuffer* output) const override; const std::unique_ptr<const SpdyPushPromiseIR> push_promise_ir_; @@ -344,12 +344,12 @@ void SerializeHeadersBuilderHelper(const SpdyHeadersIR& headers, uint8_t* flags, size_t* size, - SpdyString* hpack_encoding, + std::string* hpack_encoding, int* weight, size_t* length_field); void SerializePushPromiseBuilderHelper(const SpdyPushPromiseIR& push_promise, uint8_t* flags, - SpdyString* hpack_encoding, + std::string* hpack_encoding, size_t* size); std::unique_ptr<HpackEncoder> hpack_encoder_;
diff --git a/spdy/core/spdy_framer_test.cc b/spdy/core/spdy_framer_test.cc index abca5a7..a424adb 100644 --- a/spdy/core/spdy_framer_test.cc +++ b/spdy/core/spdy_framer_test.cc
@@ -24,7 +24,6 @@ #include "net/third_party/quiche/src/spdy/platform/api/spdy_flags.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_ptr_util.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" @@ -411,7 +410,7 @@ << "\", altsvc_vector)"; test_altsvc_ir_ = SpdyMakeUnique<SpdyAltSvcIR>(stream_id); if (origin.length() > 0) { - test_altsvc_ir_->set_origin(SpdyString(origin)); + test_altsvc_ir_->set_origin(std::string(origin)); } for (const auto& altsvc : altsvc_vector) { test_altsvc_ir_->add_altsvc(altsvc); @@ -568,7 +567,7 @@ size_t length_ = 0; uint8_t type_ = 0; uint8_t flags_ = 0; - SpdyString payload_; + std::string payload_; }; // Exposes SpdyUnknownIR::set_length() for testing purposes. @@ -600,7 +599,7 @@ } } - void CompareFrame(const SpdyString& description, + void CompareFrame(const std::string& description, const SpdySerializedFrame& actual_frame, const unsigned char* expected, const int expected_len) { @@ -1034,7 +1033,7 @@ SpdyContinuationIR continuation(/* stream_id = */ 0); auto some_nonsense_encoding = - SpdyMakeUnique<SpdyString>("some nonsense encoding"); + SpdyMakeUnique<std::string>("some nonsense encoding"); continuation.take_encoding(std::move(some_nonsense_encoding)); continuation.set_end_headers(true); SpdySerializedFrame frame(framer_.SerializeContinuation(continuation)); @@ -1101,11 +1100,11 @@ TEST_P(SpdyFramerTest, MultiValueHeader) { SpdyFramer framer(SpdyFramer::DISABLE_COMPRESSION); - SpdyString value("value1\0value2", 13); + std::string value("value1\0value2", 13); // TODO(jgraettinger): If this pattern appears again, move to test class. SpdyHeaderBlock header_set; header_set["name"] = value; - SpdyString buffer; + std::string buffer; HpackEncoder encoder(ObtainHpackHuffmanTable()); encoder.DisableCompression(); encoder.EncodeHeaderSet(header_set, &buffer); @@ -2308,7 +2307,7 @@ SpdyHeaderBlock header_block; header_block["bar"] = "foo"; header_block["foo"] = "bar"; - auto buffer = SpdyMakeUnique<SpdyString>(); + auto buffer = SpdyMakeUnique<std::string>(); HpackEncoder encoder(ObtainHpackHuffmanTable()); encoder.DisableCompression(); encoder.EncodeHeaderSet(header_block, buffer.get()); @@ -2426,7 +2425,7 @@ SpdyPushPromiseIR push_promise(/* stream_id = */ 42, /* promised_stream_id = */ 57); push_promise.set_padding_len(1); - SpdyString big_value(kHttp2MaxControlFrameSendSize, 'x'); + std::string big_value(kHttp2MaxControlFrameSendSize, 'x'); push_promise.SetHeader("xxx", big_value); SpdySerializedFrame frame(SpdyFramerPeer::SerializePushPromise( &framer, push_promise, use_output_ ? &output_ : nullptr)); @@ -2617,7 +2616,7 @@ // Exact payload length will change with HPACK, but this should be long // enough to cause an overflow. const size_t kBigValueSize = kHttp2MaxControlFrameSendSize; - SpdyString big_value(kBigValueSize, 'x'); + std::string big_value(kBigValueSize, 'x'); headers.SetHeader("aa", big_value); SpdySerializedFrame control_frame(SpdyFramerPeer::SerializeHeaders( &framer, headers, use_output_ ? &output_ : nullptr)); @@ -2642,9 +2641,9 @@ // Exact payload length will change with HPACK, but this should be long // enough to cause an overflow. const size_t kBigValueSize = kHttp2MaxControlFrameSendSize; - SpdyString big_valuex(kBigValueSize, 'x'); + std::string big_valuex(kBigValueSize, 'x'); headers->SetHeader("aa", big_valuex); - SpdyString big_valuez(kBigValueSize, 'z'); + std::string big_valuez(kBigValueSize, 'z'); headers->SetHeader("bb", big_valuez); SpdyFramer::SpdyHeaderFrameIterator frame_it(&framer, std::move(headers)); @@ -2707,9 +2706,9 @@ // Exact payload length will change with HPACK, but this should be long // enough to cause an overflow. const size_t kBigValueSize = kHttp2MaxControlFrameSendSize; - SpdyString big_valuex(kBigValueSize, 'x'); + std::string big_valuex(kBigValueSize, 'x'); push_promise->SetHeader("aa", big_valuex); - SpdyString big_valuez(kBigValueSize, 'z'); + std::string big_valuez(kBigValueSize, 'z'); push_promise->SetHeader("bb", big_valuez); SpdyFramer::SpdyPushPromiseFrameIterator frame_it(&framer, @@ -2836,7 +2835,7 @@ // Exact payload length will change with HPACK, but this should be long // enough to cause an overflow. const size_t kBigValueSize = kHttp2MaxControlFrameSendSize; - SpdyString big_value(kBigValueSize, 'x'); + std::string big_value(kBigValueSize, 'x'); push_promise.SetHeader("aa", big_value); SpdySerializedFrame control_frame(SpdyFramerPeer::SerializePushPromise( &framer, push_promise, use_output_ ? &output_ : nullptr)); @@ -2861,7 +2860,7 @@ const size_t kHeaderBufferSize = kHttp2DefaultFramePayloadLimit / kHeaderBufferChunks; const size_t kBigValueSize = kHeaderBufferSize * 2; - SpdyString big_value(kBigValueSize, 'x'); + std::string big_value(kBigValueSize, 'x'); SpdyHeadersIR headers(/* stream_id = */ 1); headers.set_fin(true); headers.SetHeader("aa", big_value); @@ -2898,7 +2897,7 @@ 0x00, 0x00, 0x00, // Truncated Status Field }; const size_t pad_length = length + kFrameHeaderSize - sizeof(kH2FrameData); - SpdyString pad(pad_length, 'A'); + std::string pad(pad_length, 'A'); TestSpdyVisitor visitor(SpdyFramer::DISABLE_COMPRESSION); visitor.SimulateInFramer(kH2FrameData, sizeof(kH2FrameData)); @@ -3649,7 +3648,7 @@ EXPECT_EQ(20u, extension.length_); EXPECT_EQ(255, extension.type_); EXPECT_EQ(0xff, extension.flags_); - EXPECT_EQ(SpdyString(20, '\xff'), extension.payload_); + EXPECT_EQ(std::string(20, '\xff'), extension.payload_); // Follow it up with a valid control frame to make sure we handle // subsequent frames correctly. @@ -4646,7 +4645,7 @@ SPDY_VLOG(1) << "frame1_size = " << frame1_size; SPDY_VLOG(1) << "frame2_size = " << frame2_size; - SpdyString input_buffer; + std::string input_buffer; input_buffer.append(frame1.data(), frame1_size); input_buffer.append(frame2.data(), frame2_size); @@ -4693,7 +4692,7 @@ SPDY_VLOG(1) << "frame1_size = " << frame1_size; SPDY_VLOG(1) << "frame2_size = " << frame2_size; - SpdyString input_buffer; + std::string input_buffer; input_buffer.append(frame1.data(), frame1_size); input_buffer.append(frame2.data(), frame2_size); @@ -4792,8 +4791,8 @@ CheckFrameAndIRSize(&headers_ir, &framer, &output_); SpdyHeadersIR headers_ir_with_continuation(1); - headers_ir_with_continuation.SetHeader("alpha", SpdyString(100000, 'x')); - headers_ir_with_continuation.SetHeader("beta", SpdyString(100000, 'x')); + headers_ir_with_continuation.SetHeader("alpha", std::string(100000, 'x')); + headers_ir_with_continuation.SetHeader("beta", std::string(100000, 'x')); headers_ir_with_continuation.SetHeader("cookie", "key1=value1; key2=value2"); CheckFrameAndIRSize(&headers_ir_with_continuation, &framer, &output_); @@ -4801,8 +4800,8 @@ CheckFrameAndIRSize(&window_update_ir, &framer, &output_); SpdyPushPromiseIR push_promise_ir(3, 8); - push_promise_ir.SetHeader("alpha", SpdyString(100000, 'x')); - push_promise_ir.SetHeader("beta", SpdyString(100000, 'x')); + push_promise_ir.SetHeader("alpha", std::string(100000, 'x')); + push_promise_ir.SetHeader("beta", std::string(100000, 'x')); push_promise_ir.SetHeader("cookie", "key1=value1; key2=value2"); CheckFrameAndIRSize(&push_promise_ir, &framer, &output_);
diff --git a/spdy/core/spdy_header_block.cc b/spdy/core/spdy_header_block.cc index c99bbf3..705038a 100644 --- a/spdy/core/spdy_header_block.cc +++ b/spdy/core/spdy_header_block.cc
@@ -218,11 +218,11 @@ return *this; } -SpdyString SpdyHeaderBlock::ValueProxy::as_string() const { +std::string SpdyHeaderBlock::ValueProxy::as_string() const { if (lookup_result_ == block_->end()) { return ""; } else { - return SpdyString(lookup_result_->second.value()); + return std::string(lookup_result_->second.value()); } } @@ -262,12 +262,12 @@ return !(operator==(other)); } -SpdyString SpdyHeaderBlock::DebugString() const { +std::string SpdyHeaderBlock::DebugString() const { if (empty()) { return "{}"; } - SpdyString output = "\n{\n"; + std::string output = "\n{\n"; for (auto it = begin(); it != end(); ++it) { SpdyStrAppend(&output, " ", it->first, " ", it->second, "\n"); }
diff --git a/spdy/core/spdy_header_block.h b/spdy/core/spdy_header_block.h index f579579..71e1537 100644 --- a/spdy/core/spdy_header_block.h +++ b/spdy/core/spdy_header_block.h
@@ -9,13 +9,13 @@ #include <list> #include <memory> +#include <string> #include <utility> #include <vector> #include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_macros.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" namespace spdy { @@ -149,7 +149,7 @@ // Provides a human readable multi-line representation of the stored header // keys and values. - SpdyString DebugString() const; + std::string DebugString() const; iterator begin() { return iterator(block_.begin()); } iterator end() { return iterator(block_.end()); } @@ -183,7 +183,8 @@ SPDY_MUST_USE_RESULT ValueProxy operator[](const SpdyStringPiece key); // This object provides automatic conversions that allow SpdyHeaderBlock to be - // nearly a drop-in replacement for SpdyLinkedHashMap<SpdyString, SpdyString>. + // nearly a drop-in replacement for + // SpdyLinkedHashMap<std::string, std::string>. // It reads data from or writes data to a SpdyHeaderBlock::Storage. class SPDY_EXPORT_PRIVATE ValueProxy { public: @@ -200,7 +201,7 @@ // Assignment modifies the underlying SpdyHeaderBlock. ValueProxy& operator=(const SpdyStringPiece other); - SpdyString as_string() const; + std::string as_string() const; private: friend class SpdyHeaderBlock;
diff --git a/spdy/core/spdy_header_block_test.cc b/spdy/core/spdy_header_block_test.cc index f869431..c34b718 100644 --- a/spdy/core/spdy_header_block_test.cc +++ b/spdy/core/spdy_header_block_test.cc
@@ -69,15 +69,15 @@ // This test verifies that headers can be set in a variety of ways. TEST(SpdyHeaderBlockTest, AddHeaders) { SpdyHeaderBlock block; - block["foo"] = SpdyString(300, 'x'); + block["foo"] = std::string(300, 'x'); block["bar"] = "baz"; block["qux"] = "qux1"; block["qux"] = "qux2"; block.insert(std::make_pair("key", "value")); - EXPECT_EQ(Pair("foo", SpdyString(300, 'x')), *block.find("foo")); + EXPECT_EQ(Pair("foo", std::string(300, 'x')), *block.find("foo")); EXPECT_EQ("baz", block["bar"]); - SpdyString qux("qux"); + std::string qux("qux"); EXPECT_EQ("qux2", block[qux]); ASSERT_NE(block.end(), block.find("key")); EXPECT_EQ(Pair("key", "value"), *block.find("key")); @@ -89,7 +89,7 @@ // This test verifies that SpdyHeaderBlock can be copied using Clone(). TEST(SpdyHeaderBlockTest, CopyBlocks) { SpdyHeaderBlock block1; - block1["foo"] = SpdyString(300, 'x'); + block1["foo"] = std::string(300, 'x'); block1["bar"] = "baz"; block1.insert(std::make_pair("qux", "qux1")); @@ -147,7 +147,7 @@ SpdyHeaderBlock block; block["foo"] = "foo"; block.AppendValueOrAddHeader("foo", "bar"); - EXPECT_EQ(Pair("foo", SpdyString("foo\0bar", 7)), *block.find("foo")); + EXPECT_EQ(Pair("foo", std::string("foo\0bar", 7)), *block.find("foo")); block.insert(std::make_pair("foo", "baz")); EXPECT_EQ("baz", block["foo"]); @@ -171,9 +171,9 @@ EXPECT_EQ("key1=value1; key2=value2; key3=value3", block["cookie"]); EXPECT_EQ("baz", block["foo"]); - EXPECT_EQ(SpdyString("h1v1\0h1v2\0h1v3", 14), block["h1"]); - EXPECT_EQ(SpdyString("h2v1\0h2v2\0h2v3", 14), block["h2"]); - EXPECT_EQ(SpdyString("h3v2\0h3v3", 9), block["h3"]); + EXPECT_EQ(std::string("h1v1\0h1v2\0h1v3", 14), block["h1"]); + EXPECT_EQ(std::string("h2v1\0h2v2\0h2v3", 14), block["h2"]); + EXPECT_EQ(std::string("h3v2\0h3v3", 9), block["h3"]); EXPECT_EQ("singleton", block["h4"]); } @@ -217,20 +217,20 @@ TEST(SpdyHeaderBlockTest, TotalBytesUsed) { SpdyHeaderBlock block; const size_t value_size = 300; - block["foo"] = SpdyString(value_size, 'x'); + block["foo"] = std::string(value_size, 'x'); EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block)); - block.insert(std::make_pair("key", SpdyString(value_size, 'x'))); + block.insert(std::make_pair("key", std::string(value_size, 'x'))); EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block)); - block.AppendValueOrAddHeader("abc", SpdyString(value_size, 'x')); + block.AppendValueOrAddHeader("abc", std::string(value_size, 'x')); EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block)); // Replace value for existing key. - block["foo"] = SpdyString(value_size, 'x'); + block["foo"] = std::string(value_size, 'x'); EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block)); - block.insert(std::make_pair("key", SpdyString(value_size, 'x'))); + block.insert(std::make_pair("key", std::string(value_size, 'x'))); EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block)); // Add value for existing key. - block.AppendValueOrAddHeader("abc", SpdyString(value_size, 'x')); + block.AppendValueOrAddHeader("abc", std::string(value_size, 'x')); EXPECT_EQ(block.TotalBytesUsed(), SpdyHeaderBlockSize(block)); // Copies/clones SpdyHeaderBlock.
diff --git a/spdy/core/spdy_intrusive_list_test.cc b/spdy/core/spdy_intrusive_list_test.cc index 8577651..7fecec4 100644 --- a/spdy/core/spdy_intrusive_list_test.cc +++ b/spdy/core/spdy_intrusive_list_test.cc
@@ -7,9 +7,9 @@ #include <algorithm> #include <cstddef> #include <list> +#include <string> #include <utility> -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" namespace spdy { @@ -282,24 +282,24 @@ struct AbstractBase : public SpdyIntrusiveLink<AbstractBase, BaseLinkId> { virtual ~AbstractBase() = 0; - virtual SpdyString name() { return "AbstractBase"; } + virtual std::string name() { return "AbstractBase"; } }; AbstractBase::~AbstractBase() {} struct DerivedClass : public SpdyIntrusiveLink<DerivedClass, DerivedLinkId>, public AbstractBase { virtual ~DerivedClass() {} - virtual SpdyString name() { return "DerivedClass"; } + virtual std::string name() { return "DerivedClass"; } }; struct VirtuallyDerivedBaseClass : public virtual AbstractBase { virtual ~VirtuallyDerivedBaseClass() = 0; - virtual SpdyString name() { return "VirtuallyDerivedBaseClass"; } + virtual std::string name() { return "VirtuallyDerivedBaseClass"; } }; VirtuallyDerivedBaseClass::~VirtuallyDerivedBaseClass() {} struct VirtuallyDerivedClassA : public SpdyIntrusiveLink<VirtuallyDerivedClassA, DerivedLinkId>, public virtual VirtuallyDerivedBaseClass { virtual ~VirtuallyDerivedClassA() {} - virtual SpdyString name() { return "VirtuallyDerivedClassA"; } + virtual std::string name() { return "VirtuallyDerivedClassA"; } }; struct NonceClass { virtual ~NonceClass() {} @@ -310,7 +310,7 @@ public virtual NonceClass, public virtual VirtuallyDerivedBaseClass { virtual ~VirtuallyDerivedClassB() {} - virtual SpdyString name() { return "VirtuallyDerivedClassB"; } + virtual std::string name() { return "VirtuallyDerivedClassB"; } }; struct VirtuallyDerivedClassC : public SpdyIntrusiveLink<VirtuallyDerivedClassC, DerivedLinkId>, @@ -318,7 +318,7 @@ public virtual NonceClass, public virtual VirtuallyDerivedBaseClass { virtual ~VirtuallyDerivedClassC() {} - virtual SpdyString name() { return "VirtuallyDerivedClassC"; } + virtual std::string name() { return "VirtuallyDerivedClassC"; } }; // Test for multiple layers between the element type and the link.
diff --git a/spdy/core/spdy_pinnable_buffer_piece_test.cc b/spdy/core/spdy_pinnable_buffer_piece_test.cc index d62af5b..9c7f138 100644 --- a/spdy/core/spdy_pinnable_buffer_piece_test.cc +++ b/spdy/core/spdy_pinnable_buffer_piece_test.cc
@@ -4,8 +4,9 @@ #include "net/third_party/quiche/src/spdy/core/spdy_pinnable_buffer_piece.h" +#include <string> + #include "net/third_party/quiche/src/spdy/core/spdy_prefixed_buffer_reader.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" namespace spdy { @@ -14,14 +15,14 @@ class SpdyPinnableBufferPieceTest : public ::testing::Test { protected: - SpdyPrefixedBufferReader Build(const SpdyString& prefix, - const SpdyString& suffix) { + SpdyPrefixedBufferReader Build(const std::string& prefix, + const std::string& suffix) { prefix_ = prefix; suffix_ = suffix; return SpdyPrefixedBufferReader(prefix_.data(), prefix_.length(), suffix_.data(), suffix_.length()); } - SpdyString prefix_, suffix_; + std::string prefix_, suffix_; }; TEST_F(SpdyPinnableBufferPieceTest, Pin) {
diff --git a/spdy/core/spdy_prefixed_buffer_reader_test.cc b/spdy/core/spdy_prefixed_buffer_reader_test.cc index f570dfc..a0f9257 100644 --- a/spdy/core/spdy_prefixed_buffer_reader_test.cc +++ b/spdy/core/spdy_prefixed_buffer_reader_test.cc
@@ -4,7 +4,8 @@ #include "net/third_party/quiche/src/spdy/core/spdy_prefixed_buffer_reader.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" +#include <string> + #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" @@ -16,14 +17,14 @@ class SpdyPrefixedBufferReaderTest : public ::testing::Test { protected: - SpdyPrefixedBufferReader Build(const SpdyString& prefix, - const SpdyString& suffix) { + SpdyPrefixedBufferReader Build(const std::string& prefix, + const std::string& suffix) { prefix_ = prefix; suffix_ = suffix; return SpdyPrefixedBufferReader(prefix_.data(), prefix_.length(), suffix_.data(), suffix_.length()); } - SpdyString prefix_, suffix_; + std::string prefix_, suffix_; }; TEST_F(SpdyPrefixedBufferReaderTest, ReadRawFromPrefix) {
diff --git a/spdy/core/spdy_protocol.cc b/spdy/core/spdy_protocol.cc index 9094b47..dae7006 100644 --- a/spdy/core/spdy_protocol.cc +++ b/spdy/core/spdy_protocol.cc
@@ -157,7 +157,7 @@ return false; } -SpdyString SettingsIdToString(SpdySettingsId id) { +std::string SettingsIdToString(SpdySettingsId id) { SpdyKnownSettingsId known_id; if (!ParseSettingsId(id, &known_id)) { return SpdyStrCat("SETTINGS_UNKNOWN_", @@ -293,9 +293,9 @@ SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id, const char* data) : SpdyDataIR(stream_id, SpdyStringPiece(data)) {} -SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id, SpdyString data) +SpdyDataIR::SpdyDataIR(SpdyStreamId stream_id, std::string data) : SpdyFrameWithFinIR(stream_id), - data_store_(SpdyMakeUnique<SpdyString>(std::move(data))), + data_store_(SpdyMakeUnique<std::string>(std::move(data))), data_(data_store_->data()), data_len_(data_store_->size()), padded_(false), @@ -392,7 +392,7 @@ SpdyGoAwayIR::SpdyGoAwayIR(SpdyStreamId last_good_stream_id, SpdyErrorCode error_code, - SpdyString description) + std::string description) : description_store_(std::move(description)), description_(description_store_) { set_last_good_stream_id(last_good_stream_id); @@ -415,7 +415,7 @@ SpdyContinuationIR::SpdyContinuationIR(SpdyStreamId stream_id) : SpdyFrameIR(stream_id), end_headers_(false) { - encoding_ = SpdyMakeUnique<SpdyString>(); + encoding_ = SpdyMakeUnique<std::string>(); } SpdyContinuationIR::~SpdyContinuationIR() = default; @@ -519,7 +519,7 @@ size_t size = kGetAltSvcFrameMinimumSize; size += origin_.length(); // TODO(yasong): estimates the size without serializing the vector. - SpdyString str = + std::string str = SpdyAltSvcWireFormat::SerializeHeaderFieldValue(altsvc_vector_); size += str.size(); return size;
diff --git a/spdy/core/spdy_protocol.h b/spdy/core/spdy_protocol.h index 38eab0f..b014107 100644 --- a/spdy/core/spdy_protocol.h +++ b/spdy/core/spdy_protocol.h
@@ -16,6 +16,7 @@ #include <map> #include <memory> #include <new> +#include <string> #include <utility> #include "net/third_party/quiche/src/spdy/core/spdy_alt_svc_wire_format.h" @@ -25,7 +26,6 @@ #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_ptr_util.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" namespace spdy { @@ -274,7 +274,7 @@ // Returns a string representation of the |id| for logging/debugging. Returns // the |id| prefixed with "SETTINGS_UNKNOWN_" for unknown SETTINGS IDs. To parse // the |id| into a SpdyKnownSettingsId (if applicable), use ParseSettingsId(). -SPDY_EXPORT_PRIVATE SpdyString SettingsIdToString(SpdySettingsId id); +SPDY_EXPORT_PRIVATE std::string SettingsIdToString(SpdySettingsId id); // Parse |wire_error_code| to a SpdyErrorCode. // Treat unrecognized error codes as INTERNAL_ERROR @@ -524,7 +524,7 @@ SpdyDataIR(SpdyStreamId stream_id, const char* data); // Moves data into data_store_. Makes a copy if passed a non-movable string. - SpdyDataIR(SpdyStreamId stream_id, SpdyString data); + SpdyDataIR(SpdyStreamId stream_id, std::string data); // Use in conjunction with SetDataShallow() for shallow-copy on data. explicit SpdyDataIR(SpdyStreamId stream_id); @@ -550,7 +550,7 @@ // Deep-copy of data (keep private copy). void SetDataDeep(SpdyStringPiece data) { - data_store_ = SpdyMakeUnique<SpdyString>(data.data(), data.size()); + data_store_ = SpdyMakeUnique<std::string>(data.data(), data.size()); data_ = data_store_->data(); data_len_ = data.size(); } @@ -580,7 +580,7 @@ private: // Used to store data that this SpdyDataIR should own. - std::unique_ptr<SpdyString> data_store_; + std::unique_ptr<std::string> data_store_; const char* data_; size_t data_len_; @@ -674,7 +674,7 @@ // keep description live after constructing this SpdyGoAwayIR. SpdyGoAwayIR(SpdyStreamId last_good_stream_id, SpdyErrorCode error_code, - SpdyString description); + std::string description); SpdyGoAwayIR(const SpdyGoAwayIR&) = delete; SpdyGoAwayIR& operator=(const SpdyGoAwayIR&) = delete; @@ -702,7 +702,7 @@ private: SpdyStreamId last_good_stream_id_; SpdyErrorCode error_code_; - const SpdyString description_store_; + const std::string description_store_; const SpdyStringPiece description_; }; @@ -826,14 +826,14 @@ bool end_headers() const { return end_headers_; } void set_end_headers(bool end_headers) { end_headers_ = end_headers; } - const SpdyString& encoding() const { return *encoding_; } - void take_encoding(std::unique_ptr<SpdyString> encoding) { + const std::string& encoding() const { return *encoding_; } + void take_encoding(std::unique_ptr<std::string> encoding) { encoding_ = std::move(encoding); } size_t size() const override; private: - std::unique_ptr<SpdyString> encoding_; + std::unique_ptr<std::string> encoding_; bool end_headers_; }; @@ -844,12 +844,12 @@ SpdyAltSvcIR& operator=(const SpdyAltSvcIR&) = delete; ~SpdyAltSvcIR() override; - SpdyString origin() const { return origin_; } + std::string origin() const { return origin_; } const SpdyAltSvcWireFormat::AlternativeServiceVector& altsvc_vector() const { return altsvc_vector_; } - void set_origin(SpdyString origin) { origin_ = std::move(origin); } + void set_origin(std::string origin) { origin_ = std::move(origin); } void add_altsvc(const SpdyAltSvcWireFormat::AlternativeService& altsvc) { altsvc_vector_.push_back(altsvc); } @@ -861,7 +861,7 @@ size_t size() const override; private: - SpdyString origin_; + std::string origin_; SpdyAltSvcWireFormat::AlternativeServiceVector altsvc_vector_; }; @@ -899,7 +899,7 @@ SpdyUnknownIR(SpdyStreamId stream_id, uint8_t type, uint8_t flags, - SpdyString payload) + std::string payload) : SpdyFrameIR(stream_id), type_(type), flags_(flags), @@ -910,7 +910,7 @@ uint8_t type() const { return type_; } uint8_t flags() const { return flags_; } size_t length() const { return length_; } - const SpdyString& payload() const { return payload_; } + const std::string& payload() const { return payload_; } void Visit(SpdyFrameVisitor* visitor) const override; @@ -928,7 +928,7 @@ uint8_t type_; uint8_t flags_; size_t length_; - const SpdyString payload_; + const std::string payload_; }; class SPDY_EXPORT_PRIVATE SpdySerializedFrame {
diff --git a/spdy/core/spdy_protocol_test.cc b/spdy/core/spdy_protocol_test.cc index e10d2d6..542d23d 100644 --- a/spdy/core/spdy_protocol_test.cc +++ b/spdy/core/spdy_protocol_test.cc
@@ -131,7 +131,7 @@ TEST(SpdyProtocolTest, SettingsIdToString) { struct { SpdySettingsId setting_id; - const SpdyString expected_string; + const std::string expected_string; } test_cases[] = { {0, "SETTINGS_UNKNOWN_0"}, {SETTINGS_HEADER_TABLE_SIZE, "SETTINGS_HEADER_TABLE_SIZE"}, @@ -240,20 +240,20 @@ EXPECT_EQ((int)d1.data_len(), d1.flow_control_window_consumed()); // Confirm copies a const string. - const SpdyString foo = "foo"; + const std::string foo = "foo"; SpdyDataIR d3(/* stream_id = */ 3, foo); EXPECT_EQ(foo, d3.data()); EXPECT_EQ((int)d3.data_len(), d3.flow_control_window_consumed()); // Confirm copies a non-const string. - SpdyString bar = "bar"; + std::string bar = "bar"; SpdyDataIR d4(/* stream_id = */ 4, bar); EXPECT_EQ("bar", bar); EXPECT_EQ("bar", SpdyStringPiece(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. - SpdyString baz = "the quick brown fox"; + std::string baz = "the quick brown fox"; SpdyDataIR d5(/* stream_id = */ 5, std::move(baz)); EXPECT_EQ("", baz); EXPECT_EQ(SpdyStringPiece(d5.data(), d5.data_len()), "the quick brown fox");
diff --git a/spdy/core/spdy_simple_arena_test.cc b/spdy/core/spdy_simple_arena_test.cc index 217e2d7..60bbe24 100644 --- a/spdy/core/spdy_simple_arena_test.cc +++ b/spdy/core/spdy_simple_arena_test.cc
@@ -4,9 +4,9 @@ #include "net/third_party/quiche/src/spdy/core/spdy_simple_arena.h" +#include <string> #include <vector> -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_test.h" @@ -36,11 +36,11 @@ TEST(SpdySimpleArenaTest, MultipleBlocks) { SpdySimpleArena arena(40 /* block size */); - std::vector<SpdyString> strings = { + std::vector<std::string> strings = { "One decently long string.", "Another string.", "A third string that will surely go in a different block."}; std::vector<SpdyStringPiece> copies; - for (const SpdyString& s : strings) { + for (const std::string& s : strings) { SpdyStringPiece sp(arena.Memdup(s.data(), s.size()), s.size()); copies.push_back(sp); }
diff --git a/spdy/core/spdy_test_utils.cc b/spdy/core/spdy_test_utils.cc index bf54a1a..f248c86 100644 --- a/spdy/core/spdy_test_utils.cc +++ b/spdy/core/spdy_test_utils.cc
@@ -18,10 +18,10 @@ namespace spdy { namespace test { -SpdyString HexDumpWithMarks(const unsigned char* data, - int length, - const bool* marks, - int mark_length) { +std::string HexDumpWithMarks(const unsigned char* data, + int length, + const bool* marks, + int mark_length) { static const char kHexChars[] = "0123456789abcdef"; static const int kColumns = 4; @@ -32,7 +32,7 @@ mark_length = std::min(mark_length, kSizeLimit); } - SpdyString hex; + std::string hex; for (const unsigned char* row = data; length > 0; row += kColumns, length -= kColumns) { for (const unsigned char* p = row; p < row + 4; ++p) { @@ -58,7 +58,7 @@ return hex; } -void CompareCharArraysWithHexError(const SpdyString& description, +void CompareCharArraysWithHexError(const std::string& description, const unsigned char* actual, const int actual_len, const unsigned char* expected,
diff --git a/spdy/core/spdy_test_utils.h b/spdy/core/spdy_test_utils.h index 03a6caf..e2c3b47 100644 --- a/spdy/core/spdy_test_utils.h +++ b/spdy/core/spdy_test_utils.h
@@ -7,12 +7,12 @@ #include <cstddef> #include <cstdint> +#include <string> #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" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" namespace spdy { @@ -24,12 +24,12 @@ namespace test { -SpdyString HexDumpWithMarks(const unsigned char* data, - int length, - const bool* marks, - int mark_length); +std::string HexDumpWithMarks(const unsigned char* data, + int length, + const bool* marks, + int mark_length); -void CompareCharArraysWithHexError(const SpdyString& description, +void CompareCharArraysWithHexError(const std::string& description, const unsigned char* actual, const int actual_len, const unsigned char* expected,
diff --git a/spdy/core/write_scheduler.h b/spdy/core/write_scheduler.h index 98db442..c2c048f 100644 --- a/spdy/core/write_scheduler.h +++ b/spdy/core/write_scheduler.h
@@ -6,12 +6,12 @@ #define QUICHE_SPDY_CORE_WRITE_SCHEDULER_H_ #include <cstdint> +#include <string> #include <tuple> #include <vector> #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" namespace spdy { @@ -154,7 +154,7 @@ virtual size_t NumRegisteredStreams() const = 0; // Returns summary of internal state, for logging/debugging. - virtual SpdyString DebugString() const = 0; + virtual std::string DebugString() const = 0; }; } // namespace spdy
diff --git a/spdy/platform/api/spdy_string.h b/spdy/platform/api/spdy_string.h deleted file mode 100644 index 16eb9e5..0000000 --- a/spdy/platform/api/spdy_string.h +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright (c) 2017 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_STRING_H_ -#define QUICHE_SPDY_PLATFORM_API_SPDY_STRING_H_ - -#include "net/spdy/platform/impl/spdy_string_impl.h" - -namespace spdy { - -using SpdyString = SpdyStringImpl; - -} // namespace spdy - -#endif // QUICHE_SPDY_PLATFORM_API_SPDY_STRING_H_
diff --git a/spdy/platform/api/spdy_string_utils.h b/spdy/platform/api/spdy_string_utils.h index 7554f79..e2f709d 100644 --- a/spdy/platform/api/spdy_string_utils.h +++ b/spdy/platform/api/spdy_string_utils.h
@@ -5,6 +5,7 @@ #ifndef QUICHE_SPDY_PLATFORM_API_SPDY_STRING_UTILS_H_ #define QUICHE_SPDY_PLATFORM_API_SPDY_STRING_UTILS_H_ +#include <string> #include <utility> // The following header file has to be included from at least @@ -13,19 +14,18 @@ // non-test code. #include "net/third_party/quiche/src/spdy/platform/api/spdy_mem_slice.h" -#include "net/third_party/quiche/src/spdy/platform/api/spdy_string.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_string_piece.h" #include "net/spdy/platform/impl/spdy_string_utils_impl.h" namespace spdy { template <typename... Args> -inline SpdyString SpdyStrCat(const Args&... args) { +inline std::string SpdyStrCat(const Args&... args) { return SpdyStrCatImpl(std::forward<const Args&>(args)...); } template <typename... Args> -inline void SpdyStrAppend(SpdyString* output, const Args&... args) { +inline void SpdyStrAppend(std::string* output, const Args&... args) { SpdyStrAppendImpl(output, std::forward<const Args&>(args)...); } @@ -33,7 +33,7 @@ return SpdyHexDigitToIntImpl(c); } -inline SpdyString SpdyHexDecode(SpdyStringPiece data) { +inline std::string SpdyHexDecode(SpdyStringPiece data) { return SpdyHexDecodeImpl(data); } @@ -41,15 +41,15 @@ return SpdyHexDecodeToUInt32Impl(data, out); } -inline SpdyString SpdyHexEncode(const char* bytes, size_t size) { +inline std::string SpdyHexEncode(const char* bytes, size_t size) { return SpdyHexEncodeImpl(bytes, size); } -inline SpdyString SpdyHexEncodeUInt32AndTrim(uint32_t data) { +inline std::string SpdyHexEncodeUInt32AndTrim(uint32_t data) { return SpdyHexEncodeUInt32AndTrimImpl(data); } -inline SpdyString SpdyHexDump(SpdyStringPiece data) { +inline std::string SpdyHexDump(SpdyStringPiece data) { return SpdyHexDumpImpl(data); }
diff --git a/spdy/platform/api/spdy_string_utils_test.cc b/spdy/platform/api/spdy_string_utils_test.cc index 91656ae..f6f094f 100644 --- a/spdy/platform/api/spdy_string_utils_test.cc +++ b/spdy/platform/api/spdy_string_utils_test.cc
@@ -19,7 +19,7 @@ // Single string-like argument. const char kFoo[] = "foo"; - const SpdyString string_foo(kFoo); + const std::string string_foo(kFoo); const SpdyStringPiece stringpiece_foo(string_foo); EXPECT_EQ("foo", SpdyStrCat(kFoo)); EXPECT_EQ("foo", SpdyStrCat(string_foo)); @@ -28,7 +28,7 @@ // Two string-like arguments. const char kBar[] = "bar"; const SpdyStringPiece stringpiece_bar(kBar); - const SpdyString string_bar(kBar); + const std::string string_bar(kBar); EXPECT_EQ("foobar", SpdyStrCat(kFoo, kBar)); EXPECT_EQ("foobar", SpdyStrCat(kFoo, string_bar)); EXPECT_EQ("foobar", SpdyStrCat(kFoo, stringpiece_bar)); @@ -72,13 +72,13 @@ TEST(SpdyStringUtilsTest, SpdyStrAppend) { // No arguments on empty string. - SpdyString output; + std::string output; SpdyStrAppend(&output); EXPECT_TRUE(output.empty()); // Single string-like argument. const char kFoo[] = "foo"; - const SpdyString string_foo(kFoo); + const std::string string_foo(kFoo); const SpdyStringPiece stringpiece_foo(string_foo); SpdyStrAppend(&output, kFoo); EXPECT_EQ("foo", output); @@ -96,7 +96,7 @@ // Two string-like arguments. const char kBar[] = "bar"; const SpdyStringPiece stringpiece_bar(kBar); - const SpdyString string_bar(kBar); + const std::string string_bar(kBar); SpdyStrAppend(&output, kFoo, kBar); EXPECT_EQ("foobar", output); SpdyStrAppend(&output, kFoo, string_bar);