#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/platform/p2p/socket_client_impl.h"
#include "base/location.h"
#include "base/metrics/histogram_macros.h"
#include "base/time/time.h"
#include "base/trace_event/common/trace_event_common.h"
#include "crypto/random.h"
#include "services/network/public/cpp/p2p_param_traits.h"
#include "third_party/blink/renderer/platform/p2p/socket_client_delegate.h"
#include "third_party/blink/renderer/platform/p2p/socket_dispatcher.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace {
uint64_t GetUniqueId(uint32_t random_socket_id, uint32_t packet_id) { … }
void RecordNumberOfPacketsInBatch(int num_packets) { … }
}
namespace blink {
P2PSocketClientImpl::P2PSocketClientImpl(bool batch_packets)
: … { … }
P2PSocketClientImpl::~P2PSocketClientImpl() { … }
void P2PSocketClientImpl::Init(blink::P2PSocketClientDelegate* delegate) { … }
uint64_t P2PSocketClientImpl::Send(const net::IPEndPoint& address,
base::span<const uint8_t> data,
const rtc::PacketOptions& options) { … }
void P2PSocketClientImpl::FlushBatch() { … }
void P2PSocketClientImpl::DoSendBatch() { … }
void P2PSocketClientImpl::SendWithPacketId(const net::IPEndPoint& address,
base::span<const uint8_t> data,
const rtc::PacketOptions& options,
uint64_t packet_id) { … }
void P2PSocketClientImpl::SetOption(network::P2PSocketOption option,
int value) { … }
void P2PSocketClientImpl::Close() { … }
int P2PSocketClientImpl::GetSocketID() const { … }
void P2PSocketClientImpl::SetDelegate(
blink::P2PSocketClientDelegate* delegate) { … }
void P2PSocketClientImpl::SocketCreated(const net::IPEndPoint& local_address,
const net::IPEndPoint& remote_address) { … }
void P2PSocketClientImpl::SendComplete(
const network::P2PSendPacketMetrics& send_metrics) { … }
void P2PSocketClientImpl::SendBatchComplete(
const WTF::Vector<::network::P2PSendPacketMetrics>& in_send_metrics_batch) { … }
void P2PSocketClientImpl::DataReceived(
WTF::Vector<P2PReceivedPacketPtr> packets) { … }
void P2PSocketClientImpl::OnConnectionError() { … }
}