OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 | 5 |
6 final Map _servicePathMap = { | 6 final Map _servicePathMap = { |
7 'http' : { | 7 'http' : { |
8 'servers' : _httpServersServiceObject, | 8 'servers' : _httpServersServiceObject, |
9 }, | 9 }, |
10 'sockets' : _socketsServiceObject, | 10 'sockets' : _socketsServiceObject, |
| 11 'websockets' : _webSocketsServiceObject, |
11 'file' : { | 12 'file' : { |
12 'randomaccessfiles' : _randomAccessFilesServiceObject | 13 'randomaccessfiles' : _randomAccessFilesServiceObject |
13 }, | 14 }, |
14 'processes' : _processesServiceObject, | 15 'processes' : _processesServiceObject, |
15 }; | 16 }; |
16 | 17 |
17 String _serviceObjectHandler(List<String> paths, | 18 String _serviceObjectHandler(List<String> paths, |
18 List<String> keys, | 19 List<String> keys, |
19 List<String> values) { | 20 List<String> values) { |
20 assert(keys.length == values.length); | 21 assert(keys.length == values.length); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return socket._toJSON(false); | 75 return socket._toJSON(false); |
75 } | 76 } |
76 return { | 77 return { |
77 'id': 'io/sockets', | 78 'id': 'io/sockets', |
78 'type': 'SocketList', | 79 'type': 'SocketList', |
79 'members': _NativeSocket._sockets.values | 80 'members': _NativeSocket._sockets.values |
80 .map((socket) => socket._toJSON(true)).toList(), | 81 .map((socket) => socket._toJSON(true)).toList(), |
81 }; | 82 }; |
82 } | 83 } |
83 | 84 |
| 85 Map _webSocketsServiceObject(args) { |
| 86 if (args.length == 1) { |
| 87 var webSocket = _WebSocketImpl._webSockets[int.parse(args.first)]; |
| 88 if (webSocket == null) { |
| 89 return {}; |
| 90 } |
| 91 return webSocket._toJSON(false); |
| 92 } |
| 93 return { |
| 94 'id': 'io/websockets', |
| 95 'type': 'WebSocketList', |
| 96 'members': _WebSocketImpl._webSockets.values |
| 97 .map((webSocket) => webSocket._toJSON(true)).toList(), |
| 98 }; |
| 99 } |
| 100 |
84 Map _randomAccessFilesServiceObject(args) { | 101 Map _randomAccessFilesServiceObject(args) { |
85 if (args.length == 1) { | 102 if (args.length == 1) { |
86 var raf = _RandomAccessFile._files[int.parse(args.first)]; | 103 var raf = _RandomAccessFile._files[int.parse(args.first)]; |
87 if (raf == null) { | 104 if (raf == null) { |
88 return {}; | 105 return {}; |
89 } | 106 } |
90 return raf._toJSON(false); | 107 return raf._toJSON(false); |
91 } | 108 } |
92 return { | 109 return { |
93 'id': 'io/file/randomaccessfiles', | 110 'id': 'io/file/randomaccessfiles', |
(...skipping 11 matching lines...) Expand all Loading... |
105 } | 122 } |
106 return process._toJSON(false); | 123 return process._toJSON(false); |
107 } | 124 } |
108 return { | 125 return { |
109 'id': 'io/processes', | 126 'id': 'io/processes', |
110 'type': 'ProcessList', | 127 'type': 'ProcessList', |
111 'members': _ProcessImpl._processes.values | 128 'members': _ProcessImpl._processes.values |
112 .map((p) => p._toJSON(true)).toList(), | 129 .map((p) => p._toJSON(true)).toList(), |
113 }; | 130 }; |
114 } | 131 } |
OLD | NEW |