OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_data_stream.h" | 5 #include "net/quic/quic_data_stream.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/quic/quic_session.h" | 8 #include "net/quic/quic_session.h" |
9 #include "net/quic/quic_utils.h" | 9 #include "net/quic/quic_utils.h" |
10 #include "net/quic/quic_write_blocked_list.h" | 10 #include "net/quic/quic_write_blocked_list.h" |
11 | 11 |
12 using base::StringPiece; | 12 using base::StringPiece; |
13 using std::min; | 13 using std::min; |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 #define ENDPOINT (session()->is_server() ? "Server: " : " Client: ") | 17 #define ENDPOINT (session()->is_server() ? "Server: " : " Client: ") |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // This is somewhat arbitrary. It's possible, but unlikely, we will either fail | 21 // This is somewhat arbitrary. It's possible, but unlikely, we will either fail |
22 // to set a priority client-side, or cancel a stream before stripping the | 22 // to set a priority client-side, or cancel a stream before stripping the |
23 // priority from the wire server-side. In either case, start out with a | 23 // priority from the wire server-side. In either case, start out with a |
24 // priority in the middle. | 24 // priority in the middle. |
25 QuicPriority kDefaultPriority = 3; | 25 QuicPriority kDefaultPriority = 3; |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 QuicDataStream::QuicDataStream(QuicStreamId id, | 29 QuicDataStream::QuicDataStream(QuicStreamId id, QuicSession* session) |
30 QuicSession* session) | |
31 : ReliableQuicStream(id, session), | 30 : ReliableQuicStream(id, session), |
32 visitor_(nullptr), | 31 visitor_(nullptr), |
33 headers_decompressed_(false), | 32 headers_decompressed_(false), |
34 priority_(kDefaultPriority), | 33 priority_(kDefaultPriority) { |
35 decompression_failed_(false), | |
36 priority_parsed_(false) { | |
37 DCHECK_NE(kCryptoStreamId, id); | 34 DCHECK_NE(kCryptoStreamId, id); |
38 // Don't receive any callbacks from the sequencer until headers | 35 // Don't receive any callbacks from the sequencer until headers |
39 // are complete. | 36 // are complete. |
40 sequencer()->SetBlockedUntilFlush(); | 37 sequencer()->SetBlockedUntilFlush(); |
41 } | 38 } |
42 | 39 |
43 QuicDataStream::~QuicDataStream() { | 40 QuicDataStream::~QuicDataStream() { |
44 } | 41 } |
45 | 42 |
46 size_t QuicDataStream::WriteHeaders( | 43 size_t QuicDataStream::WriteHeaders( |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 visitor_ = nullptr; | 175 visitor_ = nullptr; |
179 visitor->OnClose(this); | 176 visitor->OnClose(this); |
180 } | 177 } |
181 } | 178 } |
182 | 179 |
183 bool QuicDataStream::FinishedReadingHeaders() { | 180 bool QuicDataStream::FinishedReadingHeaders() { |
184 return headers_decompressed_ && decompressed_headers_.empty(); | 181 return headers_decompressed_ && decompressed_headers_.empty(); |
185 } | 182 } |
186 | 183 |
187 } // namespace net | 184 } // namespace net |
OLD | NEW |