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

Unified Diff: net/quic/quartc/quartc_packet_writer.h

Issue 2324833004: Define Stable API for WebRTC/Quartc (Closed)
Patch Set: Fix the issues when testing with WebRTC. Created 4 years, 2 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
Index: net/quic/quartc/quartc_packet_writer.h
diff --git a/net/quic/quartc/quartc_packet_writer.h b/net/quic/quartc/quartc_packet_writer.h
new file mode 100644
index 0000000000000000000000000000000000000000..adf79ff3d63f60e0eb6919b81d58156d59b35e4c
--- /dev/null
+++ b/net/quic/quartc/quartc_packet_writer.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2016 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.
+
+#ifndef NET_QUIC_QUARTC_QUARTC_PACKET_WRITER_H_
+#define NET_QUIC_QUARTC_QUARTC_PACKET_WRITER_H_
+
+#include "net/quic/core/quic_packet_writer.h"
+#include "net/quic/quartc/quartc_session_interface.h"
+
+namespace net {
+
+// Implements a QuicPacketWriter using a
+// QuartcSessionInterface::PacketTransport, which allows a QuicConnection to
+// use(for example), a WebRTC IceTransport.
+class NET_EXPORT_PRIVATE QuartcPacketWriter : public QuicPacketWriter {
+ public:
+ QuartcPacketWriter(QuartcSessionInterface::PacketTransport* packet_transport);
+ ~QuartcPacketWriter() override {}
+
+ // The QuicConnection calls WritePacket and the QuicPacketWriter writes them
+ // to the QuartcSessionInterface::PacketTransport.
+ WriteResult WritePacket(const char* buffer,
+ size_t buf_len,
+ const IPAddress& self_address,
+ const IPEndPoint& peer_address,
+ PerPacketOptions* options) override;
+
+ // This is always set to false so that QuicConnection buffers unsent packets.
+ bool IsWriteBlockedDataBuffered() const override;
+
+ // Whether the underneath |transport_| is blocked. If this returns true,
+ // outgoing QUIC packets are queued by QuicConnection until
+ // Transport::Observer::OnCanWrite() is called.
+ bool IsWriteBlocked() const override;
+
+ // Maximum size of the QUIC packet which can be written.
+ QuicByteCount GetMaxPacketSize(const IPEndPoint& peer_address) const override;
+
+ // This method is not used because the network layer in WebRTC will determine
+ // the writing states.
+ void SetWritable() override;
+
+ private:
+ // QuartcPacketWriter will not own the transport.
+ QuartcSessionInterface::PacketTransport* packet_transport_ = nullptr;
+};
+
+} // namespace net
+
+#endif // NET_QUIC_QUARTC_QUARTC_PACKET_WRITER_H_

Powered by Google App Engine
This is Rietveld 408576698