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

Side by Side Diff: net/spdy/spdy_stream.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, 9 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 unified diff | Download patch
« net/spdy/spdy_session.cc ('K') | « net/spdy/spdy_session.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_stream.h" 5 #include "net/spdy/spdy_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 void SpdyStream::DecreaseRecvWindowSize(int32 delta_window_size) { 343 void SpdyStream::DecreaseRecvWindowSize(int32 delta_window_size) {
344 DCHECK(session_->IsStreamActive(stream_id_)); 344 DCHECK(session_->IsStreamActive(stream_id_));
345 DCHECK_GE(session_->flow_control_state(), SpdySession::FLOW_CONTROL_STREAM); 345 DCHECK_GE(session_->flow_control_state(), SpdySession::FLOW_CONTROL_STREAM);
346 DCHECK_GE(delta_window_size, 1); 346 DCHECK_GE(delta_window_size, 1);
347 347
348 // Since we never decrease the initial receive window size, 348 // Since we never decrease the initial receive window size,
349 // |delta_window_size| should never cause |recv_window_size_| to go 349 // |delta_window_size| should never cause |recv_window_size_| to go
350 // negative. If we do, the receive window isn't being respected. 350 // negative. If we do, the receive window isn't being respected.
351 if (delta_window_size > recv_window_size_) { 351 if (delta_window_size > recv_window_size_) {
352 session_->ResetStream( 352 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR,
353 stream_id_, RST_STREAM_PROTOCOL_ERROR, 353 std::string("delta_window_size is ")
354 "delta_window_size is " + base::IntToString(delta_window_size) + 354 .append(base::IntToString(delta_window_size))
355 " in DecreaseRecvWindowSize, which is larger than the receive " + 355 .append(
356 "window size of " + base::IntToString(recv_window_size_)); 356 " in DecreaseRecvWindowSize, which is "
357 "larger than the receive window size of ")
358 .append(base::IntToString(recv_window_size_)));
mmenke 2015/03/09 20:21:58 Worth considering std::StringPrintf here, too?
357 return; 359 return;
358 } 360 }
359 361
360 recv_window_size_ -= delta_window_size; 362 recv_window_size_ -= delta_window_size;
361 net_log_.AddEvent( 363 net_log_.AddEvent(
362 NetLog::TYPE_SPDY_STREAM_UPDATE_RECV_WINDOW, 364 NetLog::TYPE_SPDY_STREAM_UPDATE_RECV_WINDOW,
363 base::Bind(&NetLogSpdyStreamWindowUpdateCallback, 365 base::Bind(&NetLogSpdyStreamWindowUpdateCallback,
364 stream_id_, -delta_window_size, recv_window_size_)); 366 stream_id_, -delta_window_size, recv_window_size_));
365 } 367 }
366 368
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 915 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
914 state); 916 state);
915 break; 917 break;
916 } 918 }
917 return description; 919 return description;
918 } 920 }
919 921
920 #undef STATE_CASE 922 #undef STATE_CASE
921 923
922 } // namespace net 924 } // namespace net
OLDNEW
« net/spdy/spdy_session.cc ('K') | « net/spdy/spdy_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698