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

Side by Side Diff: runtime/bin/eventhandler_win.cc

Issue 9310053: Rework Windows process handling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Windows build and add stable binaries. Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/process.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/eventhandler.h" 5 #include "bin/eventhandler.h"
6 6
7 #include <process.h> 7 #include <process.h>
8 #include <winsock2.h> 8 #include <winsock2.h>
9 #include <ws2tcpip.h> 9 #include <ws2tcpip.h>
10 #include <mswsock.h> 10 #include <mswsock.h>
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 static unsigned int __stdcall ReadFileThread(void* args) { 204 static unsigned int __stdcall ReadFileThread(void* args) {
205 Handle* handle = reinterpret_cast<Handle*>(args); 205 Handle* handle = reinterpret_cast<Handle*>(args);
206 handle->ReadSyncCompleteAsync(); 206 handle->ReadSyncCompleteAsync();
207 return 0; 207 return 0;
208 } 208 }
209 209
210 210
211 void Handle::ReadSyncCompleteAsync() { 211 void Handle::ReadSyncCompleteAsync() {
212 ASSERT(pending_read_ != NULL); 212 ASSERT(pending_read_ != NULL);
213 DWORD bytes_read; 213 DWORD bytes_read = 0;
214 BOOL ok = ReadFile(handle_, 214 BOOL ok = ReadFile(handle_,
215 pending_read_->GetBufferStart(), 215 pending_read_->GetBufferStart(),
216 pending_read_->GetBufferSize(), 216 pending_read_->GetBufferSize(),
217 &bytes_read, 217 &bytes_read,
218 NULL); 218 NULL);
219 if (!ok) { 219 if (!ok) {
220 fprintf(stderr, "ReadFile failed %d\n", GetLastError()); 220 if (GetLastError() != ERROR_BROKEN_PIPE) {
221 fprintf(stderr, "ReadFile failed %d\n", GetLastError());
222 }
221 bytes_read = 0; 223 bytes_read = 0;
222 } 224 }
223 OVERLAPPED* overlapped = pending_read_->GetCleanOverlapped(); 225 OVERLAPPED* overlapped = pending_read_->GetCleanOverlapped();
224 ok = PostQueuedCompletionStatus(event_handler_->completion_port(), 226 ok = PostQueuedCompletionStatus(event_handler_->completion_port(),
225 bytes_read, 227 bytes_read,
226 reinterpret_cast<ULONG_PTR>(this), 228 reinterpret_cast<ULONG_PTR>(this),
227 overlapped); 229 overlapped);
228 if (!ok) { 230 if (!ok) {
229 FATAL("PostQueuedCompletionStatus failed"); 231 FATAL("PostQueuedCompletionStatus failed");
230 } 232 }
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 reinterpret_cast<uword>(this)); 885 reinterpret_cast<uword>(this));
884 if (result != 0) { 886 if (result != 0) {
885 FATAL1("Failed to start event handler thread %d", result); 887 FATAL1("Failed to start event handler thread %d", result);
886 } 888 }
887 889
888 // Initialize Winsock32 890 // Initialize Winsock32
889 if (!Socket::Initialize()) { 891 if (!Socket::Initialize()) {
890 FATAL("Failed to initialized Windows sockets"); 892 FATAL("Failed to initialized Windows sockets");
891 } 893 }
892 } 894 }
OLDNEW
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698