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

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

Issue 8574002: Handle stdin/stdout/stderr on Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments from ager@ Created 9 years, 1 month 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/socket.h ('k') | runtime/bin/socket_linux.cc » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/socket.h" 5 #include "bin/socket.h"
6 #include "bin/dartutils.h" 6 #include "bin/dartutils.h"
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 Dart_EnterScope(); 106 Dart_EnterScope();
107 intptr_t socket = 107 intptr_t socket =
108 DartUtils::GetIntegerInstanceField(Dart_GetNativeArgument(args, 0), 108 DartUtils::GetIntegerInstanceField(Dart_GetNativeArgument(args, 0),
109 DartUtils::kIdFieldName); 109 DartUtils::kIdFieldName);
110 intptr_t port = Socket::GetPort(socket); 110 intptr_t port = Socket::GetPort(socket);
111 Dart_SetReturnValue(args, Dart_NewInteger(port)); 111 Dart_SetReturnValue(args, Dart_NewInteger(port));
112 Dart_ExitScope(); 112 Dart_ExitScope();
113 } 113 }
114 114
115 115
116 void FUNCTION_NAME(Socket_GetStdioHandle)(Dart_NativeArguments args) {
117 Dart_EnterScope();
118 Dart_Handle socketobj = Dart_GetNativeArgument(args, 0);
119 intptr_t num =
120 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 1));
121 ASSERT(num == 0 || num == 1 || num == 2);
122 intptr_t socket = Socket::GetStdioHandle(num);
123 DartUtils::SetIntegerInstanceField(
124 socketobj, DartUtils::kIdFieldName, socket);
125 Dart_SetReturnValue(args, Dart_NewBoolean(socket >= 0));
126 Dart_ExitScope();
127 }
128
129
116 void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) { 130 void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) {
117 Dart_EnterScope(); 131 Dart_EnterScope();
118 Dart_Handle socketobj = Dart_GetNativeArgument(args, 0); 132 Dart_Handle socketobj = Dart_GetNativeArgument(args, 0);
119 const char* bindAddress = 133 const char* bindAddress =
120 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1)); 134 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1));
121 intptr_t port = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2)); 135 intptr_t port = DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 2));
122 intptr_t backlog = 136 intptr_t backlog =
123 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3)); 137 DartUtils::GetIntegerValue(Dart_GetNativeArgument(args, 3));
124 intptr_t socket = 138 intptr_t socket =
125 ServerSocket::CreateBindListen(bindAddress, port, backlog); 139 ServerSocket::CreateBindListen(bindAddress, port, backlog);
(...skipping 11 matching lines...) Expand all
137 DartUtils::kIdFieldName); 151 DartUtils::kIdFieldName);
138 Dart_Handle socketobj = Dart_GetNativeArgument(args, 1); 152 Dart_Handle socketobj = Dart_GetNativeArgument(args, 1);
139 intptr_t newSocket = ServerSocket::Accept(socket); 153 intptr_t newSocket = ServerSocket::Accept(socket);
140 if (newSocket >= 0) { 154 if (newSocket >= 0) {
141 DartUtils::SetIntegerInstanceField( 155 DartUtils::SetIntegerInstanceField(
142 socketobj, DartUtils::kIdFieldName, newSocket); 156 socketobj, DartUtils::kIdFieldName, newSocket);
143 } 157 }
144 Dart_SetReturnValue(args, Dart_NewBoolean(newSocket >= 0)); 158 Dart_SetReturnValue(args, Dart_NewBoolean(newSocket >= 0));
145 Dart_ExitScope(); 159 Dart_ExitScope();
146 } 160 }
OLDNEW
« 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