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

Unified Diff: net/quic/core/quic_stream_sequencer.cc

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: sync Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_session_test.cc ('k') | net/quic/core/quic_stream_sequencer_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_stream_sequencer.cc
diff --git a/net/quic/core/quic_stream_sequencer.cc b/net/quic/core/quic_stream_sequencer.cc
index 64c6b4c1a6981f150de6b076cf2e5187b9b57e51..a67176717ad2e2b108fa88a6086e7f8493b14f29 100644
--- a/net/quic/core/quic_stream_sequencer.cc
+++ b/net/quic/core/quic_stream_sequencer.cc
@@ -20,6 +20,7 @@
#include "net/quic/core/quic_stream_sequencer_buffer.h"
#include "net/quic/core/quic_utils.h"
#include "net/quic/platform/api/quic_clock.h"
+#include "net/quic/platform/api/quic_str_cat.h"
using base::IntToString;
using base::StringPiece;
@@ -58,10 +59,10 @@ void QuicStreamSequencer::OnStreamFrame(const QuicStreamFrame& frame) {
byte_offset, StringPiece(frame.data_buffer, frame.data_length),
clock_->ApproximateNow(), &bytes_written, &error_details);
if (result != QUIC_NO_ERROR) {
- string details = "Stream" + base::Uint64ToString(stream_->id()) + ": " +
- QuicErrorCodeToString(result) + ": " + error_details +
- "\nPeer Address: " +
- stream_->PeerAddressOfLatestPacket().ToString();
+ string details = QuicStrCat(
+ "Stream ", stream_->id(), ": ", QuicErrorCodeToString(result), ": ",
+ error_details, "\nPeer Address: ",
+ stream_->PeerAddressOfLatestPacket().ToString());
DLOG(WARNING) << QuicErrorCodeToString(result);
DLOG(WARNING) << details;
stream_->CloseConnectionWithDetails(result, details);
@@ -142,8 +143,7 @@ int QuicStreamSequencer::Readv(const struct iovec* iov, size_t iov_len) {
QuicErrorCode read_error =
buffered_frames_.Readv(iov, iov_len, &bytes_read, &error_details);
if (read_error != QUIC_NO_ERROR) {
- string details = StringPrintf("Stream %" PRIu32 ": %s", stream_->id(),
- error_details.c_str());
+ string details = QuicStrCat("Stream ", stream_->id(), ": ", error_details);
stream_->CloseConnectionWithDetails(read_error, details);
return static_cast<int>(bytes_read);
}
@@ -222,13 +222,13 @@ QuicStreamOffset QuicStreamSequencer::NumBytesConsumed() const {
const string QuicStreamSequencer::DebugString() const {
// clang-format off
- return "QuicStreamSequencer:"
- "\n bytes buffered: " + IntToString(NumBytesBuffered()) +
- "\n bytes consumed: " + IntToString( NumBytesConsumed()) +
- "\n has bytes to read: " + (HasBytesToRead() ? "true" : "false") +
- "\n frames received: " + IntToString(num_frames_received()) +
- "\n close offset bytes: " + IntToString( close_offset_) +
- "\n is closed: " + (IsClosed() ? "true" : "false");
+ return QuicStrCat("QuicStreamSequencer:",
+ "\n bytes buffered: ", NumBytesBuffered(),
+ "\n bytes consumed: ", NumBytesConsumed(),
+ "\n has bytes to read: ", HasBytesToRead() ? "true" : "false",
+ "\n frames received: ", num_frames_received(),
+ "\n close offset bytes: ", close_offset_,
+ "\n is closed: ", IsClosed() ? "true" : "false");
// clang-format on
}
« no previous file with comments | « net/quic/core/quic_session_test.cc ('k') | net/quic/core/quic_stream_sequencer_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698