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

Unified Diff: net/quic/quic_reliable_client_stream.cc

Issue 11364068: Add a QuicHttpStream class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: NET_EXPORT_PRIVATE Created 8 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/quic/quic_reliable_client_stream.h ('k') | net/quic/quic_reliable_client_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_reliable_client_stream.cc
diff --git a/net/quic/quic_reliable_client_stream.cc b/net/quic/quic_reliable_client_stream.cc
index 09fb01ef6c9fb114b07b062ffd00091f1df7fdbe..2e66897eafce5a867f6baaf1b52f273895700e17 100644
--- a/net/quic/quic_reliable_client_stream.cc
+++ b/net/quic/quic_reliable_client_stream.cc
@@ -5,19 +5,26 @@
#include "net/quic/quic_reliable_client_stream.h"
#include "net/base/net_errors.h"
+#include "net/quic/quic_session.h"
namespace net {
QuicReliableClientStream::QuicReliableClientStream(QuicStreamId id,
QuicSession* session)
- : ReliableQuicStream(id, session) {
+ : ReliableQuicStream(id, session),
+ delegate_(NULL) {
}
QuicReliableClientStream::~QuicReliableClientStream() {
+ if (delegate_) {
+ delegate_->OnClose(error());
+ }
}
uint32 QuicReliableClientStream::ProcessData(const char* data,
uint32 data_len) {
+ // TODO(rch): buffer data if we don't have a delegate.
+ DCHECK(delegate_);
int rv = delegate_->OnDataReceived(data, data_len);
if (rv != OK) {
DLOG(ERROR) << "Delegate refused data, rv: " << rv;
@@ -28,11 +35,15 @@ uint32 QuicReliableClientStream::ProcessData(const char* data,
}
void QuicReliableClientStream::TerminateFromPeer(bool half_close) {
- delegate_->OnClose(error());
+ if (delegate_) {
+ delegate_->OnClose(error());
+ delegate_ = NULL;
+ }
}
void QuicReliableClientStream::SetDelegate(
QuicReliableClientStream::Delegate* delegate) {
+ DCHECK((!delegate_ && delegate) || (delegate_ && !delegate));
delegate_ = delegate;
}
« no previous file with comments | « net/quic/quic_reliable_client_stream.h ('k') | net/quic/quic_reliable_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698