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

Side by Side Diff: net/quic/quic_flow_controller.cc

Issue 1009543004: Create a Perspective enum to use instead of a bool is_server to improve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NET_EXPORT_PRIVATE to fix compiler error 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
« no previous file with comments | « net/quic/quic_flow_controller.h ('k') | net/quic/quic_flow_controller_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/quic/quic_flow_controller.h" 5 #include "net/quic/quic_flow_controller.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "net/quic/quic_connection.h" 8 #include "net/quic/quic_connection.h"
9 #include "net/quic/quic_flags.h" 9 #include "net/quic/quic_flags.h"
10 #include "net/quic/quic_protocol.h" 10 #include "net/quic/quic_protocol.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 #define ENDPOINT (is_server_ ? "Server: " : " Client: ") 14 #define ENDPOINT \
15 (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ")
15 16
16 QuicFlowController::QuicFlowController(QuicConnection* connection, 17 QuicFlowController::QuicFlowController(QuicConnection* connection,
17 QuicStreamId id, 18 QuicStreamId id,
18 bool is_server, 19 Perspective perspective,
19 QuicStreamOffset send_window_offset, 20 QuicStreamOffset send_window_offset,
20 QuicStreamOffset receive_window_offset, 21 QuicStreamOffset receive_window_offset,
21 QuicByteCount max_receive_window) 22 QuicByteCount max_receive_window)
22 : connection_(connection), 23 : connection_(connection),
23 id_(id), 24 id_(id),
24 is_server_(is_server), 25 perspective_(perspective),
25 bytes_consumed_(0), 26 bytes_consumed_(0),
26 highest_received_byte_offset_(0), 27 highest_received_byte_offset_(0),
27 bytes_sent_(0), 28 bytes_sent_(0),
28 send_window_offset_(send_window_offset), 29 send_window_offset_(send_window_offset),
29 receive_window_offset_(receive_window_offset), 30 receive_window_offset_(receive_window_offset),
30 max_receive_window_(max_receive_window), 31 max_receive_window_(max_receive_window),
31 last_blocked_send_window_offset_(0) { 32 last_blocked_send_window_offset_(0) {
32 DVLOG(1) << ENDPOINT << "Created flow controller for stream " << id_ 33 DVLOG(1) << ENDPOINT << "Created flow controller for stream " << id_
33 << ", setting initial receive window offset to: " 34 << ", setting initial receive window offset to: "
34 << receive_window_offset_ 35 << receive_window_offset_
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 150 }
150 151
151 uint64 QuicFlowController::SendWindowSize() const { 152 uint64 QuicFlowController::SendWindowSize() const {
152 if (bytes_sent_ > send_window_offset_) { 153 if (bytes_sent_ > send_window_offset_) {
153 return 0; 154 return 0;
154 } 155 }
155 return send_window_offset_ - bytes_sent_; 156 return send_window_offset_ - bytes_sent_;
156 } 157 }
157 158
158 } // namespace net 159 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_flow_controller.h ('k') | net/quic/quic_flow_controller_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698