| 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_PLATFORM_H_ | 5 #ifndef BIN_PLATFORM_H_ |
| 6 #define BIN_PLATFORM_H_ | 6 #define BIN_PLATFORM_H_ |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "platform/globals.h" |
| 9 | 10 |
| 10 namespace dart { | 11 namespace dart { |
| 11 namespace bin { | 12 namespace bin { |
| 12 | 13 |
| 13 class Platform { | 14 class Platform { |
| 14 public: | 15 public: |
| 15 // Perform platform specific initialization. | 16 // Perform platform specific initialization. |
| 16 static bool Initialize(); | 17 static bool Initialize(); |
| 17 | 18 |
| 18 // Returns the number of processors on the machine. | 19 // Returns the number of processors on the machine. |
| 19 static int NumberOfProcessors(); | 20 static int NumberOfProcessors(); |
| 20 | 21 |
| 21 // Returns a string representing the operating system ("linux", | 22 // Returns a string representing the operating system ("linux", |
| 22 // "macos" or "windows"). The returned string should not be | 23 // "macos", "windows", or "android"). The returned string should not be |
| 23 // deallocated by the caller. | 24 // deallocated by the caller. |
| 24 static const char* OperatingSystem(); | 25 static const char* OperatingSystem(); |
| 25 | 26 |
| 27 // Returns the architecture name of the processor the VM is running on |
| 28 // (ia32, x64, arm, arm64, or mips). |
| 29 static const char* HostArchitecture() { |
| 30 #if defined(HOST_ARCH_ARM) |
| 31 return "arm"; |
| 32 #elif defined(HOST_ARCH_ARM64) |
| 33 return "arm64"; |
| 34 #elif defined(HOST_ARCH_IA32) |
| 35 return "ia32"; |
| 36 #elif defined(HOST_ARCH_MIPS) |
| 37 return "mips"; |
| 38 #elif defined(HOST_ARCH_X64) |
| 39 return "x64"; |
| 40 #else |
| 41 #error Architecture detection failed. |
| 42 #endif |
| 43 } |
| 44 |
| 45 static const char* LibraryPrefix(); |
| 46 |
| 26 // Returns a string representing the operating system's shared library | 47 // Returns a string representing the operating system's shared library |
| 27 // extension (e.g. 'so', 'dll', ...). The returned string should not be | 48 // extension (e.g. 'so', 'dll', ...). The returned string should not be |
| 28 // deallocated by the caller. | 49 // deallocated by the caller. |
| 29 static const char* LibraryExtension(); | 50 static const char* LibraryExtension(); |
| 30 | 51 |
| 31 // Extracts the local hostname. | 52 // Extracts the local hostname. |
| 32 static bool LocalHostname(char* buffer, intptr_t buffer_length); | 53 static bool LocalHostname(char* buffer, intptr_t buffer_length); |
| 33 | 54 |
| 34 // Extracts the environment variables for the current process. The array of | 55 // Extracts the environment variables for the current process. The array of |
| 35 // strings is Dart_ScopeAllocated. The number of elements in the array is | 56 // strings is Dart_ScopeAllocated. The number of elements in the array is |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 static char** argv_; // VM flags are argv_[1 ... script_index_ - 1] | 98 static char** argv_; // VM flags are argv_[1 ... script_index_ - 1] |
| 78 | 99 |
| 79 DISALLOW_ALLOCATION(); | 100 DISALLOW_ALLOCATION(); |
| 80 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); | 101 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); |
| 81 }; | 102 }; |
| 82 | 103 |
| 83 } // namespace bin | 104 } // namespace bin |
| 84 } // namespace dart | 105 } // namespace dart |
| 85 | 106 |
| 86 #endif // BIN_PLATFORM_H_ | 107 #endif // BIN_PLATFORM_H_ |
| OLD | NEW |