| 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 /// A [ServiceObject] represents a persistent object within the vm. | 7 /// A [ServiceObject] represents a persistent object within the vm. |
| 8 abstract class ServiceObject extends Observable { | 8 abstract class ServiceObject extends Observable { |
| 9 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { | 9 static int LexicalSortName(ServiceObject o1, ServiceObject o2) { |
| 10 return o1.name.compareTo(o2.name); | 10 return o1.name.compareTo(o2.name); |
| (...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 }).whenComplete(() { | 1084 }).whenComplete(() { |
| 1085 _inProgressReloadBpts = null; | 1085 _inProgressReloadBpts = null; |
| 1086 }); | 1086 }); |
| 1087 } | 1087 } |
| 1088 return _inProgressReloadBpts; | 1088 return _inProgressReloadBpts; |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 Future<ServiceObject> addBreakpoint(Script script, int line) { | 1091 Future<ServiceObject> addBreakpoint(Script script, int line) { |
| 1092 // TODO(turnidge): Pass line as an int instead of a string. | 1092 // TODO(turnidge): Pass line as an int instead of a string. |
| 1093 return invokeRpc('addBreakpoint', | 1093 return invokeRpc('addBreakpoint', |
| 1094 { 'script': script.id, 'line': '$line' }).then((result) { | 1094 { 'scriptId': script.id, 'line': '$line' }).then((result) { |
| 1095 if (result is ServiceMap && | 1095 if (result is ServiceMap && |
| 1096 result.type == 'Breakpoint' && | 1096 result.type == 'Breakpoint' && |
| 1097 result['resolved'] && | 1097 result['resolved'] && |
| 1098 script.loaded && | 1098 script.loaded && |
| 1099 script.tokenToLine(result['location']['tokenPos']) != line) { | 1099 script.tokenToLine(result['location']['tokenPos']) != line) { |
| 1100 // Unable to set a breakpoint at desired line. | 1100 // Unable to set a breakpoint at desired line. |
| 1101 script.lines[line - 1].possibleBpt = false; | 1101 script.lines[line - 1].possibleBpt = false; |
| 1102 } | 1102 } |
| 1103 // TODO(turnidge): Instead of reloading all of the breakpoints, | 1103 // TODO(turnidge): Instead of reloading all of the breakpoints, |
| 1104 // rely on events to update the breakpoint list. | 1104 // rely on events to update the breakpoint list. |
| 1105 return reloadBreakpoints().then((_) { | 1105 return reloadBreakpoints().then((_) { |
| 1106 return result; | 1106 return result; |
| 1107 }); | 1107 }); |
| 1108 }); | 1108 }); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 Future<ServiceObject> addBreakpointAtEntry(ServiceFunction function) { |
| 1112 return invokeRpc('addBreakpointAtEntry', |
| 1113 { 'functionId': function.id }).then((result) { |
| 1114 // TODO(turnidge): Instead of reloading all of the breakpoints, |
| 1115 // rely on events to update the breakpoint list. |
| 1116 return reloadBreakpoints().then((_) { |
| 1117 return result; |
| 1118 }); |
| 1119 }); |
| 1120 } |
| 1121 |
| 1111 Future removeBreakpoint(ServiceMap bpt) { | 1122 Future removeBreakpoint(ServiceMap bpt) { |
| 1112 return invokeRpc('removeBreakpoint', | 1123 return invokeRpc('removeBreakpoint', |
| 1113 { 'breakpointId': bpt.id }).then((result) { | 1124 { 'breakpointId': bpt.id }).then((result) { |
| 1114 if (result is DartError) { | 1125 if (result is DartError) { |
| 1115 // TODO(turnidge): Handle this more gracefully. | 1126 // TODO(turnidge): Handle this more gracefully. |
| 1116 Logger.root.severe(result.message); | 1127 Logger.root.severe(result.message); |
| 1117 } | 1128 } |
| 1118 if (pauseEvent != null && | 1129 if (pauseEvent != null && |
| 1119 pauseEvent.breakpoint != null && | 1130 pauseEvent.breakpoint != null && |
| 1120 (pauseEvent.breakpoint['id'] == bpt['id'])) { | 1131 (pauseEvent.breakpoint['id'] == bpt['id'])) { |
| (...skipping 1737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2858 var v = list[i]; | 2869 var v = list[i]; |
| 2859 if ((v is ObservableMap) && _isServiceMap(v)) { | 2870 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 2860 list[i] = owner.getFromMap(v); | 2871 list[i] = owner.getFromMap(v); |
| 2861 } else if (v is ObservableList) { | 2872 } else if (v is ObservableList) { |
| 2862 _upgradeObservableList(v, owner); | 2873 _upgradeObservableList(v, owner); |
| 2863 } else if (v is ObservableMap) { | 2874 } else if (v is ObservableMap) { |
| 2864 _upgradeObservableMap(v, owner); | 2875 _upgradeObservableMap(v, owner); |
| 2865 } | 2876 } |
| 2866 } | 2877 } |
| 2867 } | 2878 } |
| OLD | NEW |