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(HOST_OS_WINDOWS) | 6 #if defined(HOST_OS_WINDOWS) |
7 | 7 |
8 #include "bin/platform.h" | 8 #include "bin/platform.h" |
9 | 9 |
10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
11 | 11 |
12 #include "bin/file.h" | 12 #include "bin/file.h" |
13 #include "bin/lockers.h" | 13 #include "bin/lockers.h" |
14 #include "bin/log.h" | 14 #include "bin/log.h" |
15 #if !defined(DART_IO_DISABLED) && !defined(PLATFORM_DISABLE_SOCKET) | 15 #if !defined(PLATFORM_DISABLE_SOCKET) |
16 #include "bin/socket.h" | 16 #include "bin/socket.h" |
17 #endif | 17 #endif |
18 #include "bin/thread.h" | 18 #include "bin/thread.h" |
19 #include "bin/utils.h" | 19 #include "bin/utils.h" |
20 #include "bin/utils_win.h" | 20 #include "bin/utils_win.h" |
21 | 21 |
22 // These are not always defined in the header files. See: | 22 // These are not always defined in the header files. See: |
23 // https://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).as
px | 23 // https://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).as
px |
24 #ifndef ENABLE_VIRTUAL_TERMINAL_INPUT | 24 #ifndef ENABLE_VIRTUAL_TERMINAL_INPUT |
25 #define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200 | 25 #define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 const char* Platform::LocaleName() { | 224 const char* Platform::LocaleName() { |
225 wchar_t locale_name[LOCALE_NAME_MAX_LENGTH]; | 225 wchar_t locale_name[LOCALE_NAME_MAX_LENGTH]; |
226 int result = GetUserDefaultLocaleName(locale_name, LOCALE_NAME_MAX_LENGTH); | 226 int result = GetUserDefaultLocaleName(locale_name, LOCALE_NAME_MAX_LENGTH); |
227 if (result == 0) { | 227 if (result == 0) { |
228 return NULL; | 228 return NULL; |
229 } | 229 } |
230 return StringUtilsWin::WideToUtf8(locale_name); | 230 return StringUtilsWin::WideToUtf8(locale_name); |
231 } | 231 } |
232 | 232 |
233 bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { | 233 bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { |
234 #if defined(DART_IO_DISABLED) || defined(PLATFORM_DISABLE_SOCKET) | 234 #if defined(PLATFORM_DISABLE_SOCKET) |
235 return false; | 235 return false; |
236 #else | 236 #else |
237 if (!SocketBase::Initialize()) { | 237 if (!SocketBase::Initialize()) { |
238 return false; | 238 return false; |
239 } | 239 } |
240 return gethostname(buffer, buffer_length) == 0; | 240 return gethostname(buffer, buffer_length) == 0; |
241 #endif | 241 #endif |
242 } | 242 } |
243 | 243 |
244 char** Platform::Environment(intptr_t* count) { | 244 char** Platform::Environment(intptr_t* count) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 PlatformWin::RestoreConsole(); | 304 PlatformWin::RestoreConsole(); |
305 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 305 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
306 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 306 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
307 ::ExitProcess(exit_code); | 307 ::ExitProcess(exit_code); |
308 } | 308 } |
309 | 309 |
310 } // namespace bin | 310 } // namespace bin |
311 } // namespace dart | 311 } // namespace dart |
312 | 312 |
313 #endif // defined(HOST_OS_WINDOWS) | 313 #endif // defined(HOST_OS_WINDOWS) |
OLD | NEW |