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 #ifndef BIN_UTILS_H_ | 5 #ifndef BIN_UTILS_H_ |
6 #define BIN_UTILS_H_ | 6 #define BIN_UTILS_H_ |
7 | 7 |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
11 #include "include/dart_api.h" | 11 #include "include/dart_api.h" |
12 #include "platform/globals.h" | 12 #include "platform/globals.h" |
13 | 13 |
14 | 14 |
15 namespace dart { | 15 namespace dart { |
16 namespace bin { | 16 namespace bin { |
17 | 17 |
18 class OSError { | 18 class OSError { |
19 public: | 19 public: |
20 enum SubSystem { | 20 enum SubSystem { |
21 kSystem, | 21 kSystem, |
22 kGetAddressInfo, | 22 kGetAddressInfo, |
23 kNSS, | 23 kBoringSSL, |
24 kUnknown = -1 | 24 kUnknown = -1 |
25 }; | 25 }; |
26 | 26 |
27 OSError(); | 27 OSError(); |
28 OSError(int code, const char* message, SubSystem sub_system) { | 28 OSError(int code, const char* message, SubSystem sub_system) { |
29 sub_system_ = sub_system; | 29 sub_system_ = sub_system; |
30 code_ = code; | 30 code_ = code; |
31 message_ = NULL; // SetMessage will free existing message. | 31 message_ = NULL; // SetMessage will free existing message. |
32 SetMessage(message); | 32 SetMessage(message); |
33 } | 33 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 public: | 101 public: |
102 static int64_t GetCurrentTimeMicros(); | 102 static int64_t GetCurrentTimeMicros(); |
103 static int64_t GetCurrentTimeMilliseconds(); | 103 static int64_t GetCurrentTimeMilliseconds(); |
104 static void Sleep(int64_t millis); | 104 static void Sleep(int64_t millis); |
105 }; | 105 }; |
106 | 106 |
107 } // namespace bin | 107 } // namespace bin |
108 } // namespace dart | 108 } // namespace dart |
109 | 109 |
110 #endif // BIN_UTILS_H_ | 110 #endif // BIN_UTILS_H_ |
OLD | NEW |