| 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 "bin/eventhandler.h" | 5 #include "bin/eventhandler.h" |
| 6 | 6 |
| 7 #include <process.h> | 7 #include <process.h> |
| 8 #include <winsock2.h> | 8 #include <winsock2.h> |
| 9 #include <ws2tcpip.h> | 9 #include <ws2tcpip.h> |
| 10 #include <mswsock.h> | 10 #include <mswsock.h> |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 handle->EnsureInitialized(this); | 637 handle->EnsureInitialized(this); |
| 638 | 638 |
| 639 Handle::ScopedLock lock(handle); | 639 Handle::ScopedLock lock(handle); |
| 640 | 640 |
| 641 // If the data available callback has been requested and data are | 641 // If the data available callback has been requested and data are |
| 642 // available post it immediately. Otherwise make sure that a pending | 642 // available post it immediately. Otherwise make sure that a pending |
| 643 // read is issued unless the socket is already closed for read. | 643 // read is issued unless the socket is already closed for read. |
| 644 if ((msg->data & (1 << kInEvent)) != 0) { | 644 if ((msg->data & (1 << kInEvent)) != 0) { |
| 645 if (handle->Available() > 0) { | 645 if (handle->Available() > 0) { |
| 646 int event_mask = (1 << kInEvent); | 646 int event_mask = (1 << kInEvent); |
| 647 DartUtils::PostInteger(port, event_mask); | 647 DartUtils::PostInt32(port, event_mask); |
| 648 } else if (!handle->HasPendingRead() && | 648 } else if (!handle->HasPendingRead() && |
| 649 !handle->IsClosedRead()) { | 649 !handle->IsClosedRead()) { |
| 650 handle->IssueRead(); | 650 handle->IssueRead(); |
| 651 } | 651 } |
| 652 } | 652 } |
| 653 | 653 |
| 654 // If can send callback had been requested and there is no pending | 654 // If can send callback had been requested and there is no pending |
| 655 // send post it immediately. | 655 // send post it immediately. |
| 656 if ((msg->data & (1 << kOutEvent)) != 0) { | 656 if ((msg->data & (1 << kOutEvent)) != 0) { |
| 657 if (!handle->HasPendingWrite()) { | 657 if (!handle->HasPendingWrite()) { |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 reinterpret_cast<uword>(this)); | 886 reinterpret_cast<uword>(this)); |
| 887 if (result != 0) { | 887 if (result != 0) { |
| 888 FATAL1("Failed to start event handler thread %d", result); | 888 FATAL1("Failed to start event handler thread %d", result); |
| 889 } | 889 } |
| 890 | 890 |
| 891 // Initialize Winsock32 | 891 // Initialize Winsock32 |
| 892 if (!Socket::Initialize()) { | 892 if (!Socket::Initialize()) { |
| 893 FATAL("Failed to initialized Windows sockets"); | 893 FATAL("Failed to initialized Windows sockets"); |
| 894 } | 894 } |
| 895 } | 895 } |
| OLD | NEW |