OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |