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 part of service; | 5 part of service; |
6 | 6 |
7 // Some value smaller than the object ring, so requesting a large array | 7 // Some value smaller than the object ring, so requesting a large array |
8 // doesn't result in an expired ref because the elements lapped it in the | 8 // doesn't result in an expired ref because the elements lapped it in the |
9 // object ring. | 9 // object ring. |
10 const int kDefaultFieldLimit = 100; | 10 const int kDefaultFieldLimit = 100; |
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 } | 1845 } |
1846 | 1846 |
1847 Future<ObjectStore> getObjectStore() { | 1847 Future<ObjectStore> getObjectStore() { |
1848 return invokeRpcNoUpgrade('_getObjectStore', {}).then((map) { | 1848 return invokeRpcNoUpgrade('_getObjectStore', {}).then((map) { |
1849 ObjectStore objectStore = new ObjectStore._empty(this); | 1849 ObjectStore objectStore = new ObjectStore._empty(this); |
1850 objectStore._update(map, false); | 1850 objectStore._update(map, false); |
1851 return objectStore; | 1851 return objectStore; |
1852 }); | 1852 }); |
1853 } | 1853 } |
1854 | 1854 |
1855 Future<ServiceObject> eval(ServiceObject target, String expression) { | 1855 Future<ServiceObject> eval(ServiceObject target, String expression, |
| 1856 {Map<String, ServiceObject> scope}) { |
1856 Map params = { | 1857 Map params = { |
1857 'targetId': target.id, | 1858 'targetId': target.id, |
1858 'expression': expression, | 1859 'expression': expression, |
1859 }; | 1860 }; |
| 1861 if (scope != null) { |
| 1862 Map<String, String> scopeWithIds = new Map(); |
| 1863 scope.forEach((String name, ServiceObject object) { |
| 1864 scopeWithIds[name] = object.id; |
| 1865 }); |
| 1866 params["scope"] = scopeWithIds; |
| 1867 } |
1860 return invokeRpc('evaluate', params); | 1868 return invokeRpc('evaluate', params); |
1861 } | 1869 } |
1862 | 1870 |
1863 Future<ServiceObject> evalFrame(int frameIndex, String expression) { | 1871 Future<ServiceObject> evalFrame(int frameIndex, String expression, |
| 1872 {Map<String, ServiceObject> scope}) { |
1864 Map params = { | 1873 Map params = { |
1865 'frameIndex': frameIndex, | 1874 'frameIndex': frameIndex, |
1866 'expression': expression, | 1875 'expression': expression, |
1867 }; | 1876 }; |
| 1877 if (scope != null) { |
| 1878 Map<String, String> scopeWithIds = new Map(); |
| 1879 scope.forEach((String name, ServiceObject object) { |
| 1880 scopeWithIds[name] = object.id; |
| 1881 }); |
| 1882 params["scope"] = scopeWithIds; |
| 1883 } |
1868 return invokeRpc('evaluateInFrame', params); | 1884 return invokeRpc('evaluateInFrame', params); |
1869 } | 1885 } |
1870 | 1886 |
1871 Future<ServiceObject> getReachableSize(ServiceObject target) { | 1887 Future<ServiceObject> getReachableSize(ServiceObject target) { |
1872 Map params = { | 1888 Map params = { |
1873 'targetId': target.id, | 1889 'targetId': target.id, |
1874 }; | 1890 }; |
1875 return invokeRpc('_getReachableSize', params); | 1891 return invokeRpc('_getReachableSize', params); |
1876 } | 1892 } |
1877 | 1893 |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 classes.addAll(map['classes']); | 2387 classes.addAll(map['classes']); |
2372 classes.sort(ServiceObject.LexicalSortName); | 2388 classes.sort(ServiceObject.LexicalSortName); |
2373 variables.clear(); | 2389 variables.clear(); |
2374 variables.addAll(map['variables']); | 2390 variables.addAll(map['variables']); |
2375 variables.sort(ServiceObject.LexicalSortName); | 2391 variables.sort(ServiceObject.LexicalSortName); |
2376 functions.clear(); | 2392 functions.clear(); |
2377 functions.addAll(map['functions']); | 2393 functions.addAll(map['functions']); |
2378 functions.sort(ServiceObject.LexicalSortName); | 2394 functions.sort(ServiceObject.LexicalSortName); |
2379 } | 2395 } |
2380 | 2396 |
2381 Future<ServiceObject> evaluate(String expression) { | 2397 Future<ServiceObject> evaluate(String expression, {Map scope}) { |
2382 return isolate.eval(this, expression); | 2398 return isolate.eval(this, expression, scope: scope); |
2383 } | 2399 } |
2384 | 2400 |
2385 Script get rootScript { | 2401 Script get rootScript { |
2386 for (Script script in scripts) { | 2402 for (Script script in scripts) { |
2387 if (script.uri == uri) return script; | 2403 if (script.uri == uri) return script; |
2388 } | 2404 } |
2389 return null; | 2405 return null; |
2390 } | 2406 } |
2391 | 2407 |
2392 String toString() => "Library($uri)"; | 2408 String toString() => "Library($uri)"; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2541 } | 2557 } |
2542 | 2558 |
2543 void _addSubclass(Class subclass) { | 2559 void _addSubclass(Class subclass) { |
2544 if (subclasses.contains(subclass)) { | 2560 if (subclasses.contains(subclass)) { |
2545 return; | 2561 return; |
2546 } | 2562 } |
2547 subclasses.add(subclass); | 2563 subclasses.add(subclass); |
2548 subclasses.sort(ServiceObject.LexicalSortName); | 2564 subclasses.sort(ServiceObject.LexicalSortName); |
2549 } | 2565 } |
2550 | 2566 |
2551 Future<ServiceObject> evaluate(String expression) { | 2567 Future<ServiceObject> evaluate(String expression, {Map scope}) { |
2552 return isolate.eval(this, expression); | 2568 return isolate.eval(this, expression, scope: scope); |
2553 } | 2569 } |
2554 | 2570 |
2555 Future<ServiceObject> setTraceAllocations(bool enable) { | 2571 Future<ServiceObject> setTraceAllocations(bool enable) { |
2556 return isolate.invokeRpc('_setTraceClassAllocation', { | 2572 return isolate.invokeRpc('_setTraceClassAllocation', { |
2557 'enable': enable, | 2573 'enable': enable, |
2558 'classId': id, | 2574 'classId': id, |
2559 }); | 2575 }); |
2560 } | 2576 } |
2561 | 2577 |
2562 Future<ServiceObject> getAllocationSamples([String tags = 'None']) { | 2578 Future<ServiceObject> getAllocationSamples([String tags = 'None']) { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2895 String get shortName { | 2911 String get shortName { |
2896 if (isClosure) { | 2912 if (isClosure) { |
2897 return closureFunction.qualifiedName; | 2913 return closureFunction.qualifiedName; |
2898 } | 2914 } |
2899 if (valueAsString != null) { | 2915 if (valueAsString != null) { |
2900 return valueAsString; | 2916 return valueAsString; |
2901 } | 2917 } |
2902 return 'a ${clazz.name}'; | 2918 return 'a ${clazz.name}'; |
2903 } | 2919 } |
2904 | 2920 |
2905 Future<ServiceObject> evaluate(String expression) { | 2921 Future<ServiceObject> evaluate(String expression, {Map scope}) { |
2906 return isolate.eval(this, expression); | 2922 return isolate.eval(this, expression, scope: scope); |
2907 } | 2923 } |
2908 | 2924 |
2909 String toString() => 'Instance($shortName)'; | 2925 String toString() => 'Instance($shortName)'; |
2910 } | 2926 } |
2911 | 2927 |
2912 class Context extends HeapObject implements M.Context { | 2928 class Context extends HeapObject implements M.Context { |
2913 Context parentContext; | 2929 Context parentContext; |
2914 int length; | 2930 int length; |
2915 Iterable<ContextElement> variables; | 2931 Iterable<ContextElement> variables; |
2916 | 2932 |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4628 var v = list[i]; | 4644 var v = list[i]; |
4629 if ((v is Map) && _isServiceMap(v)) { | 4645 if ((v is Map) && _isServiceMap(v)) { |
4630 list[i] = owner.getFromMap(v); | 4646 list[i] = owner.getFromMap(v); |
4631 } else if (v is List) { | 4647 } else if (v is List) { |
4632 _upgradeList(v, owner); | 4648 _upgradeList(v, owner); |
4633 } else if (v is Map) { | 4649 } else if (v is Map) { |
4634 _upgradeMap(v, owner); | 4650 _upgradeMap(v, owner); |
4635 } | 4651 } |
4636 } | 4652 } |
4637 } | 4653 } |
OLD | NEW |