Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
dart::bin::SynchronousSocket Class Reference

#include <sync_socket.h>

Public Member Functions

 SynchronousSocket (intptr_t fd)
 
 ~SynchronousSocket ()
 
intptr_t fd () const
 
void SetClosedFd ()
 

Static Public Member Functions

static bool Initialize ()
 
static intptr_t CreateConnect (const RawAddr &addr)
 
static Dart_Handle SetSocketIdNativeField (Dart_Handle handle, SynchronousSocket *socket)
 
static Dart_Handle GetSocketIdNativeField (Dart_Handle socket_obj, SynchronousSocket **socket)
 
static intptr_t Available (intptr_t fd)
 
static intptr_t GetPort (intptr_t fd)
 
static SocketAddressGetRemotePeer (intptr_t fd, intptr_t *port)
 
static intptr_t Read (intptr_t fd, void *buffer, intptr_t num_bytes)
 
static intptr_t Write (intptr_t fd, const void *buffer, intptr_t num_bytes)
 
static void ShutdownRead (intptr_t fd)
 
static void ShutdownWrite (intptr_t fd)
 
static void Close (intptr_t fd)
 

Detailed Description

Definition at line 14 of file sync_socket.h.

Constructor & Destructor Documentation

◆ SynchronousSocket()

dart::bin::SynchronousSocket::SynchronousSocket ( intptr_t  fd)
inlineexplicit

Definition at line 16 of file sync_socket.h.

16: fd_(fd) {}

◆ ~SynchronousSocket()

dart::bin::SynchronousSocket::~SynchronousSocket ( )
inline

Definition at line 17 of file sync_socket.h.

17{ ASSERT(fd_ == kClosedFd); }
#define ASSERT(E)

Member Function Documentation

◆ Available()

static intptr_t dart::bin::SynchronousSocket::Available ( intptr_t  fd)
static

◆ Close()

static void dart::bin::SynchronousSocket::Close ( intptr_t  fd)
static

◆ CreateConnect()

static intptr_t dart::bin::SynchronousSocket::CreateConnect ( const RawAddr addr)
static

◆ fd()

intptr_t dart::bin::SynchronousSocket::fd ( ) const
inline

Definition at line 19 of file sync_socket.h.

19{ return fd_; }

◆ GetPort()

static intptr_t dart::bin::SynchronousSocket::GetPort ( intptr_t  fd)
static

◆ GetRemotePeer()

static SocketAddress * dart::bin::SynchronousSocket::GetRemotePeer ( intptr_t  fd,
intptr_t *  port 
)
static

◆ GetSocketIdNativeField()

Dart_Handle dart::bin::SynchronousSocket::GetSocketIdNativeField ( Dart_Handle  socket_obj,
SynchronousSocket **  socket 
)
static

Definition at line 341 of file sync_socket.cc.

343 {
344 ASSERT(socket != nullptr);
345 intptr_t id;
348 if (Dart_IsError(result)) {
349 return result;
350 }
351 *socket = reinterpret_cast<SynchronousSocket*>(id);
352 if (*socket == nullptr) {
354 DartUtils::NewInternalError("No native peer")));
355 }
356 return result;
357}
static Dart_Handle NewInternalError(const char *message)
Definition: dartutils.cc:781
SynchronousSocket(intptr_t fd)
Definition: sync_socket.h:16
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
GAsyncResult * result
static constexpr int kSocketIdNativeField
Definition: socket.cc:26
DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, int index, intptr_t *value)
DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError(Dart_Handle exception)
DART_EXPORT void Dart_PropagateError(Dart_Handle handle)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
const uintptr_t id

◆ Initialize()

static bool dart::bin::SynchronousSocket::Initialize ( )
static

◆ Read()

static intptr_t dart::bin::SynchronousSocket::Read ( intptr_t  fd,
void *  buffer,
intptr_t  num_bytes 
)
static

◆ SetClosedFd()

void dart::bin::SynchronousSocket::SetClosedFd ( )
inline

Definition at line 20 of file sync_socket.h.

20{ fd_ = kClosedFd; }

◆ SetSocketIdNativeField()

Dart_Handle dart::bin::SynchronousSocket::SetSocketIdNativeField ( Dart_Handle  handle,
SynchronousSocket socket 
)
static

Definition at line 325 of file sync_socket.cc.

327 {
329 handle, kSocketIdNativeField, reinterpret_cast<intptr_t>(socket));
330 if (Dart_IsError(error)) {
331 delete socket;
332 return error;
333 }
334
335 Dart_NewFinalizableHandle(handle, reinterpret_cast<void*>(socket),
336 sizeof(SynchronousSocket),
338 return error;
339}
const uint8_t uint32_t uint32_t GError ** error
static void SynchronousSocketFinalizer(void *isolate_data, void *data)
Definition: sync_socket.cc:316
DART_EXPORT Dart_FinalizableHandle Dart_NewFinalizableHandle(Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
DART_EXPORT Dart_Handle Dart_SetNativeInstanceField(Dart_Handle obj, int index, intptr_t value)

◆ ShutdownRead()

static void dart::bin::SynchronousSocket::ShutdownRead ( intptr_t  fd)
static

◆ ShutdownWrite()

static void dart::bin::SynchronousSocket::ShutdownWrite ( intptr_t  fd)
static

◆ Write()

static intptr_t dart::bin::SynchronousSocket::Write ( intptr_t  fd,
const void *  buffer,
intptr_t  num_bytes 
)
static

The documentation for this class was generated from the following files: