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.
5 #include "net/quic/quic_per_connection_packet_writer.h"
7 #include "net/quic/quic_server_packet_writer.h"
8 #include "net/quic/quic_types.h"
12 QuicPerConnectionPacketWriter::QuicPerConnectionPacketWriter(
13 QuicServerPacketWriter
* writer
)
14 : weak_factory_(this), writer_(writer
) {
17 QuicPerConnectionPacketWriter::~QuicPerConnectionPacketWriter() {
20 WriteResult
QuicPerConnectionPacketWriter::WritePacket(
23 const IPAddressNumber
& self_address
,
24 const IPEndPoint
& peer_address
) {
25 return writer_
->WritePacketWithCallback(
30 base::Bind(&QuicPerConnectionPacketWriter::OnWriteComplete
,
31 weak_factory_
.GetWeakPtr()));
34 bool QuicPerConnectionPacketWriter::IsWriteBlockedDataBuffered() const {
35 return writer_
->IsWriteBlockedDataBuffered();
38 bool QuicPerConnectionPacketWriter::IsWriteBlocked() const {
39 return writer_
->IsWriteBlocked();
42 void QuicPerConnectionPacketWriter::SetWritable() {
43 writer_
->SetWritable();
46 void QuicPerConnectionPacketWriter::OnWriteComplete(WriteResult result
) {
47 connection_
->OnPacketSent(result
);