Commit 289178cb authored by Dianna Hu's avatar Dianna Hu Committed by Commit Bot

Replace str.as_string() with Http2String(str).

Also update some comments to refer to Http2String.

This CL lands server changes 189187480 by ahedberg and 190218258 by
diannahu.

BUG=488484

Change-Id: Iffc6a90651103954e2528f16a3d3f7e288d4f333
Reviewed-on: https://chromium-review.googlesource.com/978392Reviewed-by: default avatarBence Béky <bnc@chromium.org>
Commit-Queue: Dianna Hu <diannahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545992}
parent bb58ecbc
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/trace_event/memory_usage_estimator.h" #include "base/trace_event/memory_usage_estimator.h"
#include "net/http2/platform/api/http2_string.h"
#include "net/http2/tools/http2_bug_tracker.h" #include "net/http2/tools/http2_bug_tracker.h"
namespace net { namespace net {
...@@ -166,7 +167,7 @@ void HpackDecoderStringBuffer::BufferStringIfUnbuffered() { ...@@ -166,7 +167,7 @@ void HpackDecoderStringBuffer::BufferStringIfUnbuffered() {
DVLOG(3) << "HpackDecoderStringBuffer::BufferStringIfUnbuffered state=" DVLOG(3) << "HpackDecoderStringBuffer::BufferStringIfUnbuffered state="
<< state_ << ", backing=" << backing_; << state_ << ", backing=" << backing_;
if (state_ != State::RESET && backing_ == Backing::UNBUFFERED) { if (state_ != State::RESET && backing_ == Backing::UNBUFFERED) {
DVLOG(2) << "HpackDecoderStringBuffer buffering string of length " DVLOG(2) << "HpackDecoderStringBuffer buffering Http2String of length "
<< value_.size(); << value_.size();
buffer_.assign(value_.data(), value_.size()); buffer_.assign(value_.data(), value_.size());
if (state_ == State::COMPLETE) { if (state_ == State::COMPLETE) {
...@@ -201,7 +202,7 @@ Http2String HpackDecoderStringBuffer::ReleaseString() { ...@@ -201,7 +202,7 @@ Http2String HpackDecoderStringBuffer::ReleaseString() {
if (backing_ == Backing::BUFFERED) { if (backing_ == Backing::BUFFERED) {
return std::move(buffer_); return std::move(buffer_);
} else { } else {
return value_.as_string(); return Http2String(value_);
} }
} }
return ""; return "";
......
...@@ -121,7 +121,7 @@ class HpackDecoderTest : public ::testing::TestWithParam<bool>, ...@@ -121,7 +121,7 @@ class HpackDecoderTest : public ::testing::TestWithParam<bool>,
// error_message may be used in a GOAWAY frame as the Opaque Data. // error_message may be used in a GOAWAY frame as the Opaque Data.
void OnHeaderErrorDetected(Http2StringPiece error_message) override { void OnHeaderErrorDetected(Http2StringPiece error_message) override {
ASSERT_TRUE(saw_start_); ASSERT_TRUE(saw_start_);
error_messages_.push_back(error_message.as_string()); error_messages_.push_back(Http2String(error_message));
// No further callbacks should be made at this point, so replace 'this' as // No further callbacks should be made at this point, so replace 'this' as
// the listener with mock_listener_, which is a strict mock, so will // the listener with mock_listener_, which is a strict mock, so will
// generate an error for any calls. // generate an error for any calls.
......
...@@ -53,10 +53,10 @@ inline bool IsSupportedHttp2FrameType(Http2FrameType v) { ...@@ -53,10 +53,10 @@ inline bool IsSupportedHttp2FrameType(Http2FrameType v) {
return IsSupportedHttp2FrameType(static_cast<uint32_t>(v)); return IsSupportedHttp2FrameType(static_cast<uint32_t>(v));
} }
// The return type is 'string' so that they can generate a unique string for // The return type is 'Http2String' so that they can generate a unique string
// each unsupported value. Since these are just used for debugging/error // for each unsupported value. Since these are just used for debugging/error
// messages, that isn't a cost to we need to worry about. // messages, that isn't a cost to we need to worry about. The same applies to
// The same applies to the functions later in this file. // the functions later in this file.
HTTP2_EXPORT_PRIVATE Http2String Http2FrameTypeToString(Http2FrameType v); HTTP2_EXPORT_PRIVATE Http2String Http2FrameTypeToString(Http2FrameType v);
HTTP2_EXPORT_PRIVATE Http2String Http2FrameTypeToString(uint8_t v); HTTP2_EXPORT_PRIVATE Http2String Http2FrameTypeToString(uint8_t v);
HTTP2_EXPORT_PRIVATE inline std::ostream& operator<<(std::ostream& out, HTTP2_EXPORT_PRIVATE inline std::ostream& operator<<(std::ostream& out,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment