| 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 'file' : { | 11 'file' : { |
| 12 'randomaccessfiles' : _randomAccessFilesServiceObject | 12 'randomaccessfiles' : _randomAccessFilesServiceObject |
| 13 } | 13 }, |
| 14 'processes' : _processesServiceObject, |
| 14 }; | 15 }; |
| 15 | 16 |
| 16 String _serviceObjectHandler(List<String> paths, | 17 String _serviceObjectHandler(List<String> paths, |
| 17 List<String> keys, | 18 List<String> keys, |
| 18 List<String> values) { | 19 List<String> values) { |
| 19 assert(keys.length == values.length); | 20 assert(keys.length == values.length); |
| 20 badPath() { | 21 badPath() { |
| 21 throw "Invalid path '${paths.join("/")}'"; | 22 throw "Invalid path '${paths.join("/")}'"; |
| 22 } | 23 } |
| 23 if (paths.isEmpty) { | 24 if (paths.isEmpty) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 return raf._toJSON(false); | 90 return raf._toJSON(false); |
| 90 } | 91 } |
| 91 return { | 92 return { |
| 92 'id': 'io/file/randomaccessfiles', | 93 'id': 'io/file/randomaccessfiles', |
| 93 'type': 'RandomAccessFileList', | 94 'type': 'RandomAccessFileList', |
| 94 'members': _RandomAccessFile._files.values | 95 'members': _RandomAccessFile._files.values |
| 95 .map((raf) => raf._toJSON(true)).toList(), | 96 .map((raf) => raf._toJSON(true)).toList(), |
| 96 }; | 97 }; |
| 97 } | 98 } |
| 98 | 99 |
| 100 Map _processesServiceObject(args) { |
| 101 if (args.length == 1) { |
| 102 var process = _ProcessImpl._processes[int.parse(args.first)]; |
| 103 if (process == null) { |
| 104 return {}; |
| 105 } |
| 106 return process._toJSON(false); |
| 107 } |
| 108 return { |
| 109 'id': 'io/processes', |
| 110 'type': 'ProcessList', |
| 111 'members': _ProcessImpl._processes.values |
| 112 .map((p) => p._toJSON(true)).toList(), |
| 113 }; |
| 114 } |
| OLD | NEW |