Flutter Engine
The Flutter Engine
socket_base_posix.cc
Go to the documentation of this file.
1// Copyright (c) 2021, 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#include "platform/globals.h"
6#if defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_LINUX) || \
7 defined(DART_HOST_OS_MACOS)
8#include "bin/socket_base.h"
9
10#include <errno.h> // NOLINT
11#include <net/if.h> // NOLINT
12#include <netinet/tcp.h> // NOLINT
13#include <stdio.h> // NOLINT
14#include <stdlib.h> // NOLINT
15#include <string.h> // NOLINT
16#include <sys/stat.h> // NOLINT
17#include <unistd.h> // NOLINT
18
19#include "bin/fdutils.h"
20#include "bin/file.h"
21#include "bin/ifaddrs.h"
24
25namespace dart {
26namespace bin {
27
28SocketAddress::SocketAddress(struct sockaddr* sa, bool unnamed_unix_socket) {
29 if (unnamed_unix_socket) {
30 // This is an unnamed unix domain socket.
31 as_string_[0] = 0;
32 } else if (sa->sa_family == AF_UNIX) {
33 struct sockaddr_un* un = ((struct sockaddr_un*)sa);
34 memmove(as_string_, un->sun_path, sizeof(un->sun_path));
35 } else {
36 ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN);
37 if (!SocketBase::FormatNumericAddress(*reinterpret_cast<RawAddr*>(sa),
38 as_string_, INET6_ADDRSTRLEN)) {
39 as_string_[0] = 0;
40 }
41 }
42 socklen_t salen =
43 GetAddrLength(*reinterpret_cast<RawAddr*>(sa), unnamed_unix_socket);
44 memmove(reinterpret_cast<void*>(&addr_), sa, salen);
45}
46
48 // Nothing to do on Posix.
49 return true;
50}
51
52bool SocketBase::FormatNumericAddress(const RawAddr& addr,
53 char* address,
54 int len) {
55 socklen_t salen = SocketAddress::GetAddrLength(addr);
56 return (NO_RETRY_EXPECTED(getnameinfo(&addr.addr, salen, address, len,
57 nullptr, 0, NI_NUMERICHOST)) == 0);
58}
59
60bool SocketBase::IsBindError(intptr_t error_number) {
61 return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL ||
62 error_number == EINVAL;
63}
64
65intptr_t SocketBase::Available(intptr_t fd) {
66 return FDUtils::AvailableBytes(fd);
67}
68
69intptr_t SocketBase::Read(intptr_t fd,
70 void* buffer,
71 intptr_t num_bytes,
72 SocketOpKind sync) {
73 ASSERT(fd >= 0);
74 ssize_t read_bytes = TEMP_FAILURE_RETRY(read(fd, buffer, num_bytes));
75 ASSERT(EAGAIN == EWOULDBLOCK);
76 if ((sync == kAsync) && (read_bytes == -1) && (errno == EWOULDBLOCK)) {
77 // If the read would block we need to retry and therefore return 0
78 // as the number of bytes written.
79 read_bytes = 0;
80 }
81 return read_bytes;
82}
83
84intptr_t SocketBase::RecvFrom(intptr_t fd,
85 void* buffer,
86 intptr_t num_bytes,
87 RawAddr* addr,
88 SocketOpKind sync) {
89 ASSERT(fd >= 0);
90 socklen_t addr_len = sizeof(addr->ss);
91 ssize_t read_bytes = TEMP_FAILURE_RETRY(
92 recvfrom(fd, buffer, num_bytes, 0, &addr->addr, &addr_len));
93 if ((sync == kAsync) && (read_bytes == -1) && (errno == EWOULDBLOCK)) {
94 // If the read would block we need to retry and therefore return 0
95 // as the number of bytes written.
96 read_bytes = 0;
97 }
98 return read_bytes;
99}
100
102 return level_ == SOL_SOCKET && type_ == SCM_RIGHTS;
103}
104
105// The maximum size on macOS is not documented so use the same size as Linux.
106// If the sender message size is larger than this then some
107// SocketControlMessages may not be received.
108// /proc/sys/net/core/optmem_max is corresponding kernel setting.
109const size_t kMaxSocketMessageControlLength = 2048;
110
111intptr_t SocketBase::ReceiveMessage(intptr_t fd,
112 void* buffer,
113 int64_t* p_buffer_num_bytes,
114 SocketControlMessage** p_messages,
115 SocketOpKind sync,
116 OSError* p_oserror) {
117 ASSERT(fd >= 0);
118 ASSERT(p_messages != nullptr);
119 ASSERT(p_buffer_num_bytes != nullptr);
120
121 struct iovec iov[1];
122 memset(iov, 0, sizeof(iov));
123 iov[0].iov_base = buffer;
124 iov[0].iov_len = *p_buffer_num_bytes;
125
126 struct msghdr msg;
127 memset(&msg, 0, sizeof(msg));
128 msg.msg_iov = iov;
129 msg.msg_iovlen = 1; // number of elements in iov
130 uint8_t control_buffer[kMaxSocketMessageControlLength];
131 msg.msg_control = control_buffer;
132 msg.msg_controllen = sizeof(control_buffer);
133
134 int flags = 0;
135#ifdef MSG_CMSG_CLOEXEC
136 // MSG_CMSG_CLOEXEC is not supported on macOS.
137 flags &= MSG_CMSG_CLOEXEC;
138#endif
139 ssize_t read_bytes = TEMP_FAILURE_RETRY(recvmsg(fd, &msg, flags));
140 if ((sync == kAsync) && (read_bytes == -1) && (errno == EWOULDBLOCK)) {
141 // If the read would block we need to retry and therefore return 0
142 // as the number of bytes read.
143 return 0;
144 }
145 if (read_bytes < 0) {
146 p_oserror->Reload();
147 return read_bytes;
148 }
149 *p_buffer_num_bytes = read_bytes;
150
151 struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
152 size_t num_messages = 0;
153 while (cmsg != nullptr) {
154 num_messages++;
155 cmsg = CMSG_NXTHDR(&msg, cmsg);
156 }
157 (*p_messages) = reinterpret_cast<SocketControlMessage*>(
158 Dart_ScopeAllocate(sizeof(SocketControlMessage) * num_messages));
159 SocketControlMessage* control_message = *p_messages;
160 for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != nullptr;
161 cmsg = CMSG_NXTHDR(&msg, cmsg), control_message++) {
162 void* data = CMSG_DATA(cmsg);
163 size_t data_length = cmsg->cmsg_len - (reinterpret_cast<uint8_t*>(data) -
164 reinterpret_cast<uint8_t*>(cmsg));
165 void* copied_data = Dart_ScopeAllocate(data_length);
166 ASSERT(copied_data != nullptr);
167 memmove(copied_data, data, data_length);
168 ASSERT(cmsg->cmsg_level == SOL_SOCKET);
169 ASSERT(cmsg->cmsg_type == SCM_RIGHTS);
170 new (control_message) SocketControlMessage(
171 cmsg->cmsg_level, cmsg->cmsg_type, copied_data, data_length);
172
173 int fd;
174 memmove(&fd, CMSG_DATA(cmsg), sizeof(int));
175
176#ifndef MSG_CMSG_CLOEXEC
177 // MSG_CMSG_CLOEXEC is not supported on macOS.
178 if (!FDUtils::SetCloseOnExec(fd)) {
180 return -1;
181 }
182#endif
183 }
184 return num_messages;
185}
186
187bool SocketBase::AvailableDatagram(intptr_t fd,
188 void* buffer,
189 intptr_t num_bytes) {
190 ASSERT(fd >= 0);
191 ssize_t read_bytes = TEMP_FAILURE_RETRY(
192 recvfrom(fd, buffer, num_bytes, MSG_PEEK, nullptr, nullptr));
193 return read_bytes >= 0;
194}
195
196intptr_t SocketBase::WriteImpl(intptr_t fd,
197 const void* buffer,
198 intptr_t num_bytes,
199 SocketOpKind sync) {
200 return TEMP_FAILURE_RETRY(write(fd, buffer, num_bytes));
201}
202
203intptr_t SocketBase::SendTo(intptr_t fd,
204 const void* buffer,
205 intptr_t num_bytes,
206 const RawAddr& addr,
207 SocketOpKind sync) {
208 ASSERT(fd >= 0);
209 ssize_t written_bytes =
210 TEMP_FAILURE_RETRY(sendto(fd, buffer, num_bytes, 0, &addr.addr,
212 ASSERT(EAGAIN == EWOULDBLOCK);
213 if ((sync == kAsync) && (written_bytes == -1) && (errno == EWOULDBLOCK)) {
214 // If the would block we need to retry and therefore return 0 as
215 // the number of bytes written.
216 written_bytes = 0;
217 }
218 return written_bytes;
219}
220
221intptr_t SocketBase::SendMessage(intptr_t fd,
222 void* buffer,
223 size_t num_bytes,
224 SocketControlMessage* messages,
225 intptr_t num_messages,
226 SocketOpKind sync,
227 OSError* p_oserror) {
228 ASSERT(fd >= 0);
229
230 struct iovec iov = {
231 .iov_base = buffer,
232 .iov_len = num_bytes,
233 };
234
235 struct msghdr msg;
236 memset(&msg, 0, sizeof(msg));
237 msg.msg_iov = &iov;
238 msg.msg_iovlen = 1;
239
240 if (messages != nullptr && num_messages > 0) {
241 SocketControlMessage* message = messages;
242 size_t total_length = 0;
243 for (intptr_t i = 0; i < num_messages; i++, message++) {
244 total_length += CMSG_SPACE(message->data_length());
245 }
246
247 uint8_t* control_buffer =
248 reinterpret_cast<uint8_t*>(Dart_ScopeAllocate(total_length));
249 memset(control_buffer, 0, total_length);
250 msg.msg_control = control_buffer;
251 msg.msg_controllen = total_length;
252
253 struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
254 message = messages;
255 for (intptr_t i = 0; i < num_messages;
256 i++, message++, cmsg = CMSG_NXTHDR(&msg, cmsg)) {
257 ASSERT(message->is_file_descriptors_control_message());
258 cmsg->cmsg_level = SOL_SOCKET;
259 cmsg->cmsg_type = SCM_RIGHTS;
260
261 intptr_t data_length = message->data_length();
262 cmsg->cmsg_len = CMSG_LEN(data_length);
263 memmove(CMSG_DATA(cmsg), message->data(), data_length);
264 }
265 msg.msg_controllen = total_length;
266 }
267
268 ssize_t written_bytes = TEMP_FAILURE_RETRY(sendmsg(fd, &msg, 0));
269 ASSERT(EAGAIN == EWOULDBLOCK);
270 if ((sync == kAsync) && (written_bytes == -1) && (errno == EWOULDBLOCK)) {
271 // If the would block we need to retry and therefore return 0 as
272 // the number of bytes written.
273 written_bytes = 0;
274 }
275 if (written_bytes < 0) {
276 p_oserror->Reload();
277 }
278
279 return written_bytes;
280}
281
282bool SocketBase::GetSocketName(intptr_t fd, SocketAddress* p_sa) {
283 ASSERT(fd >= 0);
284 ASSERT(p_sa != nullptr);
285 RawAddr raw;
286 socklen_t size = sizeof(raw);
287 if (NO_RETRY_EXPECTED(getsockname(fd, &raw.addr, &size))) {
288 return false;
289 }
290
291 // sockaddr_un contains sa_family_t sun_family and char[] sun_path.
292 // If size is the size of sa_family_t, this is an unnamed socket and
293 // sun_path contains garbage.
294 new (p_sa) SocketAddress(&raw.addr,
295 /*unnamed_unix_socket=*/size == sizeof(sa_family_t));
296 return true;
297}
298
299intptr_t SocketBase::GetPort(intptr_t fd) {
300 ASSERT(fd >= 0);
301 RawAddr raw;
302 socklen_t size = sizeof(raw);
303 if (NO_RETRY_EXPECTED(getsockname(fd, &raw.addr, &size))) {
304 return 0;
305 }
306 return SocketAddress::GetAddrPort(raw);
307}
308
309SocketAddress* SocketBase::GetRemotePeer(intptr_t fd, intptr_t* port) {
310 ASSERT(fd >= 0);
311 RawAddr raw;
312 socklen_t size = sizeof(raw);
313 if (NO_RETRY_EXPECTED(getpeername(fd, &raw.addr, &size))) {
314 return nullptr;
315 }
316 // sockaddr_un contains sa_family_t sun_family and char[] sun_path.
317 // If size is the size of sa_family_t, this is an unnamed socket and
318 // sun_path contains garbage.
319 if (size == sizeof(sa_family_t)) {
320 *port = 0;
321 return new SocketAddress(&raw.addr, /*unnamed_unix_socket=*/true);
322 }
324 return new SocketAddress(&raw.addr);
325}
326
327intptr_t SocketBase::GetStdioHandle(intptr_t num) {
328 return num;
329}
330
331bool SocketBase::ReverseLookup(const RawAddr& addr,
332 char* host,
333 intptr_t host_len,
334 OSError** os_error) {
335 ASSERT(host_len >= NI_MAXHOST);
336 int status = NO_RETRY_EXPECTED(
337 getnameinfo(&addr.addr, SocketAddress::GetAddrLength(addr), host,
338 host_len, nullptr, 0, NI_NAMEREQD));
339 if (status != 0) {
340 ASSERT(*os_error == nullptr);
341 *os_error =
342 new OSError(status, gai_strerror(status), OSError::kGetAddressInfo);
343 return false;
344 }
345 return true;
346}
347
348bool SocketBase::ParseAddress(int type, const char* address, RawAddr* addr) {
349 int result;
351 result = NO_RETRY_EXPECTED(inet_pton(AF_INET, address, &addr->in.sin_addr));
352 } else {
354 result =
355 NO_RETRY_EXPECTED(inet_pton(AF_INET6, address, &addr->in6.sin6_addr));
356 }
357 return (result == 1);
358}
359
360static bool ShouldIncludeIfaAddrs(struct ifaddrs* ifa, int lookup_family) {
361 if (ifa->ifa_addr == nullptr) {
362 // OpenVPN's virtual device tun0.
363 return false;
364 }
365 int family = ifa->ifa_addr->sa_family;
366 return ((lookup_family == family) ||
367 ((lookup_family == AF_UNSPEC) &&
368 ((family == AF_INET) || (family == AF_INET6))));
369}
370
371AddressList<InterfaceSocketAddress>* SocketBase::ListInterfaces(
372 int type,
373 OSError** os_error) {
374 struct ifaddrs* ifaddr;
375
376 int status = NO_RETRY_EXPECTED(getifaddrs(&ifaddr));
377 if (status != 0) {
378 ASSERT(*os_error == nullptr);
379 *os_error =
380 new OSError(status, gai_strerror(status), OSError::kGetAddressInfo);
381 return nullptr;
382 }
383
384 int lookup_family = SocketAddress::FromType(type);
385
386 intptr_t count = 0;
387 for (struct ifaddrs* ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next) {
388 if (ShouldIncludeIfaAddrs(ifa, lookup_family)) {
389 count++;
390 }
391 }
392
393 AddressList<InterfaceSocketAddress>* addresses =
394 new AddressList<InterfaceSocketAddress>(count);
395 int i = 0;
396 for (struct ifaddrs* ifa = ifaddr; ifa != nullptr; ifa = ifa->ifa_next) {
397 if (ShouldIncludeIfaAddrs(ifa, lookup_family)) {
398 char* ifa_name = DartUtils::ScopedCopyCString(ifa->ifa_name);
399 addresses->SetAt(
400 i, new InterfaceSocketAddress(ifa->ifa_addr, ifa_name,
401 if_nametoindex(ifa->ifa_name)));
402 i++;
403 }
404 }
405 freeifaddrs(ifaddr);
406 return addresses;
407}
408
409void SocketBase::Close(intptr_t fd) {
410 ASSERT(fd >= 0);
411 close(fd);
412}
413
414bool SocketBase::RawAddrToString(RawAddr* addr, char* str) {
415 if (addr->addr.sa_family == AF_INET) {
416 return inet_ntop(AF_INET, &addr->in.sin_addr, str, INET_ADDRSTRLEN) !=
417 nullptr;
418 } else {
419 ASSERT(addr->addr.sa_family == AF_INET6);
420 return inet_ntop(AF_INET6, &addr->in6.sin6_addr, str, INET6_ADDRSTRLEN) !=
421 nullptr;
422 }
423}
424
425bool SocketBase::GetNoDelay(intptr_t fd, bool* enabled) {
426 int on;
427 socklen_t len = sizeof(on);
428 int err = NO_RETRY_EXPECTED(getsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
429 reinterpret_cast<void*>(&on), &len));
430 if (err == 0) {
431 *enabled = (on == 1);
432 }
433 return (err == 0);
434}
435
436bool SocketBase::SetNoDelay(intptr_t fd, bool enabled) {
437 int on = enabled ? 1 : 0;
438 return NO_RETRY_EXPECTED(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY,
439 reinterpret_cast<char*>(&on),
440 sizeof(on))) == 0;
441}
442
443bool SocketBase::GetMulticastLoop(intptr_t fd,
444 intptr_t protocol,
445 bool* enabled) {
446 uint8_t on;
447 socklen_t len = sizeof(on);
448 int level = protocol == SocketAddress::TYPE_IPV4 ? IPPROTO_IP : IPPROTO_IPV6;
449 int optname = protocol == SocketAddress::TYPE_IPV4 ? IP_MULTICAST_LOOP
450 : IPV6_MULTICAST_LOOP;
451 if (NO_RETRY_EXPECTED(getsockopt(fd, level, optname,
452 reinterpret_cast<char*>(&on), &len)) == 0) {
453 *enabled = (on == 1);
454 return true;
455 }
456 return false;
457}
458
459bool SocketBase::GetMulticastHops(intptr_t fd, intptr_t protocol, int* value) {
460 uint8_t v;
461 socklen_t len = sizeof(v);
462 int level = protocol == SocketAddress::TYPE_IPV4 ? IPPROTO_IP : IPPROTO_IPV6;
463 int optname = protocol == SocketAddress::TYPE_IPV4 ? IP_MULTICAST_TTL
464 : IPV6_MULTICAST_HOPS;
465 if (NO_RETRY_EXPECTED(getsockopt(fd, level, optname,
466 reinterpret_cast<char*>(&v), &len)) == 0) {
467 *value = v;
468 return true;
469 }
470 return false;
471}
472
473bool SocketBase::SetMulticastHops(intptr_t fd, intptr_t protocol, int value) {
474 int v = value;
475 int level = protocol == SocketAddress::TYPE_IPV4 ? IPPROTO_IP : IPPROTO_IPV6;
476 int optname = protocol == SocketAddress::TYPE_IPV4 ? IP_MULTICAST_TTL
477 : IPV6_MULTICAST_HOPS;
478 return NO_RETRY_EXPECTED(setsockopt(
479 fd, level, optname, reinterpret_cast<char*>(&v), sizeof(v))) == 0;
480}
481
482bool SocketBase::GetBroadcast(intptr_t fd, bool* enabled) {
483 int on;
484 socklen_t len = sizeof(on);
485 int err = NO_RETRY_EXPECTED(getsockopt(fd, SOL_SOCKET, SO_BROADCAST,
486 reinterpret_cast<char*>(&on), &len));
487 if (err == 0) {
488 *enabled = (on == 1);
489 }
490 return (err == 0);
491}
492
493bool SocketBase::SetBroadcast(intptr_t fd, bool enabled) {
494 int on = enabled ? 1 : 0;
495 return NO_RETRY_EXPECTED(setsockopt(fd, SOL_SOCKET, SO_BROADCAST,
496 reinterpret_cast<char*>(&on),
497 sizeof(on))) == 0;
498}
499
500bool SocketBase::SetOption(intptr_t fd,
501 int level,
502 int option,
503 const char* data,
504 int length) {
505 return NO_RETRY_EXPECTED(setsockopt(fd, level, option, data, length)) == 0;
506}
507
508} // namespace bin
509} // namespace dart
510
511#endif // defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_LINUX) || \
512 // defined(DART_HOST_OS_MACOS)
int count
Definition: FontMgrTest.cpp:50
static bool read(SkStream *stream, void *buffer, size_t amount)
GLenum type
static char * ScopedCopyCString(const char *str)
Definition: dartutils.h:232
static intptr_t AvailableBytes(intptr_t fd)
static bool SetCloseOnExec(intptr_t fd)
static void SaveErrorAndClose(intptr_t fd)
static int16_t FromType(int type)
Definition: socket_base.cc:163
static intptr_t GetAddrLength(const RawAddr &addr, bool unnamed_unix_socket=false)
Definition: socket_base.cc:39
SocketAddress(struct sockaddr *sa, bool unnamed_unix_socket=false)
static intptr_t GetAddrPort(const RawAddr &addr)
Definition: socket_base.cc:187
static bool AvailableDatagram(intptr_t fd, void *buffer, intptr_t num_bytes)
static bool SetMulticastHops(intptr_t fd, intptr_t protocol, int value)
static intptr_t GetStdioHandle(intptr_t num)
static intptr_t ReceiveMessage(intptr_t fd, void *buffer, int64_t *p_buffer_num_bytes, SocketControlMessage **p_messages, SocketOpKind sync, OSError *p_oserror)
static bool SetOption(intptr_t fd, int level, int option, const char *data, int length)
static SocketAddress * GetRemotePeer(intptr_t fd, intptr_t *port)
static bool FormatNumericAddress(const RawAddr &addr, char *address, int len)
static bool SetNoDelay(intptr_t fd, bool enabled)
static bool GetSocketName(intptr_t fd, SocketAddress *p_sa)
static bool ParseAddress(int type, const char *address, RawAddr *addr)
static intptr_t Available(intptr_t fd)
static void Close(intptr_t fd)
static intptr_t RecvFrom(intptr_t fd, void *buffer, intptr_t num_bytes, RawAddr *addr, SocketOpKind sync)
static bool IsBindError(intptr_t error_number)
static intptr_t Read(intptr_t fd, void *buffer, intptr_t num_bytes, SocketOpKind sync)
static bool SetBroadcast(intptr_t fd, bool value)
static bool GetNoDelay(intptr_t fd, bool *enabled)
static bool ReverseLookup(const RawAddr &addr, char *host, intptr_t host_len, OSError **os_error)
static bool Initialize()
static bool RawAddrToString(RawAddr *addr, char *str)
static intptr_t SendTo(intptr_t fd, const void *buffer, intptr_t num_bytes, const RawAddr &addr, SocketOpKind sync)
static bool GetMulticastHops(intptr_t fd, intptr_t protocol, int *value)
static bool GetMulticastLoop(intptr_t fd, intptr_t protocol, bool *enabled)
static intptr_t SendMessage(intptr_t fd, void *buffer, size_t buffer_num_bytes, SocketControlMessage *messages, intptr_t num_messages, SocketOpKind sync, OSError *p_oserror)
static AddressList< InterfaceSocketAddress > * ListInterfaces(int type, OSError **os_error)
static bool GetBroadcast(intptr_t fd, bool *value)
static intptr_t GetPort(intptr_t fd)
#define ASSERT(E)
FlutterSemanticsFlag flags
uint8_t value
GAsyncResult * result
size_t length
Win32Message message
Definition: dart_vm.cc:33
DART_EXPORT uint8_t * Dart_ScopeAllocate(intptr_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 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 host
Definition: switches.h:74
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
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
Definition: switches.h:259
#define NO_RETRY_EXPECTED(expression)
#define TEMP_FAILURE_RETRY(expression)
void write(SkWStream *wStream, const T &text)
Definition: skqp.cpp:188