Use the correct typedef for the return value of BlinkPlatformImpl::getTraceSamplingState
[chromium-blink-merge.git] / net / quic / quic_default_packet_writer.h
blobe282d889d196cc73d14fda5fd6d1c1d2c17fa5e9
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 DatagramClientSocket for writing
21 // data.
22 class NET_EXPORT_PRIVATE QuicDefaultPacketWriter : public QuicPacketWriter {
23 public:
24 QuicDefaultPacketWriter();
25 explicit QuicDefaultPacketWriter(DatagramClientSocket* socket);
26 ~QuicDefaultPacketWriter() override;
28 // QuicPacketWriter
29 WriteResult WritePacket(const char* buffer,
30 size_t buf_len,
31 const IPAddressNumber& self_address,
32 const IPEndPoint& peer_address) override;
33 bool IsWriteBlockedDataBuffered() const override;
34 bool IsWriteBlocked() const override;
35 void SetWritable() override;
37 void OnWriteComplete(int rv);
38 void SetConnection(QuicConnection* connection) {
39 connection_ = connection;
42 protected:
43 void set_write_blocked(bool is_blocked) {
44 write_blocked_ = is_blocked;
47 private:
48 DatagramClientSocket* socket_;
49 QuicConnection* connection_;
51 // Whether a write is currently in flight.
52 bool write_blocked_;
54 base::WeakPtrFactory<QuicDefaultPacketWriter> weak_factory_;
56 DISALLOW_COPY_AND_ASSIGN(QuicDefaultPacketWriter);
59 } // namespace net
61 #endif // NET_QUIC_QUIC_DEFAULT_PACKET_WRITER_H_