| 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 <errno.h> | 7 #include <errno.h> |
| 8 #include <poll.h> | 8 #include <poll.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 * The fd is unregistered. It gets re-registered when the request | 303 * The fd is unregistered. It gets re-registered when the request |
| 304 * was handled by dart. | 304 * was handled by dart. |
| 305 */ | 305 */ |
| 306 intptr_t event_mask = GetPollEvents(&pollfds[i]); | 306 intptr_t event_mask = GetPollEvents(&pollfds[i]); |
| 307 if (event_mask != 0) { | 307 if (event_mask != 0) { |
| 308 intptr_t fd = pollfds[i].fd; | 308 intptr_t fd = pollfds[i].fd; |
| 309 SocketData* sd = GetSocketData(fd); | 309 SocketData* sd = GetSocketData(fd); |
| 310 Dart_Port port = sd->port(); | 310 Dart_Port port = sd->port(); |
| 311 ASSERT(port != 0); | 311 ASSERT(port != 0); |
| 312 sd->Unregister(); | 312 sd->Unregister(); |
| 313 DartUtils::PostInteger(port, event_mask); | 313 DartUtils::PostInt32(port, event_mask); |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 HandleInterruptFd(); | 317 HandleInterruptFd(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 | 320 |
| 321 intptr_t EventHandlerImplementation::GetTimeout() { | 321 intptr_t EventHandlerImplementation::GetTimeout() { |
| 322 if (timeout_ == kInfinityTimeout) { | 322 if (timeout_ == kInfinityTimeout) { |
| 323 return kInfinityTimeout; | 323 return kInfinityTimeout; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { | 382 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { |
| 383 // The hashmap does not support keys with value 0. | 383 // The hashmap does not support keys with value 0. |
| 384 return reinterpret_cast<void*>(fd + 1); | 384 return reinterpret_cast<void*>(fd + 1); |
| 385 } | 385 } |
| 386 | 386 |
| 387 | 387 |
| 388 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { | 388 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { |
| 389 // The hashmap does not support keys with value 0. | 389 // The hashmap does not support keys with value 0. |
| 390 return dart::Utils::WordHash(fd + 1); | 390 return dart::Utils::WordHash(fd + 1); |
| 391 } | 391 } |
| OLD | NEW |