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

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

Issue 2603723002: Add a new QUIC platform API for text utilities. (Closed)
Patch Set: net/tools/quic/quic_packet_printer_bin.cc Created 3 years, 11 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/core/quic_session_test.cc ('k') | net/quic/core/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/core/quic_spdy_stream.h" 5 #include "net/quic/core/quic_spdy_stream.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h"
11 #include "net/base/parse_number.h" 10 #include "net/base/parse_number.h"
12 #include "net/quic/core/quic_bug_tracker.h" 11 #include "net/quic/core/quic_bug_tracker.h"
13 #include "net/quic/core/quic_spdy_session.h" 12 #include "net/quic/core/quic_spdy_session.h"
14 #include "net/quic/core/quic_utils.h" 13 #include "net/quic/core/quic_utils.h"
15 #include "net/quic/core/quic_write_blocked_list.h" 14 #include "net/quic/core/quic_write_blocked_list.h"
16 #include "net/quic/core/spdy_utils.h" 15 #include "net/quic/core/spdy_utils.h"
16 #include "net/quic/platform/api/quic_text_utils.h"
17 17
18 using base::IntToString; 18 using base::IntToString;
19 using base::StringPiece; 19 using base::StringPiece;
20 using std::string; 20 using std::string;
21 21
22 namespace net { 22 namespace net {
23 23
24 #define ENDPOINT \ 24 #define ENDPOINT \
25 (session()->perspective() == Perspective::IS_SERVER ? "Server: " : "Client:" \ 25 (session()->perspective() == Perspective::IS_SERVER ? "Server: " : "Client:" \
26 " ") 26 " ")
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { 84 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) {
85 if (fin_sent()) { 85 if (fin_sent()) {
86 QUIC_BUG << "Trailers cannot be sent after a FIN."; 86 QUIC_BUG << "Trailers cannot be sent after a FIN.";
87 return 0; 87 return 0;
88 } 88 }
89 89
90 // The header block must contain the final offset for this stream, as the 90 // The header block must contain the final offset for this stream, as the
91 // trailers may be processed out of order at the peer. 91 // trailers may be processed out of order at the peer.
92 DVLOG(1) << "Inserting trailer: (" << kFinalOffsetHeaderKey << ", " 92 DVLOG(1) << "Inserting trailer: (" << kFinalOffsetHeaderKey << ", "
93 << stream_bytes_written() + queued_data_bytes() << ")"; 93 << stream_bytes_written() + queued_data_bytes() << ")";
94 trailer_block.insert(std::make_pair( 94 trailer_block.insert(
95 kFinalOffsetHeaderKey, 95 std::make_pair(kFinalOffsetHeaderKey,
96 IntToString(stream_bytes_written() + queued_data_bytes()))); 96 QuicTextUtils::Uint64ToString(stream_bytes_written() +
97 queued_data_bytes())));
97 98
98 // Write the trailing headers with a FIN, and close stream for writing: 99 // Write the trailing headers with a FIN, and close stream for writing:
99 // trailers are the last thing to be sent on a stream. 100 // trailers are the last thing to be sent on a stream.
100 const bool kFin = true; 101 const bool kFin = true;
101 size_t bytes_written = spdy_session_->WriteHeaders( 102 size_t bytes_written = spdy_session_->WriteHeaders(
102 id(), std::move(trailer_block), kFin, priority_, std::move(ack_listener)); 103 id(), std::move(trailer_block), kFin, priority_, std::move(ack_listener));
103 set_fin_sent(kFin); 104 set_fin_sent(kFin);
104 105
105 // Trailers are the last thing to be sent on a stream, but if there is still 106 // Trailers are the last thing to be sent on a stream, but if there is still
106 // queued data then CloseWriteSide() will cause it never to be sent. 107 // queued data then CloseWriteSide() will cause it never to be sent.
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { 335 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) {
335 if (spdy_session_->headers_stream() != nullptr && 336 if (spdy_session_->headers_stream() != nullptr &&
336 spdy_session_->force_hol_blocking()) { 337 spdy_session_->force_hol_blocking()) {
337 return spdy_session_->headers_stream()->WritevStreamData( 338 return spdy_session_->headers_stream()->WritevStreamData(
338 id(), iov, offset, fin, std::move(ack_listener)); 339 id(), iov, offset, fin, std::move(ack_listener));
339 } 340 }
340 return QuicStream::WritevDataInner(iov, offset, fin, std::move(ack_listener)); 341 return QuicStream::WritevDataInner(iov, offset, fin, std::move(ack_listener));
341 } 342 }
342 343
343 } // namespace net 344 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_session_test.cc ('k') | net/quic/core/quic_spdy_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698