Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Unified Diff: runtime/bin/eventhandler_linux.h

Issue 169383003: Make event-handlers edge-triggered and move socket-state to Dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/bin/eventhandler_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/bin/eventhandler_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698