Use touch size for selection handle targetting
[chromium-blink-merge.git] / net / quic / quic_per_connection_packet_writer.h
blob96a37b61d6fe18d02638b04e1b5df298e76252e9
1 // Copyright 2014 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_PER_CONNECTION_PACKET_WRITER_H_
6 #define NET_QUIC_QUIC_PER_CONNECTION_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/quic/quic_types.h"
16 namespace net {
18 class QuicServerPacketWriter;
20 // A connection-specific packet writer that notifies its connection when its
21 // writes to the shared QuicServerPacketWriter complete.
22 // This class is necessary because multiple connections can share the same
23 // QuicServerPacketWriter, so it has no way to know which connection to notify.
24 // TODO(dmz) Try to merge with Chrome's default packet writer
25 class QuicPerConnectionPacketWriter : public QuicPacketWriter {
26 public:
27 QuicPerConnectionPacketWriter(QuicServerPacketWriter* writer);
28 virtual ~QuicPerConnectionPacketWriter();
30 // Set the connection to notify after writes complete.
31 void set_connection(QuicConnection* connection) { connection_ = connection; }
33 // QuicPacketWriter
34 virtual WriteResult WritePacket(const char* buffer,
35 size_t buf_len,
36 const IPAddressNumber& self_address,
37 const IPEndPoint& peer_address) OVERRIDE;
38 virtual bool IsWriteBlockedDataBuffered() const OVERRIDE;
39 virtual bool IsWriteBlocked() const OVERRIDE;
40 virtual void SetWritable() OVERRIDE;
42 private:
43 void OnWriteComplete(WriteResult result);
45 base::WeakPtrFactory<QuicPerConnectionPacketWriter> weak_factory_;
46 QuicServerPacketWriter* writer_; // Not owned.
47 QuicConnection* connection_;
49 DISALLOW_COPY_AND_ASSIGN(QuicPerConnectionPacketWriter);
52 } // namespace net
54 #endif // NET_QUIC_QUIC_PER_CONNECTION_PACKET_WRITER_H_