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

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

Issue 1961573002: Avoids the "re-encode HPACK as SPDY3" step. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update new test Created 4 years, 6 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/quic_spdy_stream.h ('k') | net/quic/quic_spdy_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 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 "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "net/quic/quic_bug_tracker.h" 9 #include "net/quic/quic_bug_tracker.h"
10 #include "net/quic/quic_spdy_session.h" 10 #include "net/quic/quic_spdy_session.h"
(...skipping 12 matching lines...) Expand all
23 (session()->perspective() == Perspective::IS_SERVER ? "Server: " : "Client:" \ 23 (session()->perspective() == Perspective::IS_SERVER ? "Server: " : "Client:" \
24 " ") 24 " ")
25 25
26 QuicSpdyStream::QuicSpdyStream(QuicStreamId id, QuicSpdySession* spdy_session) 26 QuicSpdyStream::QuicSpdyStream(QuicStreamId id, QuicSpdySession* spdy_session)
27 : ReliableQuicStream(id, spdy_session), 27 : ReliableQuicStream(id, spdy_session),
28 spdy_session_(spdy_session), 28 spdy_session_(spdy_session),
29 visitor_(nullptr), 29 visitor_(nullptr),
30 headers_decompressed_(false), 30 headers_decompressed_(false),
31 priority_(kDefaultPriority), 31 priority_(kDefaultPriority),
32 trailers_decompressed_(false), 32 trailers_decompressed_(false),
33 trailers_delivered_(false),
33 avoid_empty_nonfin_writes_(FLAGS_quic_avoid_empty_nonfin_writes) { 34 avoid_empty_nonfin_writes_(FLAGS_quic_avoid_empty_nonfin_writes) {
34 DCHECK_NE(kCryptoStreamId, id); 35 DCHECK_NE(kCryptoStreamId, id);
35 // Don't receive any callbacks from the sequencer until headers 36 // Don't receive any callbacks from the sequencer until headers
36 // are complete. 37 // are complete.
37 sequencer()->SetBlockedUntilFlush(); 38 sequencer()->SetBlockedUntilFlush();
38 spdy_session_->RegisterStreamPriority(id, priority_); 39 spdy_session_->RegisterStreamPriority(id, priority_);
39 } 40 }
40 41
41 QuicSpdyStream::~QuicSpdyStream() { 42 QuicSpdyStream::~QuicSpdyStream() {
42 if (spdy_session_ != nullptr) { 43 if (spdy_session_ != nullptr) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 decompressed_headers_.erase(0, bytes_consumed); 155 decompressed_headers_.erase(0, bytes_consumed);
155 if (FinishedReadingHeaders()) { 156 if (FinishedReadingHeaders()) {
156 sequencer()->SetUnblocked(); 157 sequencer()->SetUnblocked();
157 } 158 }
158 } 159 }
159 160
160 void QuicSpdyStream::MarkTrailersConsumed(size_t bytes_consumed) { 161 void QuicSpdyStream::MarkTrailersConsumed(size_t bytes_consumed) {
161 decompressed_trailers_.erase(0, bytes_consumed); 162 decompressed_trailers_.erase(0, bytes_consumed);
162 } 163 }
163 164
165 void QuicSpdyStream::MarkTrailersDelivered() {
166 trailers_delivered_ = true;
167 }
168
164 void QuicSpdyStream::ConsumeHeaderList() { 169 void QuicSpdyStream::ConsumeHeaderList() {
165 header_list_.Clear(); 170 header_list_.Clear();
166 if (FinishedReadingHeaders()) { 171 if (FinishedReadingHeaders()) {
167 sequencer()->SetUnblocked(); 172 sequencer()->SetUnblocked();
168 } 173 }
169 } 174 }
170 175
171 void QuicSpdyStream::SetPriority(SpdyPriority priority) { 176 void QuicSpdyStream::SetPriority(SpdyPriority priority) {
172 DCHECK_EQ(0u, stream_bytes_written()); 177 DCHECK_EQ(0u, stream_bytes_written());
173 spdy_session_->UpdateStreamPriority(id(), priority); 178 spdy_session_->UpdateStreamPriority(id(), priority);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 // The remaining two characters must be integers. 375 // The remaining two characters must be integers.
371 if (!isdigit(status[1]) || !isdigit(status[2])) { 376 if (!isdigit(status[1]) || !isdigit(status[2])) {
372 return false; 377 return false;
373 } 378 }
374 return StringToInt(status, status_code); 379 return StringToInt(status, status_code);
375 } 380 }
376 381
377 bool QuicSpdyStream::FinishedReadingTrailers() const { 382 bool QuicSpdyStream::FinishedReadingTrailers() const {
378 // If no further trailing headers are expected, and the decompressed trailers 383 // If no further trailing headers are expected, and the decompressed trailers
379 // (if any) have been consumed, then reading of trailers is finished. 384 // (if any) have been consumed, then reading of trailers is finished.
380 bool no_more_trailers = fin_received() || trailers_decompressed_; 385 if (!fin_received()) {
381 return no_more_trailers && decompressed_trailers_.empty(); 386 return false;
387 } else if (!trailers_decompressed_) {
388 return true;
389 } else {
390 return trailers_delivered_ && decompressed_trailers_.empty();
391 }
382 } 392 }
383 393
384 SpdyPriority QuicSpdyStream::priority() const { 394 SpdyPriority QuicSpdyStream::priority() const {
385 return priority_; 395 return priority_;
386 } 396 }
387 397
388 void QuicSpdyStream::ClearSession() { 398 void QuicSpdyStream::ClearSession() {
389 spdy_session_ = nullptr; 399 spdy_session_ = nullptr;
390 } 400 }
391 401
392 } // namespace net 402 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_spdy_stream.h ('k') | net/quic/quic_spdy_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698