| Index: runtime/bin/eventhandler_linux.cc
|
| diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc
|
| index 4ff0865b81534fa5ee645724d89c5e7552ebe853..7217da1b86bbc5e45c947fbe9d17808b8e859ce4 100644
|
| --- a/runtime/bin/eventhandler_linux.cc
|
| +++ b/runtime/bin/eventhandler_linux.cc
|
| @@ -22,8 +22,8 @@
|
|
|
| #include "bin/dartutils.h"
|
| #include "bin/fdutils.h"
|
| -#include "bin/log.h"
|
| #include "bin/lockers.h"
|
| +#include "bin/log.h"
|
| #include "bin/socket.h"
|
| #include "bin/thread.h"
|
| #include "platform/utils.h"
|
| @@ -44,14 +44,12 @@ intptr_t DescriptorInfo::GetPollEvents() {
|
| return events;
|
| }
|
|
|
| -
|
| // Unregister the file descriptor for a DescriptorInfo structure with
|
| // epoll.
|
| static void RemoveFromEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) {
|
| VOID_NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, di->fd(), NULL));
|
| }
|
|
|
| -
|
| static void AddToEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) {
|
| struct epoll_event event;
|
| event.events = EPOLLRDHUP | di->GetPollEvents();
|
| @@ -72,7 +70,6 @@ static void AddToEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) {
|
| }
|
| }
|
|
|
| -
|
| EventHandlerImplementation::EventHandlerImplementation()
|
| : socket_map_(&HashMap::SamePointerValue, 16) {
|
| intptr_t result;
|
| @@ -124,14 +121,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(epoll_fd_));
|
| @@ -140,7 +135,6 @@ EventHandlerImplementation::~EventHandlerImplementation() {
|
| VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[1]));
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask,
|
| DescriptorInfo* di) {
|
| intptr_t new_mask = di->Mask();
|
| @@ -155,7 +149,6 @@ void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask,
|
| }
|
| }
|
|
|
| -
|
| DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo(
|
| intptr_t fd,
|
| bool is_listening) {
|
| @@ -178,7 +171,6 @@ DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo(
|
| return di;
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::WakeupHandler(intptr_t id,
|
| Dart_Port dart_port,
|
| int64_t data) {
|
| @@ -200,7 +192,6 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id,
|
| }
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::HandleInterruptFd() {
|
| const intptr_t MAX_MESSAGES = kInterruptMessageSize;
|
| InterruptMessage msg[MAX_MESSAGES];
|
| @@ -292,7 +283,6 @@ void EventHandlerImplementation::HandleInterruptFd() {
|
| }
|
| }
|
|
|
| -
|
| #ifdef DEBUG_POLL
|
| static void PrintEventMask(intptr_t fd, intptr_t events) {
|
| Log::Print("%d ", fd);
|
| @@ -325,7 +315,6 @@ static void PrintEventMask(intptr_t fd, intptr_t events) {
|
| }
|
| #endif
|
|
|
| -
|
| intptr_t EventHandlerImplementation::GetPollEvents(intptr_t events,
|
| DescriptorInfo* di) {
|
| #ifdef DEBUG_POLL
|
| @@ -348,7 +337,6 @@ intptr_t EventHandlerImplementation::GetPollEvents(intptr_t events,
|
| return event_mask;
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
|
| int size) {
|
| bool interrupt_seen = false;
|
| @@ -386,7 +374,6 @@ void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
|
| }
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::Poll(uword args) {
|
| ThreadSignalBlocker signal_blocker(SIGPROF);
|
| static const intptr_t kMaxEvents = 16;
|
| @@ -411,7 +398,6 @@ void EventHandlerImplementation::Poll(uword args) {
|
| handler->NotifyShutdownDone();
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::Start(EventHandler* handler) {
|
| int result = Thread::Start(&EventHandlerImplementation::Poll,
|
| reinterpret_cast<uword>(handler));
|
| @@ -420,25 +406,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);
|
|
|