Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / net / quic / quic_default_packet_writer.h
blob06bd412505dca56d163d3d8045163d62ebf8081c
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_QUIC_QUIC_DEFAULT_PACKET_WRITER_H_
6 #define NET_QUIC_QUIC_DEFAULT_PACKET_WRITER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
10 #include "net/base/ip_endpoint.h"
11 #include "net/quic/quic_connection.h"
12 #include "net/quic/quic_packet_writer.h"
13 #include "net/quic/quic_protocol.h"
14 #include "net/udp/datagram_client_socket.h"
16 namespace net {
18 struct WriteResult;
20 // Chrome specific packet writer which uses a datagram Socket for writing data.
21 class NET_EXPORT_PRIVATE QuicDefaultPacketWriter : public QuicPacketWriter {
22 public:
23 QuicDefaultPacketWriter();
24 explicit QuicDefaultPacketWriter(Socket* socket);
25 ~QuicDefaultPacketWriter() override;
27 // QuicPacketWriter
28 WriteResult WritePacket(const char* buffer,
29 size_t buf_len,
30 const IPAddressNumber& self_address,
31 const IPEndPoint& peer_address) override;
32 bool IsWriteBlockedDataBuffered() const override;
33 bool IsWriteBlocked() const override;
34 void SetWritable() override;
36 void OnWriteComplete(int rv);
37 void SetConnection(QuicConnection* connection) {
38 connection_ = connection;
41 protected:
42 void set_write_blocked(bool is_blocked) {
43 write_blocked_ = is_blocked;
46 private:
47 Socket* socket_;
48 QuicConnection* connection_;
50 // Whether a write is currently in flight.
51 bool write_blocked_;
53 base::WeakPtrFactory<QuicDefaultPacketWriter> weak_factory_;
55 DISALLOW_COPY_AND_ASSIGN(QuicDefaultPacketWriter);
58 } // namespace net
60 #endif // NET_QUIC_QUIC_DEFAULT_PACKET_WRITER_H_