#include "device/bluetooth/socket.h"
#include <string>
#include <utility>
#include <vector>
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "device/bluetooth/bluetooth_socket.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "net/base/io_buffer.h"
namespace bluetooth {
namespace {
void HoldReferenceUntilDisconnected(
scoped_refptr<device::BluetoothSocket> socket,
mojom::Socket::DisconnectCallback callback) { … }
}
Socket::Socket(scoped_refptr<device::BluetoothSocket> bluetooth_socket,
mojo::ScopedDataPipeProducerHandle receive_stream,
mojo::ScopedDataPipeConsumerHandle send_stream)
: … { … }
Socket::~Socket() { … }
void Socket::Disconnect(DisconnectCallback callback) { … }
void Socket::OnReceiveStreamWritable(MojoResult result) { … }
void Socket::ShutdownReceive() { … }
void Socket::ReceiveMore() { … }
void Socket::OnBluetoothSocketReceive(void* pending_write_buffer,
int num_bytes_received,
scoped_refptr<net::IOBuffer> io_buffer) { … }
void Socket::OnBluetoothSocketReceiveError(
device::BluetoothSocket::ErrorReason error_reason,
const std::string& error_message) { … }
void Socket::OnSendStreamReadable(MojoResult result) { … }
void Socket::ShutdownSend() { … }
void Socket::SendMore() { … }
void Socket::OnBluetoothSocketSend(int num_bytes_sent) { … }
void Socket::OnBluetoothSocketSendError(const std::string& error_message) { … }
}