Chromium Code Reviews| 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_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "bin/eventhandler.h" | 8 #include "bin/eventhandler.h" |
| 9 | 9 |
| 10 #include <process.h> // NOLINT | 10 #include <process.h> // NOLINT |
| 11 #include <winsock2.h> // NOLINT | 11 #include <winsock2.h> // NOLINT |
| 12 #include <ws2tcpip.h> // NOLINT | 12 #include <ws2tcpip.h> // NOLINT |
| 13 #include <mswsock.h> // NOLINT | 13 #include <mswsock.h> // NOLINT |
| 14 #include <io.h> // NOLINT | |
| 15 #include <fcntl.h> // NOLINT | |
| 14 | 16 |
| 15 #include "bin/builtin.h" | 17 #include "bin/builtin.h" |
| 16 #include "bin/dartutils.h" | 18 #include "bin/dartutils.h" |
| 17 #include "bin/log.h" | 19 #include "bin/log.h" |
| 18 #include "bin/socket.h" | 20 #include "bin/socket.h" |
| 19 #include "bin/utils.h" | 21 #include "bin/utils.h" |
| 20 #include "platform/thread.h" | 22 #include "platform/thread.h" |
| 21 | 23 |
| 22 | 24 |
| 23 namespace dart { | 25 namespace dart { |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 CreateCompletionPort(event_handler_->completion_port()); | 321 CreateCompletionPort(event_handler_->completion_port()); |
| 320 } | 322 } |
| 321 } | 323 } |
| 322 | 324 |
| 323 | 325 |
| 324 bool FileHandle::IsClosed() { | 326 bool FileHandle::IsClosed() { |
| 325 return false; | 327 return false; |
| 326 } | 328 } |
| 327 | 329 |
| 328 | 330 |
| 331 void FileHandle::DoClose() { | |
| 332 if (GetStdHandle(STD_OUTPUT_HANDLE) == handle_) { | |
| 333 int fd = _open("NUL", _O_WRONLY); | |
|
kustermann
2013/06/28 10:10:14
Is this opening a file called "NUL" or an actual /
Anders Johnsen
2013/06/28 10:19:11
Yep, check out http://en.wikipedia.org/wiki/%5CDev
| |
| 334 ASSERT(fd >= 0); | |
| 335 USE(_dup2(fd, _fileno(stdout))); | |
| 336 USE(close(fd)); | |
|
kustermann
2013/06/28 10:10:14
AFAIK USE() is not necessary here.
USE() is useful
Anders Johnsen
2013/06/28 10:19:11
I think you are right. Will try without.
| |
| 337 } else { | |
| 338 Handle::DoClose(); | |
| 339 } | |
| 340 } | |
| 341 | |
| 342 | |
| 329 void SocketHandle::HandleIssueError() { | 343 void SocketHandle::HandleIssueError() { |
| 330 int error = WSAGetLastError(); | 344 int error = WSAGetLastError(); |
| 331 if (error == WSAECONNRESET) { | 345 if (error == WSAECONNRESET) { |
| 332 event_handler_->HandleClosed(this); | 346 event_handler_->HandleClosed(this); |
| 333 } else { | 347 } else { |
| 334 event_handler_->HandleError(this); | 348 event_handler_->HandleError(this); |
| 335 } | 349 } |
| 336 WSASetLastError(error); | 350 WSASetLastError(error); |
| 337 } | 351 } |
| 338 | 352 |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1001 | 1015 |
| 1002 | 1016 |
| 1003 void EventHandlerImplementation::Shutdown() { | 1017 void EventHandlerImplementation::Shutdown() { |
| 1004 SendData(kShutdownId, 0, 0); | 1018 SendData(kShutdownId, 0, 0); |
| 1005 } | 1019 } |
| 1006 | 1020 |
| 1007 } // namespace bin | 1021 } // namespace bin |
| 1008 } // namespace dart | 1022 } // namespace dart |
| 1009 | 1023 |
| 1010 #endif // defined(TARGET_OS_WINDOWS) | 1024 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |