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

Unified Diff: bin/eventhandler_win.cc

Issue 8249007: Implement the full process interface for Windows (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 2 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 | « bin/eventhandler_win.h ('k') | bin/process_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/eventhandler_win.cc
===================================================================
--- bin/eventhandler_win.cc (revision 380)
+++ bin/eventhandler_win.cc (working copy)
@@ -218,7 +218,9 @@
return true;
}
- fprintf(stderr, "ReadFile failed: %d\n", GetLastError());
+ if (GetLastError() != ERROR_BROKEN_PIPE) {
+ fprintf(stderr, "ReadFile failed: %d\n", GetLastError());
+ }
event_handler_->HandleClosed(this);
IOBuffer::DisposeBuffer(buffer);
return false;
@@ -244,13 +246,34 @@
return true;
}
- fprintf(stderr, "WriteFile failed: %d\n", GetLastError());
+ if (GetLastError() != ERROR_BROKEN_PIPE) {
+ fprintf(stderr, "WriteFile failed: %d\n", GetLastError());
+ }
event_handler_->HandleClosed(this);
IOBuffer::DisposeBuffer(buffer);
return false;
}
+void FileHandle::EnsureInitialized(EventHandlerImplementation* event_handler) {
+ ScopedLock lock(this);
+ if (completion_port_ == INVALID_HANDLE_VALUE) {
+ ASSERT(event_handler_ == NULL);
+ event_handler_ = event_handler;
+ CreateCompletionPort(event_handler_->completion_port());
+ }
+}
+
+
+bool FileHandle::IsClosed() {
+ return false;
+}
+
+
+void FileHandle::AfterClose() {
+}
+
+
bool ListenSocket::LoadAcceptEx() {
// Load the AcceptEx function into memory using WSAIoctl.
// The WSAIoctl function is an extension of the ioctlsocket()
@@ -379,7 +402,7 @@
}
-int ClientSocket::Available() {
+int Handle::Available() {
ScopedLock lock(this);
if (data_ready_ == NULL) return 0;
ASSERT(!data_ready_->IsEmpty());
@@ -387,7 +410,7 @@
}
-int ClientSocket::Read(void* buffer, int num_bytes) {
+int Handle::Read(void* buffer, int num_bytes) {
ScopedLock lock(this);
if (data_ready_ == NULL) return 0;
num_bytes = data_ready_->Read(buffer, num_bytes);
@@ -399,7 +422,7 @@
}
-int ClientSocket::Write(const void* buffer, int num_bytes) {
+int Handle::Write(const void* buffer, int num_bytes) {
ScopedLock lock(this);
if (pending_write_ != NULL) return 0;
if (completion_port_ == INVALID_HANDLE_VALUE) return 0;
@@ -744,11 +767,11 @@
DWORD last_error = GetLastError();
if (last_error == ERROR_CONNECTION_ABORTED ||
last_error == ERROR_OPERATION_ABORTED ||
- last_error == ERROR_NETNAME_DELETED) {
+ last_error == ERROR_NETNAME_DELETED ||
+ last_error == ERROR_BROKEN_PIPE) {
ASSERT(bytes == 0);
handler->HandleIOCompletion(bytes, key, overlapped);
} else {
- printf("After GetQueuedCompletionStatus %d\n", GetLastError());
UNREACHABLE();
}
} else if (key == NULL) {
« no previous file with comments | « bin/eventhandler_win.h ('k') | bin/process_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698