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

Unified Diff: runtime/bin/socket_patch.dart

Issue 24395013: Merge services into a shared IOService in dart:io, and use a native port. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Finish off native_service Created 7 years, 3 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.cc ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index f4f07af239d7637b2553ce33c5f858a2e87d7508..bc2aacc92ad3b858f5c70cbbd214710084defc7f 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -220,13 +220,9 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
// Holds the address used to connect or bind the socket.
InternetAddress address;
- // Native port for socket services.
- static SendPort socketService;
-
static Future<List<InternetAddress>> lookup(
String host, {InternetAddressType type: InternetAddressType.ANY}) {
- ensureSocketService();
- return socketService.call([HOST_NAME_LOOKUP, host, type._value])
+ return IOService.dispatch(SOCKET_LOOKUP, [host, type._value])
.then((response) {
if (isErrorResponse(response)) {
throw createError(response, "Failed host lookup: '$host'");
@@ -240,8 +236,7 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
}
static Future<InternetAddress> reverseLookup(InternetAddress addr) {
- ensureSocketService();
- return socketService.call([REVERSE_LOOKUP, addr._sockaddr_storage])
+ return IOService.dispatch(SOCKET_REVERSE_LOOKUP, [addr._sockaddr_storage])
.then((response) {
if (isErrorResponse(response)) {
throw createError(response, "Failed reverse host lookup", addr);
@@ -255,8 +250,7 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
bool includeLoopback: false,
bool includeLinkLocal: false,
InternetAddressType type: InternetAddressType.ANY}) {
- ensureSocketService();
- return socketService.call([LIST_INTERFACES, type._value])
+ return IOService.dispatch(SOCKET_LIST_INTERFACES, [type._value])
.then((response) {
if (isErrorResponse(response)) {
throw createError(response, "Failed listing interfaces");
@@ -295,7 +289,6 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
});
})
.then((address) {
- ensureSocketService();
var socket = new _NativeSocket.normal();
socket.address = address;
var result = socket.nativeCreateConnect(
@@ -605,12 +598,6 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
}
}
- static void ensureSocketService() {
- if (socketService == null) {
- socketService = _NativeSocket.newServicePort();
- }
- }
-
// Check whether this is an error response from a native port call.
static bool isErrorResponse(response) {
return response is List && response[0] != _SUCCESS_RESPONSE;
@@ -673,8 +660,6 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
List nativeGetRemotePeer() native "Socket_GetRemotePeer";
OSError nativeGetError() native "Socket_GetError";
bool nativeSetOption(int option, bool enabled) native "Socket_SetOption";
-
- static SendPort newServicePort() native "Socket_NewServicePort";
}
« no previous file with comments | « runtime/bin/socket.cc ('k') | sdk/lib/io/directory_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698