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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 Handle* handle = reinterpret_cast<Handle*>(msg->id); | 811 Handle* handle = reinterpret_cast<Handle*>(msg->id); |
812 ASSERT(handle != NULL); | 812 ASSERT(handle != NULL); |
813 if (handle->is_listen_socket()) { | 813 if (handle->is_listen_socket()) { |
814 ListenSocket* listen_socket = | 814 ListenSocket* listen_socket = |
815 reinterpret_cast<ListenSocket*>(handle); | 815 reinterpret_cast<ListenSocket*>(handle); |
816 listen_socket->EnsureInitialized(this); | 816 listen_socket->EnsureInitialized(this); |
817 listen_socket->SetPortAndMask(msg->dart_port, msg->data); | 817 listen_socket->SetPortAndMask(msg->dart_port, msg->data); |
818 | 818 |
819 Handle::ScopedLock lock(listen_socket); | 819 Handle::ScopedLock lock(listen_socket); |
820 | 820 |
821 // If incomming connections are requested make sure to post already | 821 // If incoming connections are requested make sure to post already |
822 // accepted connections. | 822 // accepted connections. |
823 if ((msg->data & (1 << kInEvent)) != 0) { | 823 if ((msg->data & (1 << kInEvent)) != 0) { |
824 if (listen_socket->CanAccept()) { | 824 if (listen_socket->CanAccept()) { |
825 int event_mask = (1 << kInEvent); | 825 int event_mask = (1 << kInEvent); |
826 handle->set_mask(handle->mask() & ~event_mask); | 826 handle->set_mask(handle->mask() & ~event_mask); |
827 DartUtils::PostInt32(handle->port(), event_mask); | 827 DartUtils::PostInt32(handle->port(), event_mask); |
828 } | 828 } |
829 // Always keep 5 outstanding accepts going, to enhance performance. | 829 // Always keep 5 outstanding accepts going, to enhance performance. |
830 while (listen_socket->pending_accept_count() < 5) { | 830 while (listen_socket->pending_accept_count() < 5) { |
831 listen_socket->IssueAccept(); | 831 listen_socket->IssueAccept(); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 | 1132 |
1133 | 1133 |
1134 void EventHandlerImplementation::Shutdown() { | 1134 void EventHandlerImplementation::Shutdown() { |
1135 SendData(kShutdownId, 0, 0); | 1135 SendData(kShutdownId, 0, 0); |
1136 } | 1136 } |
1137 | 1137 |
1138 } // namespace bin | 1138 } // namespace bin |
1139 } // namespace dart | 1139 } // namespace dart |
1140 | 1140 |
1141 #endif // defined(TARGET_OS_WINDOWS) | 1141 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |