| Index: runtime/bin/eventhandler_android.cc
|
| diff --git a/runtime/bin/eventhandler_android.cc b/runtime/bin/eventhandler_android.cc
|
| index b1a424f2f9359c10edd7f47bc1f28d6b62cf8fe5..29eb1b289465e3c38aab3716e8aaf2812ca680ea 100644
|
| --- a/runtime/bin/eventhandler_android.cc
|
| +++ b/runtime/bin/eventhandler_android.cc
|
| @@ -21,8 +21,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 "bin/utils.h"
|
| @@ -50,14 +50,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();
|
| @@ -78,7 +76,6 @@ static void AddToEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) {
|
| }
|
| }
|
|
|
| -
|
| EventHandlerImplementation::EventHandlerImplementation()
|
| : socket_map_(&HashMap::SamePointerValue, 16) {
|
| intptr_t result;
|
| @@ -117,14 +114,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_));
|
| @@ -132,7 +127,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();
|
| @@ -147,7 +141,6 @@ void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask,
|
| }
|
| }
|
|
|
| -
|
| DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo(
|
| intptr_t fd,
|
| bool is_listening) {
|
| @@ -170,7 +163,6 @@ DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo(
|
| return di;
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::WakeupHandler(intptr_t id,
|
| Dart_Port dart_port,
|
| int64_t data) {
|
| @@ -192,7 +184,6 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id,
|
| }
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::HandleInterruptFd() {
|
| const intptr_t MAX_MESSAGES = kInterruptMessageSize;
|
| InterruptMessage msg[MAX_MESSAGES];
|
| @@ -276,7 +267,6 @@ void EventHandlerImplementation::HandleInterruptFd() {
|
| }
|
| }
|
|
|
| -
|
| #ifdef DEBUG_POLL
|
| static void PrintEventMask(intptr_t fd, intptr_t events) {
|
| Log::Print("%d ", fd);
|
| @@ -309,7 +299,6 @@ static void PrintEventMask(intptr_t fd, intptr_t events) {
|
| }
|
| #endif
|
|
|
| -
|
| intptr_t EventHandlerImplementation::GetPollEvents(intptr_t events,
|
| DescriptorInfo* di) {
|
| #ifdef DEBUG_POLL
|
| @@ -332,7 +321,6 @@ intptr_t EventHandlerImplementation::GetPollEvents(intptr_t events,
|
| return event_mask;
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
|
| int size) {
|
| bool interrupt_seen = false;
|
| @@ -362,7 +350,6 @@ void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
|
| }
|
| }
|
|
|
| -
|
| int64_t EventHandlerImplementation::GetTimeout() {
|
| if (!timeout_queue_.HasTimeout()) {
|
| return kInfinityTimeout;
|
| @@ -372,7 +359,6 @@ int64_t EventHandlerImplementation::GetTimeout() {
|
| return (millis < 0) ? 0 : millis;
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::HandleTimeout() {
|
| if (timeout_queue_.HasTimeout()) {
|
| int64_t millis = timeout_queue_.CurrentTimeout() -
|
| @@ -384,7 +370,6 @@ void EventHandlerImplementation::HandleTimeout() {
|
| }
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::Poll(uword args) {
|
| ThreadSignalBlocker signal_blocker(SIGPROF);
|
| static const intptr_t kMaxEvents = 16;
|
| @@ -415,7 +400,6 @@ void EventHandlerImplementation::Poll(uword args) {
|
| handler->NotifyShutdownDone();
|
| }
|
|
|
| -
|
| void EventHandlerImplementation::Start(EventHandler* handler) {
|
| int result = Thread::Start(&EventHandlerImplementation::Poll,
|
| reinterpret_cast<uword>(handler));
|
| @@ -424,25 +408,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);
|
|
|