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

Side by Side Diff: net/quic/quic_spdy_stream.cc

Issue 1470713003: Landing Recent QUIC changes until and including Mon Nov 16 14:15:48 2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding NET_EXPORT_PRIVATE to DelegateInterface. Created 5 years 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
OLDNEW
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_spdy_stream.h" 5 #include "net/quic/quic_spdy_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/quic/quic_spdy_session.h" 8 #include "net/quic/quic_spdy_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 using net::SpdyPriority;
14 15
15 namespace net { 16 namespace net {
16 17
17 #define ENDPOINT \ 18 #define ENDPOINT \
18 (session()->perspective() == Perspective::IS_SERVER ? "Server: " : "Client:" \ 19 (session()->perspective() == Perspective::IS_SERVER ? "Server: " : "Client:" \
19 " ") 20 " ")
20 21
21 namespace { 22 namespace {
22 23
23 // This is somewhat arbitrary. It's possible, but unlikely, we will either fail 24 // This is somewhat arbitrary. It's possible, but unlikely, we will either fail
24 // to set a priority client-side, or cancel a stream before stripping the 25 // to set a priority client-side, or cancel a stream before stripping the
25 // priority from the wire server-side. In either case, start out with a 26 // priority from the wire server-side. In either case, start out with a
26 // priority in the middle. 27 // priority in the middle.
27 QuicPriority kDefaultPriority = 3; 28 SpdyPriority kDefaultPriority = 3;
28 29
29 } // namespace 30 } // namespace
30 31
31 QuicSpdyStream::QuicSpdyStream(QuicStreamId id, QuicSpdySession* spdy_session) 32 QuicSpdyStream::QuicSpdyStream(QuicStreamId id, QuicSpdySession* spdy_session)
32 : ReliableQuicStream(id, spdy_session), 33 : ReliableQuicStream(id, spdy_session),
33 spdy_session_(spdy_session), 34 spdy_session_(spdy_session),
34 visitor_(nullptr), 35 visitor_(nullptr),
35 headers_decompressed_(false), 36 headers_decompressed_(false),
36 priority_(kDefaultPriority) { 37 priority_(kDefaultPriority) {
37 DCHECK_NE(kCryptoStreamId, id); 38 DCHECK_NE(kCryptoStreamId, id);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return !decompressed_headers_.empty() || sequencer()->HasBytesToRead(); 106 return !decompressed_headers_.empty() || sequencer()->HasBytesToRead();
106 } 107 }
107 108
108 void QuicSpdyStream::MarkHeadersConsumed(size_t bytes_consumed) { 109 void QuicSpdyStream::MarkHeadersConsumed(size_t bytes_consumed) {
109 decompressed_headers_.erase(0, bytes_consumed); 110 decompressed_headers_.erase(0, bytes_consumed);
110 if (FinishedReadingHeaders()) { 111 if (FinishedReadingHeaders()) {
111 sequencer()->SetUnblocked(); 112 sequencer()->SetUnblocked();
112 } 113 }
113 } 114 }
114 115
115 void QuicSpdyStream::set_priority(QuicPriority priority) { 116 void QuicSpdyStream::set_priority(SpdyPriority priority) {
116 DCHECK_EQ(0u, stream_bytes_written()); 117 DCHECK_EQ(0u, stream_bytes_written());
117 priority_ = priority; 118 priority_ = priority;
118 } 119 }
119 120
120 QuicPriority QuicSpdyStream::EffectivePriority() const { 121 SpdyPriority QuicSpdyStream::Priority() const {
121 return priority(); 122 return priority();
122 } 123 }
123 124
124 void QuicSpdyStream::OnStreamHeaders(StringPiece headers_data) { 125 void QuicSpdyStream::OnStreamHeaders(StringPiece headers_data) {
125 headers_data.AppendToString(&decompressed_headers_); 126 headers_data.AppendToString(&decompressed_headers_);
126 } 127 }
127 128
128 void QuicSpdyStream::OnStreamHeadersPriority(QuicPriority priority) { 129 void QuicSpdyStream::OnStreamHeadersPriority(SpdyPriority priority) {
129 DCHECK_EQ(Perspective::IS_SERVER, session()->connection()->perspective()); 130 DCHECK_EQ(Perspective::IS_SERVER, session()->connection()->perspective());
130 set_priority(priority); 131 set_priority(priority);
131 } 132 }
132 133
133 void QuicSpdyStream::OnStreamHeadersComplete(bool fin, size_t frame_len) { 134 void QuicSpdyStream::OnStreamHeadersComplete(bool fin, size_t frame_len) {
134 headers_decompressed_ = true; 135 headers_decompressed_ = true;
135 if (fin) { 136 if (fin) {
136 OnStreamFrame(QuicStreamFrame(id(), fin, 0, StringPiece())); 137 OnStreamFrame(QuicStreamFrame(id(), fin, 0, StringPiece()));
137 } 138 }
138 if (FinishedReadingHeaders()) { 139 if (FinishedReadingHeaders()) {
(...skipping 24 matching lines...) Expand all
163 visitor_ = nullptr; 164 visitor_ = nullptr;
164 visitor->OnClose(this); 165 visitor->OnClose(this);
165 } 166 }
166 } 167 }
167 168
168 bool QuicSpdyStream::FinishedReadingHeaders() const { 169 bool QuicSpdyStream::FinishedReadingHeaders() const {
169 return headers_decompressed_ && decompressed_headers_.empty(); 170 return headers_decompressed_ && decompressed_headers_.empty();
170 } 171 }
171 172
172 } // namespace net 173 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698