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

Unified Diff: runtime/bin/socket_patch.dart

Issue 303673009: Create a ServiceObject for a socket (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 | « no previous file | runtime/bin/vmservice/client/deployed/web/index.html » ('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 6aa9ce5661550fd8f8a1f8f4014a0cbb0fa804c0..43b5f665eed32abf53975dcb009da9d2a380ea34 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -1072,22 +1072,13 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
String get _serviceTypeName => 'Socket';
String _JSONKind() {
- return isListening ? "LISTENING" :
- isPipe ? "PIPE" :
- isInternal ? "INTERNAL" : "NORMAL";
+ return isListening ? "Listening" :
+ isPipe ? "Pipe" :
+ isInternal ? "Internal" : "Normal";
}
Map _toJSONPipe(bool ref) {
- var name;
- if (isClosed) {
- name = 'CLOSED PIPE';
- } else if (isClosedWrite) {
- name = 'READ PIPE';
- } else if (isClosedRead) {
- name = 'WRITE PIPE';
- } else {
- name = 'R/W PIPE';
- }
+ var name = 'Anonymous Pipe';
var r = {
'id': _servicePath,
'type': _serviceType(ref),
@@ -1098,6 +1089,10 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
if (ref) {
return r;
}
+ r['readClosed'] = isClosedRead;
+ r['writeClosed'] = isClosedWrite;
+ r['closing'] = isClosing;
+ r['listening'] = isListening;
r['fd'] = nativeGetSocketId();
if (owner != null) {
r['owner'] = owner._toJSON(true);
@@ -1118,8 +1113,32 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
if (ref) {
return r;
}
- r['port'] = port;
- r['address'] = address.host;
+ var protocol = isTcp ? "TCP" : isUdp ? "UDP" : null;
+ var localAddress;
+ var localPort;
+ var remoteAddress;
+ var remotePort;
+ try {
+ localAddress = address.address;
+ } catch (e) { }
+ try {
+ localPort = port;
+ } catch (e) { }
+ try {
+ remoteAddress = this.remoteAddress.address;
+ } catch (e) { }
+ try {
+ remotePort = remotePort;
+ } catch (e) { }
+ r['localAddress'] = localAddress;
+ r['localPort'] = localPort;
+ r['remoteAddress'] = remoteAddress;
+ r['remotePort'] = remotePort;
+ r['protocol'] = protocol;
+ r['readClosed'] = isClosedRead;
+ r['writeClosed'] = isClosedWrite;
+ r['closing'] = isClosing;
+ r['listening'] = isListening;
r['fd'] = nativeGetSocketId();
if (owner != null) {
r['owner'] = owner._toJSON(true);
« no previous file with comments | « no previous file | runtime/bin/vmservice/client/deployed/web/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698