Flutter Engine
The Flutter Engine
sync_socket.h
Go to the documentation of this file.
1// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_BIN_SYNC_SOCKET_H_
6#define RUNTIME_BIN_SYNC_SOCKET_H_
7
8#include "bin/socket_base.h"
9#include "platform/globals.h"
10
11namespace dart {
12namespace bin {
13
15 public:
16 explicit SynchronousSocket(intptr_t fd) : fd_(fd) {}
17 ~SynchronousSocket() { ASSERT(fd_ == kClosedFd); }
18
19 intptr_t fd() const { return fd_; }
20 void SetClosedFd() { fd_ = kClosedFd; }
21
22 static bool Initialize();
23
24 static intptr_t CreateConnect(const RawAddr& addr);
25
27 SynchronousSocket* socket);
29 SynchronousSocket** socket);
30
31 static intptr_t Available(intptr_t fd);
32 static intptr_t GetPort(intptr_t fd);
33 static SocketAddress* GetRemotePeer(intptr_t fd, intptr_t* port);
34 static intptr_t Read(intptr_t fd, void* buffer, intptr_t num_bytes);
35 static intptr_t Write(intptr_t fd, const void* buffer, intptr_t num_bytes);
36
37 static void ShutdownRead(intptr_t fd);
38 static void ShutdownWrite(intptr_t fd);
39 static void Close(intptr_t fd);
40
41 private:
42 static constexpr int kClosedFd = -1;
43
44 intptr_t fd_;
45
46 DISALLOW_COPY_AND_ASSIGN(SynchronousSocket);
47};
48
49} // namespace bin
50} // namespace dart
51
52#endif // RUNTIME_BIN_SYNC_SOCKET_H_
SynchronousSocket(intptr_t fd)
Definition: sync_socket.h:16
static SocketAddress * GetRemotePeer(intptr_t fd, intptr_t *port)
static intptr_t Available(intptr_t fd)
static Dart_Handle GetSocketIdNativeField(Dart_Handle socket_obj, SynchronousSocket **socket)
Definition: sync_socket.cc:341
static intptr_t CreateConnect(const RawAddr &addr)
static void ShutdownRead(intptr_t fd)
static void Close(intptr_t fd)
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 intptr_t GetPort(intptr_t fd)
static void ShutdownWrite(intptr_t fd)
static Dart_Handle SetSocketIdNativeField(Dart_Handle handle, SynchronousSocket *socket)
Definition: sync_socket.cc:325
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
#define ASSERT(E)
Definition: dart_vm.cc:33
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 port
Definition: switches.h:87
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
Definition: switches.h:126