#include "net/quic/quic_chromium_packet_writer.h"
#include <string>
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/task/sequenced_task_runner.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/quic/quic_chromium_client_session.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
namespace net {
namespace {
enum NotReusableReason { … };
const int kMaxRetries = …;
void RecordNotReusableReason(NotReusableReason reason) { … }
void RecordRetryCount(int count) { … }
const net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
}
QuicChromiumPacketWriter::ReusableIOBuffer::ReusableIOBuffer(size_t capacity)
: … { … }
QuicChromiumPacketWriter::ReusableIOBuffer::~ReusableIOBuffer() = default;
void QuicChromiumPacketWriter::ReusableIOBuffer::Set(const char* buffer,
size_t buf_len) { … }
QuicChromiumPacketWriter::QuicChromiumPacketWriter(
DatagramClientSocket* socket,
base::SequencedTaskRunner* task_runner)
: … { … }
QuicChromiumPacketWriter::~QuicChromiumPacketWriter() = default;
void QuicChromiumPacketWriter::set_force_write_blocked(
bool force_write_blocked) { … }
void QuicChromiumPacketWriter::SetPacket(const char* buffer, size_t buf_len) { … }
quic::WriteResult QuicChromiumPacketWriter::WritePacket(
const char* buffer,
size_t buf_len,
const quic::QuicIpAddress& self_address,
const quic::QuicSocketAddress& peer_address,
quic::PerPacketOptions* ,
const quic::QuicPacketWriterParams& ) { … }
void QuicChromiumPacketWriter::WritePacketToSocket(
scoped_refptr<ReusableIOBuffer> packet) { … }
quic::WriteResult QuicChromiumPacketWriter::WritePacketToSocketImpl() { … }
void QuicChromiumPacketWriter::RetryPacketAfterNoBuffers() { … }
bool QuicChromiumPacketWriter::IsWriteBlocked() const { … }
void QuicChromiumPacketWriter::SetWritable() { … }
std::optional<int> QuicChromiumPacketWriter::MessageTooBigErrorCode() const { … }
void QuicChromiumPacketWriter::OnWriteComplete(int rv) { … }
bool QuicChromiumPacketWriter::MaybeRetryAfterWriteError(int rv) { … }
quic::QuicByteCount QuicChromiumPacketWriter::GetMaxPacketSize(
const quic::QuicSocketAddress& peer_address) const { … }
bool QuicChromiumPacketWriter::SupportsReleaseTime() const { … }
bool QuicChromiumPacketWriter::IsBatchMode() const { … }
bool QuicChromiumPacketWriter::SupportsEcn() const { … }
quic::QuicPacketBuffer QuicChromiumPacketWriter::GetNextWriteLocation(
const quic::QuicIpAddress& self_address,
const quic::QuicSocketAddress& peer_address) { … }
quic::WriteResult QuicChromiumPacketWriter::Flush() { … }
bool QuicChromiumPacketWriter::OnSocketClosed(DatagramClientSocket* socket) { … }
}