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

Side by Side Diff: net/tools/quic/quic_simple_per_connection_packet_writer.cc

Issue 1660533002: Landing Recent QUIC changes until 01/26/2016 18:14 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 #include "net/tools/quic/quic_simple_per_connection_packet_writer.h" 5 #include "net/tools/quic/quic_simple_per_connection_packet_writer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "net/tools/quic/quic_simple_server_packet_writer.h" 8 #include "net/tools/quic/quic_simple_server_packet_writer.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 QuicSimplePerConnectionPacketWriter::QuicSimplePerConnectionPacketWriter( 12 QuicSimplePerConnectionPacketWriter::QuicSimplePerConnectionPacketWriter(
13 QuicSimpleServerPacketWriter* shared_writer) 13 QuicSimpleServerPacketWriter* shared_writer)
14 : shared_writer_(shared_writer), 14 : shared_writer_(shared_writer),
15 connection_(nullptr), 15 connection_(nullptr),
16 weak_factory_(this) {} 16 weak_factory_(this) {}
17 17
18 QuicSimplePerConnectionPacketWriter::~QuicSimplePerConnectionPacketWriter() {} 18 QuicSimplePerConnectionPacketWriter::~QuicSimplePerConnectionPacketWriter() {}
19 19
20 QuicPacketWriter* QuicSimplePerConnectionPacketWriter::shared_writer() const { 20 QuicPacketWriter* QuicSimplePerConnectionPacketWriter::shared_writer() const {
21 return shared_writer_; 21 return shared_writer_;
22 } 22 }
23 23
24 WriteResult QuicSimplePerConnectionPacketWriter::WritePacket( 24 WriteResult QuicSimplePerConnectionPacketWriter::WritePacket(
25 const char* buffer, 25 const char* buffer,
26 size_t buf_len, 26 size_t buf_len,
27 const IPAddressNumber& self_address, 27 const IPAddressNumber& self_address,
28 const IPEndPoint& peer_address) { 28 const IPEndPoint& peer_address,
29 PerPacketOptions* options) {
29 return shared_writer_->WritePacketWithCallback( 30 return shared_writer_->WritePacketWithCallback(
30 buffer, buf_len, self_address, peer_address, 31 buffer, buf_len, self_address, peer_address, options,
31 base::Bind(&QuicSimplePerConnectionPacketWriter::OnWriteComplete, 32 base::Bind(&QuicSimplePerConnectionPacketWriter::OnWriteComplete,
32 weak_factory_.GetWeakPtr())); 33 weak_factory_.GetWeakPtr()));
33 } 34 }
34 35
35 bool QuicSimplePerConnectionPacketWriter::IsWriteBlockedDataBuffered() const { 36 bool QuicSimplePerConnectionPacketWriter::IsWriteBlockedDataBuffered() const {
36 return shared_writer_->IsWriteBlockedDataBuffered(); 37 return shared_writer_->IsWriteBlockedDataBuffered();
37 } 38 }
38 39
39 bool QuicSimplePerConnectionPacketWriter::IsWriteBlocked() const { 40 bool QuicSimplePerConnectionPacketWriter::IsWriteBlocked() const {
40 return shared_writer_->IsWriteBlocked(); 41 return shared_writer_->IsWriteBlocked();
41 } 42 }
42 43
43 void QuicSimplePerConnectionPacketWriter::SetWritable() { 44 void QuicSimplePerConnectionPacketWriter::SetWritable() {
44 shared_writer_->SetWritable(); 45 shared_writer_->SetWritable();
45 } 46 }
46 47
47 void QuicSimplePerConnectionPacketWriter::OnWriteComplete(WriteResult result) { 48 void QuicSimplePerConnectionPacketWriter::OnWriteComplete(WriteResult result) {
48 if (connection_ && result.status == WRITE_STATUS_ERROR) { 49 if (connection_ && result.status == WRITE_STATUS_ERROR) {
49 connection_->OnWriteError(result.error_code); 50 connection_->OnWriteError(result.error_code);
50 } 51 }
51 } 52 }
52 53
53 QuicByteCount QuicSimplePerConnectionPacketWriter::GetMaxPacketSize( 54 QuicByteCount QuicSimplePerConnectionPacketWriter::GetMaxPacketSize(
54 const IPEndPoint& peer_address) const { 55 const IPEndPoint& peer_address) const {
55 return shared_writer_->GetMaxPacketSize(peer_address); 56 return shared_writer_->GetMaxPacketSize(peer_address);
56 } 57 }
57 58
58 } // namespace net 59 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_per_connection_packet_writer.h ('k') | net/tools/quic/quic_simple_server_packet_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698