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

Side by Side Diff: net/quic/quic_per_connection_packet_writer.cc

Issue 475113005: Refactoring: Create per-connection packet writers in QuicDispatcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add new files to net/BUILD.gn 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_per_connection_packet_writer.h ('k') | net/quic/quic_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "net/quic/quic_per_connection_packet_writer.h" 5 #include "net/quic/quic_per_connection_packet_writer.h"
6 6
7 #include "net/quic/quic_server_packet_writer.h" 7 #include "net/quic/quic_server_packet_writer.h"
8 #include "net/quic/quic_types.h"
9 8
10 namespace net { 9 namespace net {
11 10
12 QuicPerConnectionPacketWriter::QuicPerConnectionPacketWriter( 11 QuicPerConnectionPacketWriter::QuicPerConnectionPacketWriter(
13 QuicServerPacketWriter* writer) 12 QuicServerPacketWriter* shared_writer,
14 : weak_factory_(this), writer_(writer) { 13 QuicConnection* connection)
14 : weak_factory_(this),
15 shared_writer_(shared_writer),
16 connection_(connection) {
15 } 17 }
16 18
17 QuicPerConnectionPacketWriter::~QuicPerConnectionPacketWriter() { 19 QuicPerConnectionPacketWriter::~QuicPerConnectionPacketWriter() {
18 } 20 }
19 21
22 QuicPacketWriter* QuicPerConnectionPacketWriter::shared_writer() const {
23 return shared_writer_;
24 }
25
20 WriteResult QuicPerConnectionPacketWriter::WritePacket( 26 WriteResult QuicPerConnectionPacketWriter::WritePacket(
21 const char* buffer, 27 const char* buffer,
22 size_t buf_len, 28 size_t buf_len,
23 const IPAddressNumber& self_address, 29 const IPAddressNumber& self_address,
24 const IPEndPoint& peer_address) { 30 const IPEndPoint& peer_address) {
25 return writer_->WritePacketWithCallback( 31 return shared_writer_->WritePacketWithCallback(
26 buffer, 32 buffer,
27 buf_len, 33 buf_len,
28 self_address, 34 self_address,
29 peer_address, 35 peer_address,
30 base::Bind(&QuicPerConnectionPacketWriter::OnWriteComplete, 36 base::Bind(&QuicPerConnectionPacketWriter::OnWriteComplete,
31 weak_factory_.GetWeakPtr())); 37 weak_factory_.GetWeakPtr()));
32 } 38 }
33 39
34 bool QuicPerConnectionPacketWriter::IsWriteBlockedDataBuffered() const { 40 bool QuicPerConnectionPacketWriter::IsWriteBlockedDataBuffered() const {
35 return writer_->IsWriteBlockedDataBuffered(); 41 return shared_writer_->IsWriteBlockedDataBuffered();
36 } 42 }
37 43
38 bool QuicPerConnectionPacketWriter::IsWriteBlocked() const { 44 bool QuicPerConnectionPacketWriter::IsWriteBlocked() const {
39 return writer_->IsWriteBlocked(); 45 return shared_writer_->IsWriteBlocked();
40 } 46 }
41 47
42 void QuicPerConnectionPacketWriter::SetWritable() { 48 void QuicPerConnectionPacketWriter::SetWritable() {
43 writer_->SetWritable(); 49 shared_writer_->SetWritable();
44 } 50 }
45 51
46 void QuicPerConnectionPacketWriter::OnWriteComplete(WriteResult result) { 52 void QuicPerConnectionPacketWriter::OnWriteComplete(WriteResult result) {
47 connection_->OnPacketSent(result); 53 connection_->OnPacketSent(result);
48 } 54 }
49 55
50 } // namespace net 56 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_per_connection_packet_writer.h ('k') | net/quic/quic_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698