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

Side by Side Diff: net/quic/quic_per_connection_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_packet_writer.h ('k') | net/quic/quic_per_connection_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_PER_CONNECTION_PACKET_WRITER_H_
6 #define NET_QUIC_QUIC_PER_CONNECTION_PACKET_WRITER_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "net/quic/quic_connection.h"
10 #include "net/quic/quic_packet_writer.h"
11
12 namespace net {
13
14 class QuicServerPacketWriter;
15
16 // A connection-specific packet writer that notifies its connection when its
17 // writes to the shared QuicServerPacketWriter complete.
18 // This class is necessary because multiple connections can share the same
19 // QuicServerPacketWriter, so it has no way to know which connection to notify.
20 class QuicPerConnectionPacketWriter : public QuicPacketWriter {
21 public:
22 // Does not take ownership of |shared_writer| or |connection|.
23 QuicPerConnectionPacketWriter(QuicServerPacketWriter* shared_writer,
24 QuicConnection* connection);
25 ~QuicPerConnectionPacketWriter() override;
26
27 QuicPacketWriter* shared_writer() const;
28 QuicConnection* connection() const { return connection_; }
29
30 // Default implementation of the QuicPacketWriter interface: Passes everything
31 // to |shared_writer_|.
32 WriteResult WritePacket(const char* buffer,
33 size_t buf_len,
34 const IPAddressNumber& self_address,
35 const IPEndPoint& peer_address) override;
36 bool IsWriteBlockedDataBuffered() const override;
37 bool IsWriteBlocked() const override;
38 void SetWritable() override;
39
40 private:
41 void OnWriteComplete(WriteResult result);
42
43 QuicServerPacketWriter* shared_writer_; // Not owned.
44 QuicConnection* connection_; // Not owned.
45
46 base::WeakPtrFactory<QuicPerConnectionPacketWriter> weak_factory_;
47
48 DISALLOW_COPY_AND_ASSIGN(QuicPerConnectionPacketWriter);
49 };
50
51 } // namespace net
52
53 #endif // NET_QUIC_QUIC_PER_CONNECTION_PACKET_WRITER_H_
OLDNEW
« no previous file with comments | « net/quic/quic_packet_writer.h ('k') | net/quic/quic_per_connection_packet_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698