5#ifndef RUNTIME_BIN_EVENTHANDLER_WIN_H_
6#define RUNTIME_BIN_EVENTHANDLER_WIN_H_
8#if !defined(RUNTIME_BIN_EVENTHANDLER_H_)
9#error Do not include eventhandler_win.h directly; use eventhandler.h instead.
27class EventHandlerImplementation;
78 SOCKET
client()
const {
return client_; }
81 struct sockaddr*
from()
const {
return from_; }
83 socklen_t
from_len()
const {
return from_ ==
nullptr ? 0 : *from_len_addr_; }
88 memset(&overlapped_, 0,
sizeof(overlapped_));
110 const int kAdditionalSize =
111 sizeof(
struct sockaddr_storage) + sizeof(socklen_t);
112 ASSERT(buflen_ > kAdditionalSize);
113 buflen_ -= kAdditionalSize;
116 *from_len_addr_ =
sizeof(
struct sockaddr_storage);
117 from_ =
reinterpret_cast<struct sockaddr*
>(from_len_addr_ + 1);
119 from_len_addr_ =
nullptr;
125 client_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
150 socklen_t* from_len_addr_;
151 struct sockaddr* from_;
156 uint8_t buffer_data_[1];
273 std::unique_ptr<OverlappedBuffer>
286 void WaitForReadThreadStarted();
287 void NotifyReadThreadStarted();
288 void WaitForReadThreadFinished();
289 void NotifyReadThreadFinished();
322 static StdHandle* StdinPtr() {
return stdin_; }
326 static Mutex* stdin_mutex_;
331 thread_id_(
Thread::kInvalidThreadId),
332 thread_handle_(nullptr),
334 write_thread_exists_(
false),
335 write_thread_running_(
false) {
341 intptr_t thread_wrote_;
342 bool write_thread_exists_;
343 bool write_thread_running_;
345 DISALLOW_COPY_AND_ASSIGN(StdHandle);
353 recursive_(recursive) {
373 SOCKET
socket()
const {
return socket_; }
381 const SOCKET socket_;
392 GetAcceptExSockaddrs_(nullptr),
393 pending_accept_count_(0),
394 accepted_head_(nullptr),
395 accepted_tail_(nullptr),
401 ASSERT(accepted_head_ ==
nullptr);
402 ASSERT(accepted_tail_ ==
nullptr);
424 bool LoadGetAcceptExSockaddrs();
426 LPFN_ACCEPTEX AcceptEx_;
427 LPFN_GETACCEPTEXSOCKADDRS GetAcceptExSockaddrs_;
431 int pending_accept_count_;
449 std::unique_ptr<RawAddr> remote_addr =
nullptr)
451 DisconnectEx_(nullptr),
455 remote_addr_(
std::move(remote_addr)) {
495 static intptr_t disconnecting() {
return disconnecting_; }
499 bool LoadDisconnectEx();
501 LPFN_DISCONNECTEX DisconnectEx_;
505 std::unique_ptr<RawAddr> remote_addr_;
508 static intptr_t disconnecting_;
576 HANDLE handler_thread_handle_;
static uint32_t buffer_size(uint32_t offset, uint32_t maxAlignment)
static bool ok(int result)
virtual bool IssueWrite()
virtual void EnsureInitialized(EventHandlerImplementation *event_handler)
void ConnectComplete(OverlappedBuffer *buffer)
ClientSocket(intptr_t s, std::unique_ptr< RawAddr > remote_addr=nullptr)
void DisconnectComplete(OverlappedBuffer *buffer)
bool PopulateRemoteAddr(RawAddr &addr)
bool is_connected() const
void set_next(ClientSocket *next)
virtual void EnsureInitialized(EventHandlerImplementation *event_handler)
virtual ~DatagramSocket()
virtual bool IssueRecvFrom()
virtual bool IssueSendTo(sockaddr *sa, socklen_t sa_len)
DatagramSocket(intptr_t s)
virtual void EnsureInitialized(EventHandlerImplementation *event_handler)
DirectoryWatchHandle(HANDLE handle, int events, bool recursive)
void HandleWrite(Handle *handle, int bytes, OverlappedBuffer *buffer)
void HandleConnect(ClientSocket *client_socket, int bytes, OverlappedBuffer *buffer)
void SendData(intptr_t id, Dart_Port dart_port, int64_t data)
void HandleRead(Handle *handle, int bytes, OverlappedBuffer *buffer)
void TryDispatchingPendingAccepts(ListenSocket *listen_socket)
EventHandlerImplementation()
void HandleDisconnect(ClientSocket *client_socket, int bytes, OverlappedBuffer *buffer)
void HandleAccept(ListenSocket *listen_socket, OverlappedBuffer *buffer)
void HandleRecvFrom(Handle *handle, int bytes, OverlappedBuffer *buffer)
void Start(EventHandler *handler)
static void EventHandlerEntry(uword args)
void HandleIOCompletion(DWORD bytes, ULONG_PTR key, OVERLAPPED *overlapped)
virtual ~EventHandlerImplementation()
void HandleInterrupt(InterruptMessage *msg)
void HandleCompletionOrInterrupt(BOOL ok, DWORD bytes, ULONG_PTR key, OVERLAPPED *overlapped)
virtual void EnsureInitialized(EventHandlerImplementation *event_handler)
FileHandle(HANDLE handle)
void MarkDoesNotSupportOverlappedIO()
virtual bool IssueSendTo(struct sockaddr *sa, socklen_t sa_len)
bool IsHandleClosed() const
intptr_t RecvFrom(void *buffer, intptr_t num_bytes, struct sockaddr *sa, socklen_t addr_len)
void ReadSyncCompleteAsync()
virtual intptr_t Write(const void *buffer, intptr_t num_bytes)
HANDLE read_thread_handle_
bool is_datagram_socket()
virtual void EnsureInitialized(EventHandlerImplementation *event_handler)=0
virtual bool IssueRecvFrom()
void set_event_handler(EventHandlerImplementation *event_handler)
void set_completion_port(HANDLE completion_port)
void set_last_error(DWORD last_error)
virtual bool IsClosed()=0
EventHandlerImplementation * event_handler_
void RecvFromComplete(OverlappedBuffer *buffer)
virtual bool IssueWrite()
@ kDoesNotSupportOverlappedIO
void WriteComplete(OverlappedBuffer *buffer)
OverlappedBuffer * pending_read_
std::unique_ptr< OverlappedBuffer > data_ready_
virtual void HandleIssueError()
bool SupportsOverlappedIO()
bool read_thread_finished_
bool CreateCompletionPort(HANDLE completion_port)
bool read_thread_starting_
virtual intptr_t SendTo(const void *buffer, intptr_t num_bytes, struct sockaddr *sa, socklen_t sa_len)
OverlappedBuffer * pending_write_
intptr_t Read(void *buffer, intptr_t num_bytes)
void ReadComplete(OverlappedBuffer *buffer)
int pending_accept_count()
virtual void EnsureInitialized(EventHandlerImplementation *event_handler)
void AcceptComplete(OverlappedBuffer *buffer, HANDLE completion_port)
int Read(void *buffer, int num_bytes)
void set_data_length(int data_length)
static void DisposeBuffer(OverlappedBuffer *buffer)
static OverlappedBuffer * GetFromOverlapped(OVERLAPPED *overlapped)
static OverlappedBuffer * AllocateRecvFromBuffer(int buffer_size)
int GetBufferSize() const
static OverlappedBuffer * AllocateAcceptBuffer(int buffer_size)
Operation operation() const
OVERLAPPED * GetCleanOverlapped()
static OverlappedBuffer * AllocateConnectBuffer()
int Write(const void *buffer, int num_bytes)
socklen_t * from_len_addr() const
static OverlappedBuffer * AllocateDisconnectBuffer()
struct sockaddr * from() const
static OverlappedBuffer * AllocateSendToBuffer(int buffer_size)
socklen_t from_len() const
static OverlappedBuffer * AllocateReadBuffer(int buffer_size)
static OverlappedBuffer * AllocateWriteBuffer(int buffer_size)
virtual void HandleIssueError()
void WriteSyncCompleteAsync()
static StdHandle * Stdin(HANDLE handle)
virtual intptr_t Write(const void *buffer, intptr_t num_bytes)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static EventHandler * event_handler
void * malloc(size_t size)
static int8_t data[kExtLength]
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
#define INVALID_HANDLE_VALUE
struct _OVERLAPPED OVERLAPPED
__w64 unsigned long ULONG_PTR