Lots of random cleanups, mostly for native_theme_win.cc:
[chromium-blink-merge.git] / net / quic / quic_per_connection_packet_writer.cc
blob6347bc201df632e68de7aac05a19a63584179edf
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"
10 namespace net {
12 QuicPerConnectionPacketWriter::QuicPerConnectionPacketWriter(
13 QuicServerPacketWriter* writer)
14 : weak_factory_(this), writer_(writer) {
17 QuicPerConnectionPacketWriter::~QuicPerConnectionPacketWriter() {
20 WriteResult QuicPerConnectionPacketWriter::WritePacket(
21 const char* buffer,
22 size_t buf_len,
23 const IPAddressNumber& self_address,
24 const IPEndPoint& peer_address) {
25 return writer_->WritePacketWithCallback(
26 buffer,
27 buf_len,
28 self_address,
29 peer_address,
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);
50 } // namespace net