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

Unified Diff: runtime/bin/socket_win.cc

Issue 11773041: Add function for finding what a InputStream or OutputStream is attached to (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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/socket_macos.cc ('k') | runtime/bin/stdio_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_win.cc
diff --git a/runtime/bin/socket_win.cc b/runtime/bin/socket_win.cc
index 0a31298f8201770bc2eb14c0191c37ac84f38675..b252cfff8e06ad84f408d67c03552b4cc4624f52 100644
--- a/runtime/bin/socket_win.cc
+++ b/runtime/bin/socket_win.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "bin/builtin.h"
#include "bin/eventhandler.h"
+#include "bin/file.h"
#include "bin/log.h"
#include "bin/socket.h"
@@ -138,6 +139,17 @@ void Socket::GetError(intptr_t fd, OSError* os_error) {
}
+int Socket::GetType(intptr_t fd) {
+ Handle* handle = reinterpret_cast<Handle*>(fd);
+ switch (GetFileType(handle->handle())) {
+ case FILE_TYPE_CHAR: return File::kTerminal;
+ case FILE_TYPE_PIPE: return File::kPipe;
+ case FILE_TYPE_DISK: return File::kFile;
+ default: return GetLastError == NO_ERROR ? File::kOther : -1;
+ }
+}
+
+
intptr_t Socket::GetStdioHandle(int num) {
HANDLE handle;
switch (num) {
« no previous file with comments | « runtime/bin/socket_macos.cc ('k') | runtime/bin/stdio_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698