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

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

Issue 11318018: - Represent strings internally in UTF-16 format, this makes it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
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 9
10 #include "platform/globals.h" 10 #include "platform/globals.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 void FUNCTION_NAME(Socket_GetRemotePeer)(Dart_NativeArguments args) { 179 void FUNCTION_NAME(Socket_GetRemotePeer)(Dart_NativeArguments args) {
180 Dart_EnterScope(); 180 Dart_EnterScope();
181 Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0); 181 Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0);
182 intptr_t socket = 0; 182 intptr_t socket = 0;
183 Socket::GetSocketIdNativeField(socket_obj, &socket); 183 Socket::GetSocketIdNativeField(socket_obj, &socket);
184 OSError os_error; 184 OSError os_error;
185 intptr_t port = 0; 185 intptr_t port = 0;
186 char host[INET_ADDRSTRLEN]; 186 char host[INET_ADDRSTRLEN];
187 if (Socket::GetRemotePeer(socket, host, &port)) { 187 if (Socket::GetRemotePeer(socket, host, &port)) {
188 Dart_Handle list = Dart_NewList(2); 188 Dart_Handle list = Dart_NewList(2);
189 Dart_ListSetAt(list, 0, Dart_NewString(host)); 189 Dart_ListSetAt(list, 0, Dart_NewStringFromCString(host));
190 Dart_ListSetAt(list, 1, Dart_NewInteger(port)); 190 Dart_ListSetAt(list, 1, Dart_NewInteger(port));
191 Dart_SetReturnValue(args, list); 191 Dart_SetReturnValue(args, list);
192 } else { 192 } else {
193 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); 193 Dart_SetReturnValue(args, DartUtils::NewDartOSError());
194 } 194 }
195 Dart_ExitScope(); 195 Dart_ExitScope();
196 } 196 }
197 197
198 198
199 void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) { 199 void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 356
357 357
358 Dart_Handle Socket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) { 358 Dart_Handle Socket::SetSocketIdNativeField(Dart_Handle socket, intptr_t id) {
359 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id); 359 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id);
360 } 360 }
361 361
362 362
363 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) { 363 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) {
364 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id); 364 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id);
365 } 365 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698