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

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

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_dispatcher.cc ('k') | net/quic/quic_flow_controller.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 #ifndef NET_QUIC_QUIC_FLOW_CONTROLLER_H_ 5 #ifndef NET_QUIC_QUIC_FLOW_CONTROLLER_H_
6 #define NET_QUIC_QUIC_FLOW_CONTROLLER_H_ 6 #define NET_QUIC_QUIC_FLOW_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "net/base/net_export.h" 9 #include "net/base/net_export.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 namespace test { 14 namespace test {
15 class QuicFlowControllerPeer; 15 class QuicFlowControllerPeer;
16 } // namespace test 16 } // namespace test
17 17
18 class QuicConnection; 18 class QuicConnection;
19 19
20 const QuicStreamId kConnectionLevelId = 0; 20 const QuicStreamId kConnectionLevelId = 0;
21 21
22 // QuicFlowController allows a QUIC stream or connection to perform flow 22 // QuicFlowController allows a QUIC stream or connection to perform flow
23 // control. The stream/connection owns a QuicFlowController which keeps track of 23 // control. The stream/connection owns a QuicFlowController which keeps track of
24 // bytes sent/received, can tell the owner if it is flow control blocked, and 24 // bytes sent/received, can tell the owner if it is flow control blocked, and
25 // can send WINDOW_UPDATE or BLOCKED frames when needed. 25 // can send WINDOW_UPDATE or BLOCKED frames when needed.
26 class NET_EXPORT_PRIVATE QuicFlowController { 26 class NET_EXPORT_PRIVATE QuicFlowController {
27 public: 27 public:
28 QuicFlowController(QuicConnection* connection, 28 QuicFlowController(QuicConnection* connection,
29 QuicStreamId id, 29 QuicStreamId id,
30 bool is_server, 30 Perspective perspective,
31 QuicStreamOffset send_window_offset, 31 QuicStreamOffset send_window_offset,
32 QuicStreamOffset receive_window_offset, 32 QuicStreamOffset receive_window_offset,
33 QuicByteCount max_receive_window); 33 QuicByteCount max_receive_window);
34 ~QuicFlowController() {} 34 ~QuicFlowController() {}
35 35
36 // Called when we see a new highest received byte offset from the peer, either 36 // Called when we see a new highest received byte offset from the peer, either
37 // via a data frame or a RST. 37 // via a data frame or a RST.
38 // Returns true if this call changes highest_received_byte_offset_, and false 38 // Returns true if this call changes highest_received_byte_offset_, and false
39 // in the case where |new_offset| is <= highest_received_byte_offset_. 39 // in the case where |new_offset| is <= highest_received_byte_offset_.
40 bool UpdateHighestReceivedOffset(QuicStreamOffset new_offset); 40 bool UpdateHighestReceivedOffset(QuicStreamOffset new_offset);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 // The parent connection, used to send connection close on flow control 77 // The parent connection, used to send connection close on flow control
78 // violation, and WINDOW_UPDATE and BLOCKED frames when appropriate. 78 // violation, and WINDOW_UPDATE and BLOCKED frames when appropriate.
79 // Not owned. 79 // Not owned.
80 QuicConnection* connection_; 80 QuicConnection* connection_;
81 81
82 // ID of stream this flow controller belongs to. This can be 0 if this is a 82 // ID of stream this flow controller belongs to. This can be 0 if this is a
83 // connection level flow controller. 83 // connection level flow controller.
84 QuicStreamId id_; 84 QuicStreamId id_;
85 85
86 // True if this is owned by a server. 86 // Tracks if this is owned by a server or a client.
87 bool is_server_; 87 Perspective perspective_;
88 88
89 // Track number of bytes received from the peer, which have been consumed 89 // Track number of bytes received from the peer, which have been consumed
90 // locally. 90 // locally.
91 QuicByteCount bytes_consumed_; 91 QuicByteCount bytes_consumed_;
92 92
93 // The highest byte offset we have seen from the peer. This could be the 93 // The highest byte offset we have seen from the peer. This could be the
94 // highest offset in a data frame, or a final value in a RST. 94 // highest offset in a data frame, or a final value in a RST.
95 QuicStreamOffset highest_received_byte_offset_; 95 QuicStreamOffset highest_received_byte_offset_;
96 96
97 // Tracks number of bytes sent to the peer. 97 // Tracks number of bytes sent to the peer.
(...skipping 13 matching lines...) Expand all
111 // Keep track of the last time we sent a BLOCKED frame. We should only send 111 // Keep track of the last time we sent a BLOCKED frame. We should only send
112 // another when the number of bytes we have sent has changed. 112 // another when the number of bytes we have sent has changed.
113 QuicStreamOffset last_blocked_send_window_offset_; 113 QuicStreamOffset last_blocked_send_window_offset_;
114 114
115 DISALLOW_COPY_AND_ASSIGN(QuicFlowController); 115 DISALLOW_COPY_AND_ASSIGN(QuicFlowController);
116 }; 116 };
117 117
118 } // namespace net 118 } // namespace net
119 119
120 #endif // NET_QUIC_QUIC_FLOW_CONTROLLER_H_ 120 #endif // NET_QUIC_QUIC_FLOW_CONTROLLER_H_
OLDNEW
« no previous file with comments | « net/quic/quic_dispatcher.cc ('k') | net/quic/quic_flow_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698