Flutter Engine
The Flutter Engine
utils_fuchsia.h
Go to the documentation of this file.
1// Copyright (c) 2016, 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_PLATFORM_UTILS_FUCHSIA_H_
6#define RUNTIME_PLATFORM_UTILS_FUCHSIA_H_
7
8#include <endian.h>
9#include <memory>
10
11namespace sys {
12
13// From Fuchsia SDK.
15
16} // namespace sys
17
18namespace inspect {
19
20// From Fuchsia SDK.
21class Node;
22
23} // namespace inspect
24
25namespace dart {
26
27inline uint16_t Utils::HostToBigEndian16(uint16_t value) {
28 return htobe16(value);
29}
30
31inline uint32_t Utils::HostToBigEndian32(uint32_t value) {
32 return htobe32(value);
33}
34
35inline uint64_t Utils::HostToBigEndian64(uint64_t value) {
36 return htobe64(value);
37}
38
39inline uint16_t Utils::HostToLittleEndian16(uint16_t value) {
40 return htole16(value);
41}
42
43inline uint32_t Utils::HostToLittleEndian32(uint32_t value) {
44 return htole32(value);
45}
46
47inline uint64_t Utils::HostToLittleEndian64(uint64_t value) {
48 return htole64(value);
49}
50
51inline char* Utils::StrError(int err, char* buffer, size_t bufsize) {
52 if (strerror_r(err, buffer, bufsize) != 0) {
53 snprintf(buffer, bufsize, "%s", "strerror_r failed");
54 }
55 return buffer;
56}
57
58// Returns the singleton component context for this process.
59//
60// The returned pointer is never null. The caller must not take ownership of
61// the context.
62//
63// The context is a singleton as it can be meaningfully instantiated only once
64// during the lifetime of the program. If you use this function, you MUST NOT
65// call sys::ComponentContext::Create().
67
68// Sets the inspect node set to be used in the dart vm
69//
70// This method will take ownership of the node
71void SetDartVmNode(std::unique_ptr<inspect::Node> node);
72
73// Returns the inspect node set in SetDartVmNode().
74//
75// The caller should take ownership of the returned node because
76// the value will be set to null after this call.
77// This call may return null if no node is provided.
78std::unique_ptr<inspect::Node> TakeDartVmNode();
79
80} // namespace dart
81
82#endif // RUNTIME_PLATFORM_UTILS_FUCHSIA_H_
static uint64_t HostToBigEndian64(uint64_t host_value)
Definition: utils_android.h:24
static uint64_t HostToLittleEndian64(uint64_t host_value)
Definition: utils_android.h:36
static uint16_t HostToLittleEndian16(uint16_t host_value)
Definition: utils_android.h:28
static char * StrError(int err, char *buffer, size_t bufsize)
Definition: utils_android.h:40
static uint32_t HostToLittleEndian32(uint32_t host_value)
Definition: utils_android.h:32
static uint16_t HostToBigEndian16(uint16_t host_value)
Definition: utils_android.h:16
static uint32_t HostToBigEndian32(uint32_t host_value)
Definition: utils_android.h:20
uint8_t value
Definition: dart.idl:29
Definition: dart_vm.cc:33
void SetDartVmNode(std::unique_ptr< inspect::Node > node)
sys::ComponentContext * ComponentContext()
std::unique_ptr< inspect::Node > TakeDartVmNode()
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