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

Unified Diff: net/spdy/spdy_session.cc

Issue 965773002: Optimize chained string concatenation in SPDY code. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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
Index: net/spdy/spdy_session.cc
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index a6478dff29bf0421620e089515f6616cebfa3072..047ab2ff01d0617218146367f96d1f48c5dba415 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -64,9 +64,8 @@ scoped_ptr<base::ListValue> SpdyHeaderBlockToListValue(
scoped_ptr<base::ListValue> headers_list(new base::ListValue());
for (SpdyHeaderBlock::const_iterator it = headers.begin();
it != headers.end(); ++it) {
- headers_list->AppendString(
- it->first + ": " +
- ElideHeaderValueForNetLog(log_level, it->first, it->second));
+ headers_list->AppendString(std::string(it->first).append(": ").append(
+ ElideHeaderValueForNetLog(log_level, it->first, it->second)));
}
return headers_list.Pass();
}
@@ -2535,8 +2534,9 @@ void SpdySession::OnWindowUpdate(SpdyStreamId stream_id,
RecordProtocolErrorHistogram(PROTOCOL_ERROR_INVALID_WINDOW_UPDATE_SIZE);
DoDrainSession(
ERR_SPDY_PROTOCOL_ERROR,
- "Received WINDOW_UPDATE with an invalid delta_window_size " +
- base::UintToString(delta_window_size));
+ std::string(
+ "Received WINDOW_UPDATE with an invalid delta_window_size ")
+ .append(base::UintToString(delta_window_size)));
mmenke 2015/03/09 20:21:58 This could just be: base::StringPrintf("Received.
return;
}
@@ -3147,10 +3147,12 @@ void SpdySession::IncreaseSendWindowSize(int32 delta_window_size) {
RecordProtocolErrorHistogram(PROTOCOL_ERROR_INVALID_WINDOW_UPDATE_SIZE);
DoDrainSession(
ERR_SPDY_PROTOCOL_ERROR,
- "Received WINDOW_UPDATE [delta: " +
- base::IntToString(delta_window_size) +
- "] for session overflows session_send_window_size_ [current: " +
- base::IntToString(session_send_window_size_) + "]");
+ std::string("Received WINDOW_UPDATE [delta: ")
+ .append(base::IntToString(delta_window_size))
+ .append(
+ "] for session overflows session_send_window_size_ [current: ")
+ .append(base::IntToString(session_send_window_size_))
+ .append("]"));
return;
}
@@ -3232,11 +3234,13 @@ void SpdySession::DecreaseRecvWindowSize(int32 delta_window_size) {
// negative. If we do, the receive window isn't being respected.
if (delta_window_size > session_recv_window_size_) {
RecordProtocolErrorHistogram(PROTOCOL_ERROR_RECEIVE_WINDOW_VIOLATION);
- DoDrainSession(
- ERR_SPDY_FLOW_CONTROL_ERROR,
- "delta_window_size is " + base::IntToString(delta_window_size) +
- " in DecreaseRecvWindowSize, which is larger than the receive " +
- "window size of " + base::IntToString(session_recv_window_size_));
+ DoDrainSession(ERR_SPDY_FLOW_CONTROL_ERROR,
+ std::string("delta_window_size is ")
+ .append(base::IntToString(delta_window_size))
+ .append(
+ " in DecreaseRecvWindowSize, which is larger than "
+ "the receive window size of ")
+ .append(base::IntToString(session_recv_window_size_)));
return;
}

Powered by Google App Engine
This is Rietveld 408576698