| 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 inspect(M.IsolateRef isolate, {M.ObjectRef object}) | 16 static String inspect(M.IsolateRef isolate, {M.ObjectRef object, int pos}) { |
| 17 => _isolatePage('/inspect', isolate, object: object); | 17 if (pos == null) { |
| 18 return _isolatePage('/inspect', isolate, object: object); |
| 19 } |
| 20 return _isolatePage('/inspect', isolate, object: object) + '---pos=${pos}'; |
| 21 } |
| 18 static String debugger(M.IsolateRef isolate) | 22 static String debugger(M.IsolateRef isolate) |
| 19 => _isolatePage('/debugger', isolate); | 23 => _isolatePage('/debugger', isolate); |
| 20 static String classTree(M.IsolateRef isolate) | 24 static String classTree(M.IsolateRef isolate) |
| 21 => _isolatePage('/class-tree', isolate); | 25 => _isolatePage('/class-tree', isolate); |
| 22 static String cpuProfiler(M.IsolateRef isolate) | 26 static String cpuProfiler(M.IsolateRef isolate) |
| 23 => _isolatePage('/profiler', isolate); | 27 => _isolatePage('/profiler', isolate); |
| 24 static String cpuProfilerTable(M.IsolateRef isolate) | 28 static String cpuProfilerTable(M.IsolateRef isolate) |
| 25 => _isolatePage('/profiler-table', isolate); | 29 => _isolatePage('/profiler-table', isolate); |
| 26 static String allocationProfiler(M.IsolateRef isolate) | 30 static String allocationProfiler(M.IsolateRef isolate) |
| 27 => _isolatePage('/allocation-profiler', isolate); | 31 => _isolatePage('/allocation-profiler', isolate); |
| 28 static String heapMap(M.IsolateRef isolate) | 32 static String heapMap(M.IsolateRef isolate) |
| 29 => _isolatePage('/heap-map', isolate); | 33 => _isolatePage('/heap-map', isolate); |
| 30 static String metrics(M.IsolateRef isolate) | 34 static String metrics(M.IsolateRef isolate) |
| 31 => _isolatePage('/metrics', isolate); | 35 => _isolatePage('/metrics', isolate); |
| 32 static String heapSnapshot(M.IsolateRef isolate) | 36 static String heapSnapshot(M.IsolateRef isolate) |
| 33 => _isolatePage('/heap-snapshot', isolate); | 37 => _isolatePage('/heap-snapshot', isolate); |
| 34 static String persistentHandles(M.IsolateRef isolate) | 38 static String persistentHandles(M.IsolateRef isolate) |
| 35 => _isolatePage('/persistent-handles', isolate); | 39 => _isolatePage('/persistent-handles', isolate); |
| 36 static String ports(M.IsolateRef isolate) | 40 static String ports(M.IsolateRef isolate) |
| 37 => _isolatePage('/ports', isolate); | 41 => _isolatePage('/ports', isolate); |
| 38 static String logging(M.IsolateRef isolate) | 42 static String logging(M.IsolateRef isolate) |
| 39 => _isolatePage('/logging', isolate); | 43 => _isolatePage('/logging', isolate); |
| 40 static String vm() => '#/vm'; | 44 static String vm() => '#/vm'; |
| 41 static String vmConnect() => '#/vm-connect'; | 45 static String vmConnect() => '#/vm-connect'; |
| 42 } | 46 } |
| OLD | NEW |