Index: runtime/bin/eventhandler_linux.h |
diff --git a/runtime/bin/eventhandler_linux.h b/runtime/bin/eventhandler_linux.h |
index 2e811e8168c08969cc4668656c82559844d76067..b4a9f604247f33f1599e8d518530e2726471d9b9 100644 |
--- a/runtime/bin/eventhandler_linux.h |
+++ b/runtime/bin/eventhandler_linux.h |
@@ -14,6 +14,7 @@ |
#include <sys/socket.h> |
#include "platform/hashmap.h" |
+#include "platform/thread.h" |
namespace dart { |
@@ -27,46 +28,30 @@ class InterruptMessage { |
}; |
-enum PortDataFlags { |
- kClosedRead = 0, |
- kClosedWrite = 1, |
-}; |
- |
- |
class SocketData { |
public: |
explicit SocketData(intptr_t fd) |
- : tracked_by_epoll_(false), fd_(fd), port_(0), mask_(0), flags_(0) { |
+ : tracked_by_epoll_(false), fd_(fd), port_(0), mask_(0) { |
ASSERT(fd_ != -1); |
} |
- intptr_t GetPollEvents(); |
- |
void ShutdownRead() { |
shutdown(fd_, SHUT_RD); |
- MarkClosedRead(); |
} |
void ShutdownWrite() { |
shutdown(fd_, SHUT_WR); |
- MarkClosedWrite(); |
} |
void Close() { |
port_ = 0; |
mask_ = 0; |
- flags_ = 0; |
close(fd_); |
fd_ = -1; |
} |
bool IsListeningSocket() { return (mask_ & (1 << kListeningSocket)) != 0; } |
bool IsPipe() { return (mask_ & (1 << kPipe)) != 0; } |
- bool IsClosedRead() { return (flags_ & (1 << kClosedRead)) != 0; } |
- bool IsClosedWrite() { return (flags_ & (1 << kClosedWrite)) != 0; } |
- |
- void MarkClosedRead() { flags_ |= (1 << kClosedRead); } |
- void MarkClosedWrite() { flags_ |= (1 << kClosedWrite); } |
void SetPortAndMask(Dart_Port port, intptr_t mask) { |
ASSERT(fd_ != -1); |
@@ -85,7 +70,6 @@ class SocketData { |
intptr_t fd_; |
Dart_Port port_; |
intptr_t mask_; |
- intptr_t flags_; |
}; |
@@ -96,7 +80,7 @@ class EventHandlerImplementation { |
// Gets the socket data structure for a given file |
// descriptor. Creates a new one if one is not found. |
- SocketData* GetSocketData(intptr_t fd); |
+ SocketData* GetSocketData(intptr_t fd, bool* is_new); |
void SendData(intptr_t id, Dart_Port dart_port, int64_t data); |
void Start(EventHandler* handler); |
void Shutdown(); |