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 <winsock2.h> // NOLINT | 10 #include <winsock2.h> // NOLINT |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 703 | 703 |
| 704 write_thread_exists_ = false; | 704 write_thread_exists_ = false; |
| 705 write_monitor_->Notify(); | 705 write_monitor_->Notify(); |
| 706 write_monitor_->Exit(); | 706 write_monitor_->Exit(); |
| 707 } | 707 } |
| 708 | 708 |
| 709 | 709 |
| 710 void StdHandle::WriteSyncCompleteAsync() { | 710 void StdHandle::WriteSyncCompleteAsync() { |
| 711 ASSERT(pending_write_ != NULL); | 711 ASSERT(pending_write_ != NULL); |
| 712 | 712 |
| 713 DWORD bytes_written = -1; | 713 DWORD bytes_written = -1; |
|
Ivan Posva
2015/01/06 23:27:45
Interestingly this was not being warned about befo
| |
| 714 BOOL ok = WriteFile(handle_, | 714 BOOL ok = WriteFile(handle_, |
| 715 pending_write_->GetBufferStart(), | 715 pending_write_->GetBufferStart(), |
| 716 pending_write_->GetBufferSize(), | 716 pending_write_->GetBufferSize(), |
| 717 &bytes_written, | 717 &bytes_written, |
| 718 NULL); | 718 NULL); |
| 719 if (!ok) { | 719 if (!ok) { |
| 720 bytes_written = 0; | 720 bytes_written = 0; |
| 721 } | 721 } |
| 722 thread_wrote_ += bytes_written; | 722 thread_wrote_ += bytes_written; |
| 723 OVERLAPPED* overlapped = pending_write_->GetCleanOverlapped(); | 723 OVERLAPPED* overlapped = pending_write_->GetCleanOverlapped(); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 | 957 |
| 958 bool DatagramSocket::IssueRecvFrom() { | 958 bool DatagramSocket::IssueRecvFrom() { |
| 959 ScopedLock lock(this); | 959 ScopedLock lock(this); |
| 960 ASSERT(completion_port_ != INVALID_HANDLE_VALUE); | 960 ASSERT(completion_port_ != INVALID_HANDLE_VALUE); |
| 961 ASSERT(pending_read_ == NULL); | 961 ASSERT(pending_read_ == NULL); |
| 962 | 962 |
| 963 OverlappedBuffer* buffer = OverlappedBuffer::AllocateRecvFromBuffer(1024); | 963 OverlappedBuffer* buffer = OverlappedBuffer::AllocateRecvFromBuffer(1024); |
| 964 | 964 |
| 965 DWORD flags; | 965 DWORD flags; |
| 966 flags = 0; | 966 flags = 0; |
| 967 int len; | |
| 968 int rc = WSARecvFrom(socket(), | 967 int rc = WSARecvFrom(socket(), |
| 969 buffer->GetWASBUF(), | 968 buffer->GetWASBUF(), |
| 970 1, | 969 1, |
| 971 NULL, | 970 NULL, |
| 972 &flags, | 971 &flags, |
| 973 buffer->from(), | 972 buffer->from(), |
| 974 buffer->from_len_addr(), | 973 buffer->from_len_addr(), |
| 975 buffer->GetCleanOverlapped(), | 974 buffer->GetCleanOverlapped(), |
| 976 NULL); | 975 NULL); |
| 977 if (rc == NO_ERROR || WSAGetLastError() == WSA_IO_PENDING) { | 976 if (rc == NO_ERROR || WSAGetLastError() == WSA_IO_PENDING) { |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1246 HandleConnect(client_socket, bytes, buffer); | 1245 HandleConnect(client_socket, bytes, buffer); |
| 1247 break; | 1246 break; |
| 1248 } | 1247 } |
| 1249 default: | 1248 default: |
| 1250 UNREACHABLE(); | 1249 UNREACHABLE(); |
| 1251 } | 1250 } |
| 1252 } | 1251 } |
| 1253 | 1252 |
| 1254 | 1253 |
| 1255 EventHandlerImplementation::EventHandlerImplementation() { | 1254 EventHandlerImplementation::EventHandlerImplementation() { |
| 1256 intptr_t result; | |
| 1257 completion_port_ = | 1255 completion_port_ = |
| 1258 CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, NULL, 1); | 1256 CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, NULL, 1); |
| 1259 if (completion_port_ == NULL) { | 1257 if (completion_port_ == NULL) { |
| 1260 FATAL("Completion port creation failed"); | 1258 FATAL("Completion port creation failed"); |
| 1261 } | 1259 } |
| 1262 shutdown_ = false; | 1260 shutdown_ = false; |
| 1263 } | 1261 } |
| 1264 | 1262 |
| 1265 | 1263 |
| 1266 EventHandlerImplementation::~EventHandlerImplementation() { | 1264 EventHandlerImplementation::~EventHandlerImplementation() { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1365 | 1363 |
| 1366 | 1364 |
| 1367 void EventHandlerImplementation::Shutdown() { | 1365 void EventHandlerImplementation::Shutdown() { |
| 1368 SendData(kShutdownId, 0, 0); | 1366 SendData(kShutdownId, 0, 0); |
| 1369 } | 1367 } |
| 1370 | 1368 |
| 1371 } // namespace bin | 1369 } // namespace bin |
| 1372 } // namespace dart | 1370 } // namespace dart |
| 1373 | 1371 |
| 1374 #endif // defined(TARGET_OS_WINDOWS) | 1372 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |