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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 int64_t EventHandlerImplementation::GetTimeout() { | 1206 int64_t EventHandlerImplementation::GetTimeout() { |
1207 if (!timeout_queue_.HasTimeout()) { | 1207 if (!timeout_queue_.HasTimeout()) { |
1208 return kInfinityTimeout; | 1208 return kInfinityTimeout; |
1209 } | 1209 } |
1210 int64_t millis = timeout_queue_.CurrentTimeout() - | 1210 int64_t millis = timeout_queue_.CurrentTimeout() - |
1211 TimerUtils::GetCurrentTimeMilliseconds(); | 1211 TimerUtils::GetCurrentTimeMilliseconds(); |
1212 return (millis < 0) ? 0 : millis; | 1212 return (millis < 0) ? 0 : millis; |
1213 } | 1213 } |
1214 | 1214 |
1215 | 1215 |
1216 void EventHandlerImplementation::SendData(intptr_t id, | 1216 void EventHandlerImplementation::Notify(intptr_t id, |
1217 Dart_Port dart_port, | 1217 Dart_Port dart_port, |
1218 int64_t data) { | 1218 int64_t data) { |
1219 InterruptMessage* msg = new InterruptMessage; | 1219 InterruptMessage* msg = new InterruptMessage; |
1220 msg->id = id; | 1220 msg->id = id; |
1221 msg->dart_port = dart_port; | 1221 msg->dart_port = dart_port; |
1222 msg->data = data; | 1222 msg->data = data; |
1223 BOOL ok = PostQueuedCompletionStatus( | 1223 BOOL ok = PostQueuedCompletionStatus( |
1224 completion_port_, 0, NULL, reinterpret_cast<OVERLAPPED*>(msg)); | 1224 completion_port_, 0, NULL, reinterpret_cast<OVERLAPPED*>(msg)); |
1225 if (!ok) { | 1225 if (!ok) { |
1226 FATAL("PostQueuedCompletionStatus failed"); | 1226 FATAL("PostQueuedCompletionStatus failed"); |
1227 } | 1227 } |
1228 } | 1228 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 } | 1292 } |
1293 | 1293 |
1294 // Initialize Winsock32 | 1294 // Initialize Winsock32 |
1295 if (!Socket::Initialize()) { | 1295 if (!Socket::Initialize()) { |
1296 FATAL("Failed to initialized Windows sockets"); | 1296 FATAL("Failed to initialized Windows sockets"); |
1297 } | 1297 } |
1298 } | 1298 } |
1299 | 1299 |
1300 | 1300 |
1301 void EventHandlerImplementation::Shutdown() { | 1301 void EventHandlerImplementation::Shutdown() { |
1302 SendData(kShutdownId, 0, 0); | 1302 Notify(kShutdownId, 0, 0); |
1303 } | 1303 } |
1304 | 1304 |
1305 } // namespace bin | 1305 } // namespace bin |
1306 } // namespace dart | 1306 } // namespace dart |
1307 | 1307 |
1308 #endif // defined(TARGET_OS_WINDOWS) | 1308 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |