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

Unified Diff: runtime/bin/socket.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.h ('k') | runtime/bin/socket_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket.cc
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index 2013e093efa492699775419ceeeebb0b26b7318d..1285f1363a17353ac579cf555048d2cefd2c5e12 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -1,4 +1,4 @@
-// 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.
@@ -267,6 +267,22 @@ void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) {
}
+void FUNCTION_NAME(Socket_GetType)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
+ intptr_t socket = 0;
+ Socket::GetSocketIdNativeField(socket_obj, &socket);
+ OSError os_error;
+ intptr_t type = Socket::GetType(socket);
+ if (type >= 0) {
+ Dart_SetReturnValue(args, Dart_NewInteger(type));
+ } else {
+ Dart_SetReturnValue(args, DartUtils::NewDartOSError());
+ }
+ Dart_ExitScope();
+}
+
+
void FUNCTION_NAME(Socket_GetStdioHandle)(Dart_NativeArguments args) {
Dart_EnterScope();
Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
« no previous file with comments | « runtime/bin/socket.h ('k') | runtime/bin/socket_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698