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

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

Issue 467963002: Refactoring: Create per-connection packet writers in QuicDispatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation Created 6 years, 4 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
(Empty)
1 // Copyright (c) 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_TOOLS_QUIC_QUIC_PER_CONNECTION_PACKET_WRITER_H_
6 #define NET_TOOLS_QUIC_QUIC_PER_CONNECTION_PACKET_WRITER_H_
7
8 #include "net/quic/quic_connection.h"
9 #include "net/quic/quic_packet_writer.h"
10
11 namespace net {
12
13 namespace tools {
14
15 // A connection-specific packet writer that wraps a shared writer and keeps a
16 // reference to the connection.
17 class QuicPerConnectionPacketWriter : public QuicPacketWriter {
18 public:
19 // Does not take ownership of |shared_writer| or |connection|.
20 QuicPerConnectionPacketWriter(QuicPacketWriter* shared_writer,
21 QuicConnection* connection);
22 virtual ~QuicPerConnectionPacketWriter();
23
24 QuicPacketWriter* shared_writer() { return shared_writer_; }
25 QuicConnection* connection() { return connection_; }
26
27 // Default implementation of the QuicPacketWriter interface: Passes everything
28 // to |shared_writer_|.
29 virtual WriteResult WritePacket(
30 const char* buffer,
31 size_t buf_len,
32 const IPAddressNumber& self_address,
33 const IPEndPoint& peer_address) override;
34 virtual bool IsWriteBlockedDataBuffered() const override;
35 virtual bool IsWriteBlocked() const override;
36 virtual void SetWritable() override;
37
38 private:
39 QuicPacketWriter* shared_writer_; // Not owned.
40 QuicConnection* connection_; // Not owned.
41
42 DISALLOW_COPY_AND_ASSIGN(QuicPerConnectionPacketWriter);
43 };
44
45 } // namespace tools
46
47 } // namespace net
48
49 #endif // NET_TOOLS_QUIC_QUIC_PER_CONNECTION_PACKET_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698