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

Unified Diff: net/tools/quic/quic_spdy_client_stream.cc

Issue 111073003: Cleanup of QUIC stream classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_spdy_client_stream.h ('k') | net/tools/quic/quic_spdy_client_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_spdy_client_stream.cc
diff --git a/net/tools/quic/quic_spdy_client_stream.cc b/net/tools/quic/quic_spdy_client_stream.cc
index 761c829f9e55be0a6a4cd019ab128887913b12cd..2c7de8cf40414f6eb63922bd006d190c629c6bc6 100644
--- a/net/tools/quic/quic_spdy_client_stream.cc
+++ b/net/tools/quic/quic_spdy_client_stream.cc
@@ -18,7 +18,7 @@ static const size_t kHeaderBufInitialSize = 4096;
QuicSpdyClientStream::QuicSpdyClientStream(QuicStreamId id,
QuicClientSession* session)
- : QuicReliableClientStream(id, session),
+ : ReliableQuicStream(id, session),
read_buf_(new GrowableIOBuffer()),
response_headers_received_(false) {
}
@@ -26,6 +26,15 @@ QuicSpdyClientStream::QuicSpdyClientStream(QuicStreamId id,
QuicSpdyClientStream::~QuicSpdyClientStream() {
}
+bool QuicSpdyClientStream::OnStreamFrame(const QuicStreamFrame& frame) {
+ if (!write_side_closed()) {
+ DLOG(INFO) << "Got a response before the request was complete. "
+ << "Aborting request.";
+ CloseWriteSide();
+ }
+ return ReliableQuicStream::OnStreamFrame(frame);
+}
+
uint32 QuicSpdyClientStream::ProcessData(const char* data, uint32 length) {
uint32 total_bytes_processed = 0;
@@ -39,8 +48,7 @@ uint32 QuicSpdyClientStream::ProcessData(const char* data, uint32 length) {
read_buf_->set_offset(read_buf_->offset() + length);
ParseResponseHeaders();
} else {
- mutable_data()->append(data + total_bytes_processed,
- length - total_bytes_processed);
+ data_.append(data + total_bytes_processed, length - total_bytes_processed);
}
return length;
}
@@ -51,7 +59,7 @@ void QuicSpdyClientStream::OnFinRead() {
Reset(QUIC_BAD_APPLICATION_PAYLOAD);
} else if ((headers().content_length_status() ==
BalsaHeadersEnums::VALID_CONTENT_LENGTH) &&
- mutable_data()->size() != headers().content_length()) {
+ data_.size() != headers().content_length()) {
Reset(QUIC_BAD_APPLICATION_PAYLOAD);
}
}
@@ -87,7 +95,7 @@ int QuicSpdyClientStream::ParseResponseHeaders() {
return -1;
}
- if (!SpdyUtils::FillBalsaResponseHeaders(headers, mutable_headers())) {
+ if (!SpdyUtils::FillBalsaResponseHeaders(headers, &headers_)) {
Reset(QUIC_BAD_APPLICATION_PAYLOAD);
return -1;
}
@@ -95,11 +103,16 @@ int QuicSpdyClientStream::ParseResponseHeaders() {
size_t delta = read_buf_len - len;
if (delta > 0) {
- mutable_data()->append(data + len, delta);
+ data_.append(data + len, delta);
}
return len;
}
+// Sends body data to the server and returns the number of bytes sent.
+ssize_t QuicSpdyClientStream::SendBody(const string& data, bool fin) {
+ return WriteData(data, fin).bytes_consumed;
+}
+
} // namespace tools
} // namespace net
« no previous file with comments | « net/tools/quic/quic_spdy_client_stream.h ('k') | net/tools/quic/quic_spdy_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698