| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:observatory/models.dart' as M; | 5 import 'package:observatory/models.dart' as M; |
| 6 | 6 |
| 7 /// Utility class for URIs generation. | 7 /// Utility class for URIs generation. |
| 8 abstract class Uris { | 8 abstract class Uris { |
| 9 static String _isolatePage(String path, M.IsolateRef isolate, | 9 static String _isolatePage(String path, M.IsolateRef isolate, |
| 10 {M.ObjectRef object}) { | 10 {M.ObjectRef object}) { |
| 11 final parameters = { 'isolateId': isolate.id }; | 11 final parameters = {'isolateId': isolate.id}; |
| 12 if (object != null) parameters['objectId'] = object.id; | 12 if (object != null) parameters['objectId'] = object.id; |
| 13 return '#' + new Uri(path: path, queryParameters: parameters).toString(); | 13 return '#' + new Uri(path: path, queryParameters: parameters).toString(); |
| 14 } | 14 } |
| 15 | 15 |
| 16 static String allocationProfiler(M.IsolateRef isolate) | 16 static String allocationProfiler(M.IsolateRef isolate) => |
| 17 => _isolatePage('/allocation-profiler', isolate); | 17 _isolatePage('/allocation-profiler', isolate); |
| 18 static String classTree(M.IsolateRef isolate) | 18 static String classTree(M.IsolateRef isolate) => |
| 19 => _isolatePage('/class-tree', isolate); | 19 _isolatePage('/class-tree', isolate); |
| 20 static String cpuProfiler(M.IsolateRef isolate) | 20 static String cpuProfiler(M.IsolateRef isolate) => |
| 21 => _isolatePage('/profiler', isolate); | 21 _isolatePage('/profiler', isolate); |
| 22 static String cpuProfilerTable(M.IsolateRef isolate) | 22 static String cpuProfilerTable(M.IsolateRef isolate) => |
| 23 => _isolatePage('/profiler-table', isolate); | 23 _isolatePage('/profiler-table', isolate); |
| 24 static String debugger(M.IsolateRef isolate) | 24 static String debugger(M.IsolateRef isolate) => |
| 25 => _isolatePage('/debugger', isolate); | 25 _isolatePage('/debugger', isolate); |
| 26 static String flags() => '#/flags'; | 26 static String flags() => '#/flags'; |
| 27 static String heapMap(M.IsolateRef isolate) | 27 static String heapMap(M.IsolateRef isolate) => |
| 28 => _isolatePage('/heap-map', isolate); | 28 _isolatePage('/heap-map', isolate); |
| 29 static String heapSnapshot(M.IsolateRef isolate) | 29 static String heapSnapshot(M.IsolateRef isolate) => |
| 30 => _isolatePage('/heap-snapshot', isolate); | 30 _isolatePage('/heap-snapshot', isolate); |
| 31 static String inspect(M.IsolateRef isolate, {M.ObjectRef object, int pos}) { | 31 static String inspect(M.IsolateRef isolate, {M.ObjectRef object, int pos}) { |
| 32 if (pos == null) { | 32 if (pos == null) { |
| 33 return _isolatePage('/inspect', isolate, object: object); | 33 return _isolatePage('/inspect', isolate, object: object); |
| 34 } | 34 } |
| 35 return _isolatePage('/inspect', isolate, object: object) + '---pos=${pos}'; | 35 return _isolatePage('/inspect', isolate, object: object) + '---pos=${pos}'; |
| 36 } | 36 } |
| 37 static String logging(M.IsolateRef isolate) | 37 |
| 38 => _isolatePage('/logging', isolate); | 38 static String logging(M.IsolateRef isolate) => |
| 39 static String metrics(M.IsolateRef isolate) | 39 _isolatePage('/logging', isolate); |
| 40 => _isolatePage('/metrics', isolate); | 40 static String metrics(M.IsolateRef isolate) => |
| 41 static String objectStore(M.IsolateRef isolate) | 41 _isolatePage('/metrics', isolate); |
| 42 => _isolatePage('/object-store', isolate); | 42 static String objectStore(M.IsolateRef isolate) => |
| 43 static String persistentHandles(M.IsolateRef isolate) | 43 _isolatePage('/object-store', isolate); |
| 44 => _isolatePage('/persistent-handles', isolate); | 44 static String persistentHandles(M.IsolateRef isolate) => |
| 45 static String ports(M.IsolateRef isolate) | 45 _isolatePage('/persistent-handles', isolate); |
| 46 => _isolatePage('/ports', isolate); | 46 static String ports(M.IsolateRef isolate) => _isolatePage('/ports', isolate); |
| 47 static String timeline() => '#/timeline'; | 47 static String timeline() => '#/timeline'; |
| 48 static String vm() => '#/vm'; | 48 static String vm() => '#/vm'; |
| 49 static String vmConnect() => '#/vm-connect'; | 49 static String vmConnect() => '#/vm-connect'; |
| 50 } | 50 } |
| OLD | NEW |