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

Unified Diff: runtime/bin/socket_patch.dart

Issue 300883002: Add Proces owner of socket and fix printing of non-network sockets (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 | « runtime/bin/service_object_patch.dart ('k') | runtime/bin/vmservice/client/HACKING.txt » ('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 b7cf745e99b69b154b968bbef340d848f39fe701..6aa9ce5661550fd8f8a1f8f4014a0cbb0fa804c0 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -612,7 +612,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
_NativeSocket.normal() : typeFlags = TYPE_NORMAL_SOCKET | TYPE_TCP_SOCKET;
- _NativeSocket.listen() : super(), typeFlags = TYPE_LISTENING_SOCKET | TYPE_TCP_SOCKET;
+ _NativeSocket.listen() : typeFlags = TYPE_LISTENING_SOCKET | TYPE_TCP_SOCKET;
_NativeSocket.pipe() : typeFlags = TYPE_PIPE;
@@ -1071,7 +1071,41 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
String get _serviceTypePath => 'io/sockets';
String get _serviceTypeName => 'Socket';
- Map _toJSON(bool ref) {
+ String _JSONKind() {
+ 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 r = {
+ 'id': _servicePath,
+ 'type': _serviceType(ref),
+ 'name': name,
+ 'user_name': name,
+ 'kind': _JSONKind(),
+ };
+ if (ref) {
+ return r;
+ }
+ r['fd'] = nativeGetSocketId();
+ if (owner != null) {
+ r['owner'] = owner._toJSON(true);
+ }
+ return r;
+ }
+
+ Map _toJSONNetwork(bool ref) {
var name = '${address.host}:$port';
if (isTcp && !isListening) name += " <-> ${remoteAddress.host}:$remotePort";
var r = {
@@ -1079,6 +1113,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
'type': _serviceType(ref),
'name': name,
'user_name': name,
+ 'kind': _JSONKind(),
};
if (ref) {
return r;
@@ -1092,6 +1127,13 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
return r;
}
+ Map _toJSON(bool ref) {
+ if (isPipe) {
+ return _toJSONPipe(ref);
+ }
+ return _toJSONNetwork(ref);
+ }
+
void nativeSetSocketId(int id) native "Socket_SetSocketId";
nativeAvailable() native "Socket_Available";
nativeRead(int len) native "Socket_Read";
« no previous file with comments | « runtime/bin/service_object_patch.dart ('k') | runtime/bin/vmservice/client/HACKING.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698