| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 7 | 7 |
| 8 #include <errno.h> // NOLINT | 8 #include <errno.h> // NOLINT |
| 9 #include <netdb.h> // NOLINT | 9 #include <netdb.h> // NOLINT |
| 10 #include <sys/time.h> // NOLINT | 10 #include <sys/time.h> // NOLINT |
| 11 #include <time.h> // NOLINT | 11 #include <time.h> // NOLINT |
| 12 | 12 |
| 13 #include "bin/utils.h" | 13 #include "bin/utils.h" |
| 14 #include "platform/assert.h" | 14 #include "platform/assert.h" |
| 15 #include "platform/utils.h" | 15 #include "platform/utils.h" |
| 16 | 16 |
| 17 namespace dart { | 17 namespace dart { |
| 18 namespace bin { | 18 namespace bin { |
| 19 | 19 |
| 20 OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { | 20 OSError::OSError() : sub_system_(kSystem), code_(0), message_(NULL) { |
| 21 set_sub_system(kSystem); | 21 set_sub_system(kSystem); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 Utils::StrError(code, error_message, kBufferSize); | 36 Utils::StrError(code, error_message, kBufferSize); |
| 37 SetMessage(error_message); | 37 SetMessage(error_message); |
| 38 } else if (sub_system == kGetAddressInfo) { | 38 } else if (sub_system == kGetAddressInfo) { |
| 39 SetMessage(gai_strerror(code)); | 39 SetMessage(gai_strerror(code)); |
| 40 } else { | 40 } else { |
| 41 UNREACHABLE(); | 41 UNREACHABLE(); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 | 45 |
| 46 const char* StringUtils::ConsoleStringToUtf8( | 46 const char* StringUtils::ConsoleStringToUtf8(const char* str, |
| 47 const char* str, intptr_t len, intptr_t* result_len) { | 47 intptr_t len, |
| 48 intptr_t* result_len) { |
| 48 UNIMPLEMENTED(); | 49 UNIMPLEMENTED(); |
| 49 return NULL; | 50 return NULL; |
| 50 } | 51 } |
| 51 | 52 |
| 52 | 53 |
| 53 const char* StringUtils::Utf8ToConsoleString( | 54 const char* StringUtils::Utf8ToConsoleString(const char* utf8, |
| 54 const char* utf8, intptr_t len, intptr_t* result_len) { | 55 intptr_t len, |
| 56 intptr_t* result_len) { |
| 55 UNIMPLEMENTED(); | 57 UNIMPLEMENTED(); |
| 56 return NULL; | 58 return NULL; |
| 57 } | 59 } |
| 58 | 60 |
| 59 | 61 |
| 60 char* StringUtils::ConsoleStringToUtf8( | 62 char* StringUtils::ConsoleStringToUtf8(char* str, |
| 61 char* str, intptr_t len, intptr_t* result_len) { | 63 intptr_t len, |
| 64 intptr_t* result_len) { |
| 62 UNIMPLEMENTED(); | 65 UNIMPLEMENTED(); |
| 63 return NULL; | 66 return NULL; |
| 64 } | 67 } |
| 65 | 68 |
| 66 | 69 |
| 67 char* StringUtils::Utf8ToConsoleString( | 70 char* StringUtils::Utf8ToConsoleString(char* utf8, |
| 68 char* utf8, intptr_t len, intptr_t* result_len) { | 71 intptr_t len, |
| 72 intptr_t* result_len) { |
| 69 UNIMPLEMENTED(); | 73 UNIMPLEMENTED(); |
| 70 return NULL; | 74 return NULL; |
| 71 } | 75 } |
| 72 | 76 |
| 73 | 77 |
| 74 char* StringUtils::StrNDup(const char* s, intptr_t n) { | 78 char* StringUtils::StrNDup(const char* s, intptr_t n) { |
| 75 return strndup(s, n); | 79 return strndup(s, n); |
| 76 } | 80 } |
| 77 | 81 |
| 78 | 82 |
| 79 bool ShellUtils::GetUtf8Argv(int argc, char** argv) { | 83 bool ShellUtils::GetUtf8Argv(int argc, char** argv) { |
| 80 return false; | 84 return false; |
| 81 } | 85 } |
| 82 | 86 |
| 83 | 87 |
| 84 void TimerUtils::InitOnce() { | 88 void TimerUtils::InitOnce() {} |
| 85 } | |
| 86 | 89 |
| 87 | 90 |
| 88 int64_t TimerUtils::GetCurrentMonotonicMillis() { | 91 int64_t TimerUtils::GetCurrentMonotonicMillis() { |
| 89 return GetCurrentMonotonicMicros() / 1000; | 92 return GetCurrentMonotonicMicros() / 1000; |
| 90 } | 93 } |
| 91 | 94 |
| 92 | 95 |
| 93 int64_t TimerUtils::GetCurrentMonotonicMicros() { | 96 int64_t TimerUtils::GetCurrentMonotonicMicros() { |
| 94 struct timespec ts; | 97 struct timespec ts; |
| 95 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { | 98 if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 122 ASSERT(errno == EINTR); | 125 ASSERT(errno == EINTR); |
| 123 // Copy remainder into requested and repeat. | 126 // Copy remainder into requested and repeat. |
| 124 req = rem; | 127 req = rem; |
| 125 } | 128 } |
| 126 } | 129 } |
| 127 | 130 |
| 128 } // namespace bin | 131 } // namespace bin |
| 129 } // namespace dart | 132 } // namespace dart |
| 130 | 133 |
| 131 #endif // defined(TARGET_OS_ANDROID) | 134 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |