| Index: runtime/bin/eventhandler_macos.cc
|
| diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
|
| index 6e5e89510a194b60076d3852784fe025d9ebee88..eb9a1f2ca9d7e6900e24e93b8d90705510865746 100644
|
| --- a/runtime/bin/eventhandler_macos.cc
|
| +++ b/runtime/bin/eventhandler_macos.cc
|
| @@ -35,12 +35,10 @@ bool DescriptorInfo::HasReadEvent() {
|
| return (Mask() & (1 << kInEvent)) != 0;
|
| }
|
|
|
| -
|
| bool DescriptorInfo::HasWriteEvent() {
|
| return (Mask() & (1 << kOutEvent)) != 0;
|
| }
|
|
|
| -
|
| // Unregister the file descriptor for a SocketData structure with kqueue.
|
| static void RemoveFromKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) {
|
| if (!di->tracked_by_kqueue()) {
|
| @@ -55,7 +53,6 @@ static void RemoveFromKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) {
|
| di->set_tracked_by_kqueue(false);
|
| }
|
|
|
| -
|
| // Update the kqueue registration for SocketData structure to reflect
|
| // the events currently of interest.
|
| static void AddToKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) {
|
| @@ -97,7 +94,6 @@ static void AddToKqueue(intptr_t kqueue_fd_, DescriptorInfo* di) {
|
| }
|
| }
|
|
|
| -
|
| EventHandlerImplementation::EventHandlerImplementation()
|
| : socket_map_(&HashMap::SamePointerValue, 16) {
|
| intptr_t result;
|
| @@ -135,14 +131,12 @@ EventHandlerImplementation::EventHandlerImplementation()
|
| }
|
| }
|
|
|
| -
|
| static void DeleteDescriptorInfo(void* info) {
|
| DescriptorInfo* di = reinterpret_cast<DescriptorInfo*>(info);
|
| di->Close();
|
| delete di;
|
| }
|
|
|
| -
|
| EventHandlerImplementation::~EventHandlerImplementation() {
|
| socket_map_.Clear(DeleteDescriptorInfo);
|
| VOID_TEMP_FAILURE_RETRY(close(kqueue_fd_));
|
| @@ -150,7 +144,6 @@ EventHandlerImplementation::~EventHandlerImplementation() {
|
| VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[1]));
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::UpdateKQueueInstance(intptr_t old_mask,
|
| DescriptorInfo* di) {
|
| intptr_t new_mask = di->Mask();
|
| @@ -165,7 +158,6 @@ void EventHandlerImplementation::UpdateKQueueInstance(intptr_t old_mask,
|
| }
|
| }
|
|
|
| -
|
| DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo(
|
| intptr_t fd,
|
| bool is_listening) {
|
| @@ -188,7 +180,6 @@ DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo(
|
| return di;
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::WakeupHandler(intptr_t id,
|
| Dart_Port dart_port,
|
| int64_t data) {
|
| @@ -209,7 +200,6 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id,
|
| }
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::HandleInterruptFd() {
|
| const intptr_t MAX_MESSAGES = kInterruptMessageSize;
|
| InterruptMessage msg[MAX_MESSAGES];
|
| @@ -292,7 +282,6 @@ void EventHandlerImplementation::HandleInterruptFd() {
|
| }
|
| }
|
|
|
| -
|
| #ifdef DEBUG_KQUEUE
|
| static void PrintEventMask(intptr_t fd, struct kevent* event) {
|
| Log::Print("%d ", static_cast<int>(fd));
|
| @@ -329,7 +318,6 @@ static void PrintEventMask(intptr_t fd, struct kevent* event) {
|
| }
|
| #endif
|
|
|
| -
|
| intptr_t EventHandlerImplementation::GetEvents(struct kevent* event,
|
| DescriptorInfo* di) {
|
| #ifdef DEBUG_KQUEUE
|
| @@ -379,7 +367,6 @@ intptr_t EventHandlerImplementation::GetEvents(struct kevent* event,
|
| return event_mask;
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::HandleEvents(struct kevent* events, int size) {
|
| bool interrupt_seen = false;
|
| for (int i = 0; i < size; i++) {
|
| @@ -414,7 +401,6 @@ void EventHandlerImplementation::HandleEvents(struct kevent* events, int size) {
|
| }
|
| }
|
|
|
| -
|
| int64_t EventHandlerImplementation::GetTimeout() {
|
| if (!timeout_queue_.HasTimeout()) {
|
| return kInfinityTimeout;
|
| @@ -424,7 +410,6 @@ int64_t EventHandlerImplementation::GetTimeout() {
|
| return (millis < 0) ? 0 : millis;
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::HandleTimeout() {
|
| if (timeout_queue_.HasTimeout()) {
|
| int64_t millis = timeout_queue_.CurrentTimeout() -
|
| @@ -436,7 +421,6 @@ void EventHandlerImplementation::HandleTimeout() {
|
| }
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::EventHandlerEntry(uword args) {
|
| static const intptr_t kMaxEvents = 16;
|
| struct kevent events[kMaxEvents];
|
| @@ -479,7 +463,6 @@ void EventHandlerImplementation::EventHandlerEntry(uword args) {
|
| handler->NotifyShutdownDone();
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::Start(EventHandler* handler) {
|
| int result = Thread::Start(&EventHandlerImplementation::EventHandlerEntry,
|
| reinterpret_cast<uword>(handler));
|
| @@ -488,25 +471,21 @@ void EventHandlerImplementation::Start(EventHandler* handler) {
|
| }
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::Shutdown() {
|
| SendData(kShutdownId, 0, 0);
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::SendData(intptr_t id,
|
| Dart_Port dart_port,
|
| int64_t data) {
|
| WakeupHandler(id, dart_port, data);
|
| }
|
|
|
| -
|
| void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) {
|
| // The hashmap does not support keys with value 0.
|
| return reinterpret_cast<void*>(fd + 1);
|
| }
|
|
|
| -
|
| uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
|
| // The hashmap does not support keys with value 0.
|
| return dart::Utils::WordHash(fd + 1);
|
|
|