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

Side by Side Diff: net/quic/quic_server_packet_writer.h

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « net/quic/quic_server_id_test.cc ('k') | net/quic/quic_server_packet_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef NET_QUIC_QUIC_SERVER_PACKET_WRITER_H_
6 #define NET_QUIC_QUIC_SERVER_PACKET_WRITER_H_
7
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
15 namespace net {
16
17 class QuicBlockedWriterInterface;
18 class UDPServerSocket;
19 struct WriteResult;
20
21 // Chrome specific packet writer which uses a UDPServerSocket for writing
22 // data.
23 class QuicServerPacketWriter : public QuicPacketWriter {
24 public:
25 typedef base::Callback<void(WriteResult)> WriteCallback;
26
27 QuicServerPacketWriter(UDPServerSocket* socket,
28 QuicBlockedWriterInterface* blocked_writer);
29 ~QuicServerPacketWriter() override;
30
31 // Use this method to write packets rather than WritePacket:
32 // QuicServerPacketWriter requires a callback to exist for every write, which
33 // will be called once the write completes.
34 virtual WriteResult WritePacketWithCallback(
35 const char* buffer,
36 size_t buf_len,
37 const IPAddressNumber& self_address,
38 const IPEndPoint& peer_address,
39 WriteCallback callback);
40
41 void OnWriteComplete(int rv);
42
43 // QuicPacketWriter implementation:
44 bool IsWriteBlockedDataBuffered() const override;
45 bool IsWriteBlocked() const override;
46 void SetWritable() override;
47
48 protected:
49 // Do not call WritePacket on its own -- use WritePacketWithCallback
50 WriteResult WritePacket(const char* buffer,
51 size_t buf_len,
52 const IPAddressNumber& self_address,
53 const IPEndPoint& peer_address) override;
54
55 private:
56 UDPServerSocket* socket_;
57
58 // To be notified after every successful asynchronous write.
59 QuicBlockedWriterInterface* blocked_writer_;
60
61 // To call once the write completes.
62 WriteCallback callback_;
63
64 // Whether a write is currently in flight.
65 bool write_blocked_;
66
67 base::WeakPtrFactory<QuicServerPacketWriter> weak_factory_;
68
69 DISALLOW_COPY_AND_ASSIGN(QuicServerPacketWriter);
70 };
71
72 } // namespace net
73
74 #endif // NET_QUIC_QUIC_SERVER_PACKET_WRITER_H_
OLDNEW
« no previous file with comments | « net/quic/quic_server_id_test.cc ('k') | net/quic/quic_server_packet_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698