| 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 \ |
| 18 (session()->perspective() == Perspective::IS_SERVER ? "Server: " : "Client:" \ |
| 19 " ") |
| 18 | 20 |
| 19 namespace { | 21 namespace { |
| 20 | 22 |
| 21 // This is somewhat arbitrary. It's possible, but unlikely, we will either fail | 23 // 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 | 24 // 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 | 25 // priority from the wire server-side. In either case, start out with a |
| 24 // priority in the middle. | 26 // priority in the middle. |
| 25 QuicPriority kDefaultPriority = 3; | 27 QuicPriority kDefaultPriority = 3; |
| 26 | 28 |
| 27 } // namespace | 29 } // namespace |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 145 } |
| 144 return bytes_processed; | 146 return bytes_processed; |
| 145 } | 147 } |
| 146 | 148 |
| 147 void QuicDataStream::OnStreamHeaders(StringPiece headers_data) { | 149 void QuicDataStream::OnStreamHeaders(StringPiece headers_data) { |
| 148 headers_data.AppendToString(&decompressed_headers_); | 150 headers_data.AppendToString(&decompressed_headers_); |
| 149 ProcessHeaderData(); | 151 ProcessHeaderData(); |
| 150 } | 152 } |
| 151 | 153 |
| 152 void QuicDataStream::OnStreamHeadersPriority(QuicPriority priority) { | 154 void QuicDataStream::OnStreamHeadersPriority(QuicPriority priority) { |
| 153 DCHECK(session()->connection()->is_server()); | 155 DCHECK_EQ(Perspective::IS_SERVER, session()->connection()->perspective()); |
| 154 set_priority(priority); | 156 set_priority(priority); |
| 155 } | 157 } |
| 156 | 158 |
| 157 void QuicDataStream::OnStreamHeadersComplete(bool fin, size_t frame_len) { | 159 void QuicDataStream::OnStreamHeadersComplete(bool fin, size_t frame_len) { |
| 158 headers_decompressed_ = true; | 160 headers_decompressed_ = true; |
| 159 if (fin) { | 161 if (fin) { |
| 160 sequencer()->OnStreamFrame(QuicStreamFrame(id(), fin, 0, IOVector())); | 162 sequencer()->OnStreamFrame(QuicStreamFrame(id(), fin, 0, IOVector())); |
| 161 } | 163 } |
| 162 ProcessHeaderData(); | 164 ProcessHeaderData(); |
| 163 if (FinishedReadingHeaders()) { | 165 if (FinishedReadingHeaders()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 175 visitor_ = nullptr; | 177 visitor_ = nullptr; |
| 176 visitor->OnClose(this); | 178 visitor->OnClose(this); |
| 177 } | 179 } |
| 178 } | 180 } |
| 179 | 181 |
| 180 bool QuicDataStream::FinishedReadingHeaders() { | 182 bool QuicDataStream::FinishedReadingHeaders() { |
| 181 return headers_decompressed_ && decompressed_headers_.empty(); | 183 return headers_decompressed_ && decompressed_headers_.empty(); |
| 182 } | 184 } |
| 183 | 185 |
| 184 } // namespace net | 186 } // namespace net |
| OLD | NEW |