Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 void FileHandle::EnsureInitialized(EventHandlerImplementation* event_handler) { | 317 void FileHandle::EnsureInitialized(EventHandlerImplementation* event_handler) { |
| 318 ScopedLock lock(this); | 318 ScopedLock lock(this); |
| 319 event_handler_ = event_handler; | 319 event_handler_ = event_handler; |
| 320 if (SupportsOverlappedIO() && completion_port_ == INVALID_HANDLE_VALUE) { | 320 if (SupportsOverlappedIO() && completion_port_ == INVALID_HANDLE_VALUE) { |
| 321 CreateCompletionPort(event_handler_->completion_port()); | 321 CreateCompletionPort(event_handler_->completion_port()); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 | 324 |
| 325 | 325 |
| 326 bool FileHandle::IsClosed() { | 326 bool FileHandle::IsClosed() { |
| 327 return IsClosing(); | 327 return IsClosing() && !HasPendingRead(); |
|
kustermann
2013/07/19 16:56:24
Do we need a 'HasPendingWrite()' here as well?
Anders Johnsen
2013/07/19 17:03:39
While I convinced myself that FileHandles never wo
| |
| 328 } | 328 } |
| 329 | 329 |
| 330 | 330 |
| 331 void FileHandle::DoClose() { | 331 void FileHandle::DoClose() { |
| 332 if (GetStdHandle(STD_OUTPUT_HANDLE) == handle_) { | 332 if (GetStdHandle(STD_OUTPUT_HANDLE) == handle_) { |
| 333 int fd = _open("NUL", _O_WRONLY); | 333 int fd = _open("NUL", _O_WRONLY); |
| 334 ASSERT(fd >= 0); | 334 ASSERT(fd >= 0); |
| 335 _dup2(fd, _fileno(stdout)); | 335 _dup2(fd, _fileno(stdout)); |
| 336 close(fd); | 336 close(fd); |
| 337 } else { | 337 } else { |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1009 | 1009 |
| 1010 | 1010 |
| 1011 void EventHandlerImplementation::Shutdown() { | 1011 void EventHandlerImplementation::Shutdown() { |
| 1012 SendData(kShutdownId, 0, 0); | 1012 SendData(kShutdownId, 0, 0); |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 } // namespace bin | 1015 } // namespace bin |
| 1016 } // namespace dart | 1016 } // namespace dart |
| 1017 | 1017 |
| 1018 #endif // defined(TARGET_OS_WINDOWS) | 1018 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |