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

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

Issue 9963053: Add remotePort getter to Socket. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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/socket.h ('k') | runtime/bin/socket.dart » ('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/socket.h" 5 #include "bin/socket.h"
6 #include "bin/dartutils.h" 6 #include "bin/dartutils.h"
7 #include "bin/thread.h" 7 #include "bin/thread.h"
8 #include "bin/utils.h" 8 #include "bin/utils.h"
9 #include "platform/thread.h" 9 #include "platform/thread.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 intptr_t port = Socket::GetPort(socket); 146 intptr_t port = Socket::GetPort(socket);
147 if (port > 0) { 147 if (port > 0) {
148 Dart_SetReturnValue(args, Dart_NewInteger(port)); 148 Dart_SetReturnValue(args, Dart_NewInteger(port));
149 } else { 149 } else {
150 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); 150 Dart_SetReturnValue(args, DartUtils::NewDartOSError());
151 } 151 }
152 Dart_ExitScope(); 152 Dart_ExitScope();
153 } 153 }
154 154
155 155
156 void FUNCTION_NAME(Socket_GetRemotePort)(Dart_NativeArguments args) {
157 Dart_EnterScope();
158 intptr_t socket =
159 DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0),
160 DartUtils::kIdFieldName);
161 OSError os_error;
162 intptr_t port = Socket::GetRemotePort(socket);
163 if (port > 0) {
164 Dart_SetReturnValue(args, Dart_NewInteger(port));
165 } else {
166 Dart_SetReturnValue(args, DartUtils::NewDartOSError());
167 }
168 Dart_ExitScope();
169 }
170
171
156 void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) { 172 void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) {
157 Dart_EnterScope(); 173 Dart_EnterScope();
158 intptr_t socket = 174 intptr_t socket =
159 DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0), 175 DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0),
160 DartUtils::kIdFieldName); 176 DartUtils::kIdFieldName);
161 OSError os_error; 177 OSError os_error;
162 Socket::GetError(socket, &os_error); 178 Socket::GetError(socket, &os_error);
163 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error)); 179 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error));
164 Dart_ExitScope(); 180 Dart_ExitScope();
165 } 181 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 Dart_EnterScope(); 307 Dart_EnterScope();
292 Dart_SetReturnValue(args, Dart_Null()); 308 Dart_SetReturnValue(args, Dart_Null());
293 Dart_Port service_port = Socket::GetServicePort(); 309 Dart_Port service_port = Socket::GetServicePort();
294 if (service_port != kIllegalPort) { 310 if (service_port != kIllegalPort) {
295 // Return a send port for the service port. 311 // Return a send port for the service port.
296 Dart_Handle send_port = Dart_NewSendPort(service_port); 312 Dart_Handle send_port = Dart_NewSendPort(service_port);
297 Dart_SetReturnValue(args, send_port); 313 Dart_SetReturnValue(args, send_port);
298 } 314 }
299 Dart_ExitScope(); 315 Dart_ExitScope();
300 } 316 }
OLDNEW
« no previous file with comments | « runtime/bin/socket.h ('k') | runtime/bin/socket.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698