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

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

Issue 2324833004: Define Stable API for WebRTC/Quartc (Closed)
Patch Set: Modification of AtExitManager. 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..bbfd689b9a5fe5f9d8cfd838bcdbe5b5f0777036
--- /dev/null
+++ b/net/quic/quartc/quartc_packet_writer.h
@@ -0,0 +1,56 @@
+// 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,
+ QuicByteCount max_packet_size);
+ ~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. Users such as WebRTC
+ // can set the value through the QuartcFactoryConfig without updating the QUIC
+ // code.
+ 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_;
+ // The maximum size of the packet can be written by this writer.
+ QuicByteCount max_packet_size_;
+};
+
+} // namespace net
+
+#endif // NET_QUIC_QUARTC_QUARTC_PACKET_WRITER_H_

Powered by Google App Engine
This is Rietveld 408576698