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

Unified Diff: net/quic/reliable_quic_stream.cc

Issue 394053003: QUIC - minor cleanup changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/quic/reliable_quic_stream.cc
diff --git a/net/quic/reliable_quic_stream.cc b/net/quic/reliable_quic_stream.cc
index f01c7d30cebf38674ce9bf8780d564bbe070c9bc..7785e72690ee26c065e1f4313dcdfe53e9cc5076 100644
--- a/net/quic/reliable_quic_stream.cc
+++ b/net/quic/reliable_quic_stream.cc
@@ -333,14 +333,14 @@ void ReliableQuicStream::OnCanWrite() {
void ReliableQuicStream::MaybeSendBlocked() {
flow_controller_.MaybeSendBlocked();
- if (stream_contributes_to_connection_flow_control_) {
- connection_flow_controller_->MaybeSendBlocked();
+ if (!stream_contributes_to_connection_flow_control_) {
+ return;
}
+ connection_flow_controller_->MaybeSendBlocked();
// If we are connection level flow control blocked, then add the stream
// to the write blocked list. It will be given a chance to write when a
// connection level WINDOW_UPDATE arrives.
- if (stream_contributes_to_connection_flow_control_ &&
- connection_flow_controller_->IsBlocked() &&
+ if (connection_flow_controller_->IsBlocked() &&
!flow_controller_.IsBlocked()) {
session_->MarkWriteBlocked(id(), EffectivePriority());
}
@@ -490,22 +490,24 @@ void ReliableQuicStream::OnWindowUpdateFrame(
}
bool ReliableQuicStream::MaybeIncreaseHighestReceivedOffset(uint64 new_offset) {
- if (flow_controller_.IsEnabled()) {
- uint64 increment =
- new_offset - flow_controller_.highest_received_byte_offset();
- if (flow_controller_.UpdateHighestReceivedOffset(new_offset)) {
- // If |new_offset| increased the stream flow controller's highest received
- // offset, then we need to increase the connection flow controller's value
- // by the incremental difference.
- if (stream_contributes_to_connection_flow_control_) {
- connection_flow_controller_->UpdateHighestReceivedOffset(
- connection_flow_controller_->highest_received_byte_offset() +
- increment);
- }
- return true;
- }
+ if (!flow_controller_.IsEnabled()) {
+ return false;
}
- return false;
+ uint64 increment =
+ new_offset - flow_controller_.highest_received_byte_offset();
+ if (!flow_controller_.UpdateHighestReceivedOffset(new_offset)) {
+ return false;
+ }
+
+ // If |new_offset| increased the stream flow controller's highest received
+ // offset, then we need to increase the connection flow controller's value
+ // by the incremental difference.
+ if (stream_contributes_to_connection_flow_control_) {
+ connection_flow_controller_->UpdateHighestReceivedOffset(
+ connection_flow_controller_->highest_received_byte_offset() +
+ increment);
+ }
+ return true;
}
void ReliableQuicStream::AddBytesSent(uint64 bytes) {
@@ -531,11 +533,11 @@ void ReliableQuicStream::AddBytesConsumed(uint64 bytes) {
}
bool ReliableQuicStream::IsFlowControlBlocked() {
- bool stream_flow_control_blocked = flow_controller_.IsBlocked();
- bool connecton_flow_control_blocked =
- stream_contributes_to_connection_flow_control_ &&
+ if (flow_controller_.IsBlocked()) {
+ return true;
+ }
+ return stream_contributes_to_connection_flow_control_ &&
connection_flow_controller_->IsBlocked();
- return stream_flow_control_blocked || connecton_flow_control_blocked;
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698