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

Unified Diff: runtime/bin/eventhandler_win.cc

Issue 265273002: Clean up windows eventhandler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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/eventhandler_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_win.cc
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index 7e1a2b33d96f2fe86e395926d108faa8084cba9b..fbc562398d297c730c1c9b84532b92653fae4465 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -332,13 +332,30 @@ bool Handle::IssueSendTo(struct sockaddr* sa, socklen_t sa_len) {
}
+static void HandleClosed(Handle* handle) {
+ if (!handle->IsClosing()) {
+ int event_mask = 1 << kCloseEvent;
+ DartUtils::PostInt32(handle->port(), event_mask);
+ }
+}
+
+
+static void HandleError(Handle* handle) {
+ handle->set_last_error(WSAGetLastError());
+ handle->MarkError();
+ if (!handle->IsClosing()) {
+ int event_mask = 1 << kErrorEvent;
+ DartUtils::PostInt32(handle->port(), event_mask);
+ }
+}
+
+
void Handle::HandleIssueError() {
DWORD error = GetLastError();
- ASSERT(event_handler_ != NULL);
if (error == ERROR_BROKEN_PIPE) {
- event_handler_->HandleClosed(this);
+ HandleClosed(this);
} else {
- event_handler_->HandleError(this);
+ HandleError(this);
}
SetLastError(error);
}
@@ -400,11 +417,10 @@ bool DirectoryWatchHandle::IssueRead() {
void SocketHandle::HandleIssueError() {
int error = WSAGetLastError();
- ASSERT(event_handler_ != NULL);
if (error == WSAECONNRESET) {
- event_handler_->HandleClosed(this);
+ HandleClosed(this);
} else {
- event_handler_->HandleError(this);
+ HandleError(this);
}
WSASetLastError(error);
}
@@ -547,7 +563,7 @@ ClientSocket* ListenSocket::Accept() {
if (!IsClosing()) {
while (pending_accept_count() < 5) {
if (!IssueAccept()) {
- event_handler_->HandleError(this);
+ HandleError(this);
}
}
}
@@ -1082,24 +1098,6 @@ void EventHandlerImplementation::HandleAccept(ListenSocket* listen_socket,
}
-void EventHandlerImplementation::HandleClosed(Handle* handle) {
- if (!handle->IsClosing()) {
- int event_mask = 1 << kCloseEvent;
- DartUtils::PostInt32(handle->port(), event_mask);
- }
-}
-
-
-void EventHandlerImplementation::HandleError(Handle* handle) {
- handle->set_last_error(WSAGetLastError());
- handle->MarkError();
- if (!handle->IsClosing()) {
- int event_mask = 1 << kErrorEvent;
- DartUtils::PostInt32(handle->port(), event_mask);
- }
-}
-
-
void EventHandlerImplementation::HandleRead(Handle* handle,
int bytes,
OverlappedBuffer* buffer) {
« no previous file with comments | « runtime/bin/eventhandler_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698