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

Side by Side Diff: net/tools/quic/quic_simple_server_packet_writer.h

Issue 1036023002: Move remaining QUIC server files from net/quic/ to net/tools/quic/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: correctly fix cronet Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_QUIC_QUIC_SERVER_PACKET_WRITER_H_ 5 #ifndef NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_PACKET_WRITER_H_
6 #define NET_QUIC_QUIC_SERVER_PACKET_WRITER_H_ 6 #define NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_PACKET_WRITER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
11 #include "net/quic/quic_connection.h" 11 #include "net/quic/quic_connection.h"
12 #include "net/quic/quic_packet_writer.h" 12 #include "net/quic/quic_packet_writer.h"
13 #include "net/quic/quic_protocol.h" 13 #include "net/quic/quic_protocol.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 class QuicBlockedWriterInterface; 17 class QuicBlockedWriterInterface;
18 class UDPServerSocket; 18 class UDPServerSocket;
19 struct WriteResult; 19 struct WriteResult;
20 20
21 namespace tools {
22
21 // Chrome specific packet writer which uses a UDPServerSocket for writing 23 // Chrome specific packet writer which uses a UDPServerSocket for writing
22 // data. 24 // data.
23 class QuicServerPacketWriter : public QuicPacketWriter { 25 class QuicSimpleServerPacketWriter : public QuicPacketWriter {
24 public: 26 public:
25 typedef base::Callback<void(WriteResult)> WriteCallback; 27 typedef base::Callback<void(WriteResult)> WriteCallback;
26 28
27 QuicServerPacketWriter(UDPServerSocket* socket, 29 QuicSimpleServerPacketWriter(UDPServerSocket* socket,
28 QuicBlockedWriterInterface* blocked_writer); 30 QuicBlockedWriterInterface* blocked_writer);
29 ~QuicServerPacketWriter() override; 31 ~QuicSimpleServerPacketWriter() override;
30 32
31 // Use this method to write packets rather than WritePacket: 33 // Use this method to write packets rather than WritePacket:
32 // QuicServerPacketWriter requires a callback to exist for every write, which 34 // QuicSimpleServerPacketWriter requires a callback to exist for every
33 // will be called once the write completes. 35 // write, which will be called once the write completes.
34 virtual WriteResult WritePacketWithCallback( 36 virtual WriteResult WritePacketWithCallback(
35 const char* buffer, 37 const char* buffer,
36 size_t buf_len, 38 size_t buf_len,
37 const IPAddressNumber& self_address, 39 const IPAddressNumber& self_address,
38 const IPEndPoint& peer_address, 40 const IPEndPoint& peer_address,
39 WriteCallback callback); 41 WriteCallback callback);
40 42
41 void OnWriteComplete(int rv); 43 void OnWriteComplete(int rv);
42 44
43 // QuicPacketWriter implementation: 45 // QuicPacketWriter implementation:
(...skipping 13 matching lines...) Expand all
57 59
58 // To be notified after every successful asynchronous write. 60 // To be notified after every successful asynchronous write.
59 QuicBlockedWriterInterface* blocked_writer_; 61 QuicBlockedWriterInterface* blocked_writer_;
60 62
61 // To call once the write completes. 63 // To call once the write completes.
62 WriteCallback callback_; 64 WriteCallback callback_;
63 65
64 // Whether a write is currently in flight. 66 // Whether a write is currently in flight.
65 bool write_blocked_; 67 bool write_blocked_;
66 68
67 base::WeakPtrFactory<QuicServerPacketWriter> weak_factory_; 69 base::WeakPtrFactory<QuicSimpleServerPacketWriter> weak_factory_;
68 70
69 DISALLOW_COPY_AND_ASSIGN(QuicServerPacketWriter); 71 DISALLOW_COPY_AND_ASSIGN(QuicSimpleServerPacketWriter);
70 }; 72 };
71 73
74 } // namespace tools
72 } // namespace net 75 } // namespace net
73 76
74 #endif // NET_QUIC_QUIC_SERVER_PACKET_WRITER_H_ 77 #endif // NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_PACKET_WRITER_H_
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_server_bin.cc ('k') | net/tools/quic/quic_simple_server_packet_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698