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

Unified Diff: net/quic/quic_message_stream.cc

Issue 474383003: Initial P2P implementation for WebRTC on QUIC prototype Base URL: https://chromium.googlesource.com/chromium/src.git@tests-squashed
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_message_stream.h ('k') | net/quic/quic_p2p_client_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_message_stream.cc
diff --git a/net/quic/quic_message_stream.cc b/net/quic/quic_message_stream.cc
new file mode 100644
index 0000000000000000000000000000000000000000..76b8ae395d8fd9c886f9ef6867dfbcf3515b5785
--- /dev/null
+++ b/net/quic/quic_message_stream.cc
@@ -0,0 +1,38 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/quic/quic_message_stream.h"
+
+#include "net/base/iovec.h"
+
+namespace net {
+
+QuicMessageStream::QuicMessageStream(QuicStreamId id,
+ QuicSession* session,
+ ReadDelegate* delegate)
+ : QuicDataStream(id, session),
+ delegate_(delegate) {
+ DCHECK_NE(kCryptoStreamId, id);
+}
+
+QuicMessageStream::~QuicMessageStream() {
+}
+
+int QuicMessageStream::WriteStreamData(base::StringPiece data, bool fin) {
+ struct iovec iov = {const_cast<char*>(data.data()),
+ static_cast<size_t>(data.size())};
+ QuicConsumedData consumed_data = WritevData(&iov, 1, fin, NULL);
+ return consumed_data.bytes_consumed;
+}
+
+void QuicMessageStream::OnClose() {
+ delegate_->OnStreamClose(id());
+}
+
+uint32 QuicMessageStream::ProcessData(const char* data, uint32 data_len) {
+ delegate_->OnStreamRead(id(), data, data_len);
+ return data_len;
+}
+
+} // namespace net
« no previous file with comments | « net/quic/quic_message_stream.h ('k') | net/quic/quic_p2p_client_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698