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

Side by Side Diff: net/quic/reliable_quic_stream.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/reliable_quic_stream.h ('k') | net/quic/reliable_quic_stream_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 (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/quic/reliable_quic_stream.h" 5 #include "net/quic/reliable_quic_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/profiler/scoped_tracker.h" 8 #include "base/profiler/scoped_tracker.h"
9 #include "net/quic/iovector.h" 9 #include "net/quic/iovector.h"
10 #include "net/quic/quic_flow_controller.h" 10 #include "net/quic/quic_flow_controller.h"
11 #include "net/quic/quic_session.h" 11 #include "net/quic/quic_session.h"
12 #include "net/quic/quic_write_blocked_list.h" 12 #include "net/quic/quic_write_blocked_list.h"
13 13
14 using base::StringPiece; 14 using base::StringPiece;
15 using std::min; 15 using std::min;
16 using std::string; 16 using std::string;
17 17
18 namespace net { 18 namespace net {
19 19
20 #define ENDPOINT (is_server_ ? "Server: " : " Client: ") 20 #define ENDPOINT \
21 (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ")
21 22
22 namespace { 23 namespace {
23 24
24 struct iovec MakeIovec(StringPiece data) { 25 struct iovec MakeIovec(StringPiece data) {
25 struct iovec iov = {const_cast<char*>(data.data()), 26 struct iovec iov = {const_cast<char*>(data.data()),
26 static_cast<size_t>(data.size())}; 27 static_cast<size_t>(data.size())};
27 return iov; 28 return iov;
28 } 29 }
29 30
30 size_t GetInitialStreamFlowControlWindowToSend(QuicSession* session) { 31 size_t GetInitialStreamFlowControlWindowToSend(QuicSession* session) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 stream_error_(QUIC_STREAM_NO_ERROR), 120 stream_error_(QUIC_STREAM_NO_ERROR),
120 connection_error_(QUIC_NO_ERROR), 121 connection_error_(QUIC_NO_ERROR),
121 read_side_closed_(false), 122 read_side_closed_(false),
122 write_side_closed_(false), 123 write_side_closed_(false),
123 fin_buffered_(false), 124 fin_buffered_(false),
124 fin_sent_(false), 125 fin_sent_(false),
125 fin_received_(false), 126 fin_received_(false),
126 rst_sent_(false), 127 rst_sent_(false),
127 rst_received_(false), 128 rst_received_(false),
128 fec_policy_(FEC_PROTECT_OPTIONAL), 129 fec_policy_(FEC_PROTECT_OPTIONAL),
129 is_server_(session_->is_server()), 130 perspective_(session_->perspective()),
130 flow_controller_( 131 flow_controller_(session_->connection(),
131 session_->connection(), id_, is_server_, 132 id_,
132 GetReceivedFlowControlWindow(session), 133 perspective_,
133 GetInitialStreamFlowControlWindowToSend(session), 134 GetReceivedFlowControlWindow(session),
134 GetInitialStreamFlowControlWindowToSend(session)), 135 GetInitialStreamFlowControlWindowToSend(session),
136 GetInitialStreamFlowControlWindowToSend(session)),
135 connection_flow_controller_(session_->flow_controller()), 137 connection_flow_controller_(session_->flow_controller()),
136 stream_contributes_to_connection_flow_control_(true) { 138 stream_contributes_to_connection_flow_control_(true) {
137 } 139 }
138 140
139 ReliableQuicStream::~ReliableQuicStream() { 141 ReliableQuicStream::~ReliableQuicStream() {
140 } 142 }
141 143
142 void ReliableQuicStream::OnStreamFrame(const QuicStreamFrame& frame) { 144 void ReliableQuicStream::OnStreamFrame(const QuicStreamFrame& frame) {
143 if (read_side_closed_) { 145 if (read_side_closed_) {
144 DVLOG(1) << ENDPOINT << "Ignoring frame " << frame.stream_id; 146 DVLOG(1) << ENDPOINT << "Ignoring frame " << frame.stream_id;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 498 }
497 } 499 }
498 500
499 void ReliableQuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { 501 void ReliableQuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) {
500 if (flow_controller_.UpdateSendWindowOffset(new_window)) { 502 if (flow_controller_.UpdateSendWindowOffset(new_window)) {
501 OnCanWrite(); 503 OnCanWrite();
502 } 504 }
503 } 505 }
504 506
505 } // namespace net 507 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/reliable_quic_stream.h ('k') | net/quic/reliable_quic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698