Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
utils_fuchsia.cc
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#include "platform/globals.h"
6#if defined(DART_HOST_OS_FUCHSIA)
7
8#include <errno.h>
9#include <zircon/syscalls.h>
10#include <zircon/types.h>
11
12#include "bin/utils.h"
13#include "platform/assert.h"
14#include "platform/utils.h"
15
16namespace dart {
17namespace bin {
18
19OSError::OSError() : sub_system_(kSystem), code_(0), message_(nullptr) {
20 Reload();
21}
22
23void OSError::Reload() {
24 SetCodeAndMessage(kSystem, errno);
25}
26
27void OSError::SetCodeAndMessage(SubSystem sub_system, int code) {
28 set_sub_system(sub_system);
29 set_code(code);
30 if (sub_system == kSystem) {
31 const int kBufferSize = 1024;
32 char error_buf[kBufferSize];
33 SetMessage(Utils::StrError(code, error_buf, kBufferSize));
34 } else if (sub_system == kGetAddressInfo) {
36 } else {
38 }
39}
40
41const char* StringUtils::ConsoleStringToUtf8(const char* str,
42 intptr_t len,
43 intptr_t* result_len) {
44 return nullptr;
45}
46
47const char* StringUtils::Utf8ToConsoleString(const char* utf8,
48 intptr_t len,
49 intptr_t* result_len) {
50 return nullptr;
51}
52
53char* StringUtils::ConsoleStringToUtf8(char* str,
54 intptr_t len,
55 intptr_t* result_len) {
56 return nullptr;
57}
58
59char* StringUtils::Utf8ToConsoleString(char* utf8,
60 intptr_t len,
61 intptr_t* result_len) {
62 return nullptr;
63}
64
65bool ShellUtils::GetUtf8Argv(int argc, char** argv) {
66 return false;
67}
68
69void TimerUtils::InitOnce() {}
70
71int64_t TimerUtils::GetCurrentMonotonicMillis() {
72 return GetCurrentMonotonicMicros() / 1000;
73}
74
75int64_t TimerUtils::GetCurrentMonotonicMicros() {
76 zx_time_t ticks = zx_clock_get_monotonic();
77 return ticks / kNanosecondsPerMicrosecond;
78}
79
80void TimerUtils::Sleep(int64_t millis) {
81 zx_nanosleep(zx_deadline_after(millis * kMicrosecondsPerMillisecond *
82 kNanosecondsPerMicrosecond));
83}
84
85} // namespace bin
86} // namespace dart
87
88#endif // defined(DART_HOST_OS_FUCHSIA)
static const size_t kBufferSize
Definition SkString.cpp:27
#define UNREACHABLE()
Definition assert.h:248
#define UNIMPLEMENTED
constexpr uint64_t kMicrosecondsPerMillisecond
constexpr intptr_t kNanosecondsPerMicrosecond
Definition globals.h:564