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

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

Issue 18194003: Implement redirect-stdout-on-close on Winows, to the 'NUL' device. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove redundant 'USE'/ Created 7 years, 5 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/eventhandler_win.h ('k') | tests/standalone/standalone.status » ('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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_WINDOWS) 6 #if defined(TARGET_OS_WINDOWS)
7 7
8 #include "bin/eventhandler.h" 8 #include "bin/eventhandler.h"
9 9
10 #include <process.h> // NOLINT 10 #include <process.h> // NOLINT
11 #include <winsock2.h> // NOLINT 11 #include <winsock2.h> // NOLINT
12 #include <ws2tcpip.h> // NOLINT 12 #include <ws2tcpip.h> // NOLINT
13 #include <mswsock.h> // NOLINT 13 #include <mswsock.h> // NOLINT
14 #include <io.h> // NOLINT
15 #include <fcntl.h> // NOLINT
14 16
15 #include "bin/builtin.h" 17 #include "bin/builtin.h"
16 #include "bin/dartutils.h" 18 #include "bin/dartutils.h"
17 #include "bin/log.h" 19 #include "bin/log.h"
18 #include "bin/socket.h" 20 #include "bin/socket.h"
19 #include "bin/utils.h" 21 #include "bin/utils.h"
20 #include "platform/thread.h" 22 #include "platform/thread.h"
21 23
22 24
23 namespace dart { 25 namespace dart {
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 CreateCompletionPort(event_handler_->completion_port()); 321 CreateCompletionPort(event_handler_->completion_port());
320 } 322 }
321 } 323 }
322 324
323 325
324 bool FileHandle::IsClosed() { 326 bool FileHandle::IsClosed() {
325 return false; 327 return false;
326 } 328 }
327 329
328 330
331 void FileHandle::DoClose() {
332 if (GetStdHandle(STD_OUTPUT_HANDLE) == handle_) {
333 int fd = _open("NUL", _O_WRONLY);
334 ASSERT(fd >= 0);
335 _dup2(fd, _fileno(stdout));
336 close(fd);
337 } else {
338 Handle::DoClose();
339 }
340 }
341
342
329 void SocketHandle::HandleIssueError() { 343 void SocketHandle::HandleIssueError() {
330 int error = WSAGetLastError(); 344 int error = WSAGetLastError();
331 if (error == WSAECONNRESET) { 345 if (error == WSAECONNRESET) {
332 event_handler_->HandleClosed(this); 346 event_handler_->HandleClosed(this);
333 } else { 347 } else {
334 event_handler_->HandleError(this); 348 event_handler_->HandleError(this);
335 } 349 }
336 WSASetLastError(error); 350 WSASetLastError(error);
337 } 351 }
338 352
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 1015
1002 1016
1003 void EventHandlerImplementation::Shutdown() { 1017 void EventHandlerImplementation::Shutdown() {
1004 SendData(kShutdownId, 0, 0); 1018 SendData(kShutdownId, 0, 0);
1005 } 1019 }
1006 1020
1007 } // namespace bin 1021 } // namespace bin
1008 } // namespace dart 1022 } // namespace dart
1009 1023
1010 #endif // defined(TARGET_OS_WINDOWS) 1024 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_win.h ('k') | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698