| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <magenta/syscalls.h> | 9 #include <magenta/syscalls.h> |
| 10 #include <magenta/types.h> | 10 #include <magenta/types.h> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 char error_buf[kBufferSize]; | 33 char error_buf[kBufferSize]; |
| 34 SetMessage(Utils::StrError(code, error_buf, kBufferSize)); | 34 SetMessage(Utils::StrError(code, error_buf, kBufferSize)); |
| 35 } else if (sub_system == kGetAddressInfo) { | 35 } else if (sub_system == kGetAddressInfo) { |
| 36 UNIMPLEMENTED(); | 36 UNIMPLEMENTED(); |
| 37 } else { | 37 } else { |
| 38 UNREACHABLE(); | 38 UNREACHABLE(); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 | 42 |
| 43 const char* StringUtils::ConsoleStringToUtf8( | 43 const char* StringUtils::ConsoleStringToUtf8(const char* str, |
| 44 const char* str, intptr_t len, intptr_t* result_len) { | 44 intptr_t len, |
| 45 intptr_t* result_len) { |
| 45 UNIMPLEMENTED(); | 46 UNIMPLEMENTED(); |
| 46 return NULL; | 47 return NULL; |
| 47 } | 48 } |
| 48 | 49 |
| 49 | 50 |
| 50 const char* StringUtils::Utf8ToConsoleString( | 51 const char* StringUtils::Utf8ToConsoleString(const char* utf8, |
| 51 const char* utf8, intptr_t len, intptr_t* result_len) { | 52 intptr_t len, |
| 53 intptr_t* result_len) { |
| 52 UNIMPLEMENTED(); | 54 UNIMPLEMENTED(); |
| 53 return NULL; | 55 return NULL; |
| 54 } | 56 } |
| 55 | 57 |
| 56 | 58 |
| 57 char* StringUtils::ConsoleStringToUtf8( | 59 char* StringUtils::ConsoleStringToUtf8(char* str, |
| 58 char* str, intptr_t len, intptr_t* result_len) { | 60 intptr_t len, |
| 61 intptr_t* result_len) { |
| 59 UNIMPLEMENTED(); | 62 UNIMPLEMENTED(); |
| 60 return NULL; | 63 return NULL; |
| 61 } | 64 } |
| 62 | 65 |
| 63 | 66 |
| 64 char* StringUtils::Utf8ToConsoleString( | 67 char* StringUtils::Utf8ToConsoleString(char* utf8, |
| 65 char* utf8, intptr_t len, intptr_t* result_len) { | 68 intptr_t len, |
| 69 intptr_t* result_len) { |
| 66 UNIMPLEMENTED(); | 70 UNIMPLEMENTED(); |
| 67 return NULL; | 71 return NULL; |
| 68 } | 72 } |
| 69 | 73 |
| 70 | 74 |
| 71 char* StringUtils::StrNDup(const char* s, intptr_t n) { | 75 char* StringUtils::StrNDup(const char* s, intptr_t n) { |
| 72 return strndup(s, n); | 76 return strndup(s, n); |
| 73 } | 77 } |
| 74 | 78 |
| 75 | 79 |
| 76 bool ShellUtils::GetUtf8Argv(int argc, char** argv) { | 80 bool ShellUtils::GetUtf8Argv(int argc, char** argv) { |
| 77 return false; | 81 return false; |
| 78 } | 82 } |
| 79 | 83 |
| 80 | 84 |
| 81 void TimerUtils::InitOnce() { | 85 void TimerUtils::InitOnce() {} |
| 82 } | |
| 83 | 86 |
| 84 | 87 |
| 85 int64_t TimerUtils::GetCurrentMonotonicMillis() { | 88 int64_t TimerUtils::GetCurrentMonotonicMillis() { |
| 86 return GetCurrentMonotonicMicros() / 1000; | 89 return GetCurrentMonotonicMicros() / 1000; |
| 87 } | 90 } |
| 88 | 91 |
| 89 | 92 |
| 90 int64_t TimerUtils::GetCurrentMonotonicMicros() { | 93 int64_t TimerUtils::GetCurrentMonotonicMicros() { |
| 91 int64_t ticks = mx_time_get(MX_CLOCK_MONOTONIC); | 94 int64_t ticks = mx_time_get(MX_CLOCK_MONOTONIC); |
| 92 return ticks / kNanosecondsPerMicrosecond; | 95 return ticks / kNanosecondsPerMicrosecond; |
| 93 } | 96 } |
| 94 | 97 |
| 95 | 98 |
| 96 void TimerUtils::Sleep(int64_t millis) { | 99 void TimerUtils::Sleep(int64_t millis) { |
| 97 mx_nanosleep( | 100 mx_nanosleep(millis * kMicrosecondsPerMillisecond * |
| 98 millis * kMicrosecondsPerMillisecond * kNanosecondsPerMicrosecond); | 101 kNanosecondsPerMicrosecond); |
| 99 } | 102 } |
| 100 | 103 |
| 101 } // namespace bin | 104 } // namespace bin |
| 102 } // namespace dart | 105 } // namespace dart |
| 103 | 106 |
| 104 #endif // defined(TARGET_OS_FUCHSIA) | 107 #endif // defined(TARGET_OS_FUCHSIA) |
| OLD | NEW |