Chromium Code Reviews| Index: runtime/bin/eventhandler_win.h |
| diff --git a/runtime/bin/eventhandler_win.h b/runtime/bin/eventhandler_win.h |
| index 619a65a4ed53a479972129ff73d0bbd4fdf5d764..046592c9f34abf9d9bcf23c3fbf1de6f41dec137 100644 |
| --- a/runtime/bin/eventhandler_win.h |
| +++ b/runtime/bin/eventhandler_win.h |
| @@ -152,6 +152,13 @@ class Handle { |
| void ReadComplete(IOBuffer* buffer); |
| void WriteComplete(IOBuffer* buffer); |
| + bool IsClosing() { return (flags_ & (1 << kClosing)) != 0; } |
| + bool IsClosedRead() { return (flags_ & (1 << kCloseRead)) != 0; } |
| + bool IsClosedWrite() { return (flags_ & (1 << kCloseWrite)) != 0; } |
| + void MarkClosing() { flags_ |= (1 << kClosing); } |
| + void MarkClosedRead() { flags_ |= (1 << kCloseRead); } |
| + void MarkClosedWrite() { flags_ |= (1 << kCloseWrite); } |
| + |
| virtual void EnsureInitialized( |
| EventHandlerImplementation* event_handler) = 0; |
| @@ -178,9 +185,13 @@ class Handle { |
| bool is_client_socket() { return type_ == kClientSocket; } |
| intptr_t mask() { return mask_; } |
| - bool is_closing() { return closing_; } |
| - |
| protected: |
| + enum Flags { |
| + kClosing = 0, |
| + kCloseRead = 1, |
| + kCloseWrite = 2 |
| + }; |
| + |
| explicit Handle(HANDLE handle); |
| Handle(HANDLE handle, Dart_Port port); |
| @@ -188,7 +199,7 @@ class Handle { |
| Type type_; |
| HANDLE handle_; |
| - bool closing_; // Is this handle in the process of closing? |
| + int flags_; |
|
Mads Ager (google)
2011/11/08 09:57:08
Should parts of this be private now? I guess flags
Søren Gjesse
2011/11/08 12:56:50
Done.
|
| Dart_Port port_; // Dart port to communicate events for this socket. |
| intptr_t mask_; // Mask of events to report through the port. |
| HANDLE completion_port_; |
| @@ -275,13 +286,11 @@ class ClientSocket : public SocketHandle { |
| public: |
| explicit ClientSocket(SOCKET s) |
| : SocketHandle(s), |
| - next_(NULL), |
| - flags_(0) { type_ = kClientSocket; } |
| + next_(NULL) { type_ = kClientSocket; } |
|
Mads Ager (google)
2011/11/08 09:57:08
Doesn't
explicit ClientSocket(SOCKET s) : Socke
Søren Gjesse
2011/11/08 12:56:50
Done.
|
| ClientSocket(SOCKET s, Dart_Port port) |
| : SocketHandle(s, port), |
| - next_(NULL), |
| - flags_(0) { type_ = kClientSocket; } |
| + next_(NULL) { type_ = kClientSocket; } |
|
Mads Ager (google)
2011/11/08 09:57:08
Ditto on the indentation.
Søren Gjesse
2011/11/08 12:56:50
Done.
|
| virtual ~ClientSocket() { |
| // Don't delete this object until all pending requests have been handled. |
| @@ -291,11 +300,6 @@ class ClientSocket : public SocketHandle { |
| }; |
| void Shutdown(int how); |
| - bool IsClosedRead() { return (flags_ & (1 << kCloseRead)) != 0; } |
| - bool IsClosedWrite() { return (flags_ & (1 << kCloseWrite)) != 0; } |
| - |
| - void MarkClosedRead() { flags_ |= (1 << kCloseRead); } |
| - void MarkClosedWrite() { flags_ |= (1 << kCloseWrite); } |
| // Internal interface used by the event handler. |
| virtual bool IssueRead(); |
| @@ -309,15 +313,9 @@ class ClientSocket : public SocketHandle { |
| void set_next(ClientSocket* next) { next_ = next; } |
| private: |
| - enum Flags { |
| - kCloseRead = 0, |
| - kCloseWrite = 1 |
| - }; |
| - |
| virtual void AfterClose(); |
| ClientSocket* next_; |
| - int flags_; |
| }; |
| @@ -335,8 +333,8 @@ class EventHandlerImplementation { |
| void HandleTimeout(); |
| void HandleAccept(ListenSocket* listen_socket, IOBuffer* buffer); |
| void HandleClosed(Handle* handle); |
| - void HandleRead(ClientSocket* client_socket, int bytes, IOBuffer* buffer); |
| - void HandleWrite(ClientSocket* client_socket, int bytes, IOBuffer* buffer); |
| + void HandleRead(Handle* handle, int bytes, IOBuffer* buffer); |
| + void HandleWrite(Handle* handle, int bytes, IOBuffer* buffer); |
| void HandleClose(ClientSocket* client_socket); |
| void HandleIOCompletion(DWORD bytes, ULONG_PTR key, OVERLAPPED* overlapped); |