| 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 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 }).whenComplete(() { | 1087 }).whenComplete(() { |
| 1088 _inProgressReloadBpts = null; | 1088 _inProgressReloadBpts = null; |
| 1089 }); | 1089 }); |
| 1090 } | 1090 } |
| 1091 return _inProgressReloadBpts; | 1091 return _inProgressReloadBpts; |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 Future<ServiceObject> addBreakpoint(Script script, int line) { | 1094 Future<ServiceObject> addBreakpoint(Script script, int line) { |
| 1095 // TODO(turnidge): Pass line as an int instead of a string. | 1095 // TODO(turnidge): Pass line as an int instead of a string. |
| 1096 Map params = { | 1096 Map params = { |
| 1097 'script': script.id, | 1097 'scriptId': script.id, |
| 1098 'line': '$line', | 1098 'line': '$line', |
| 1099 }; | 1099 }; |
| 1100 return invokeRpc('addBreakpoint', params).then((result) { | 1100 return invokeRpc('addBreakpoint', params).then((result) { |
| 1101 if (result is DartError) { | 1101 if (result is DartError) { |
| 1102 return result; | 1102 return result; |
| 1103 } | 1103 } |
| 1104 Breakpoint bpt = result; | 1104 Breakpoint bpt = result; |
| 1105 if (bpt.resolved && | 1105 if (bpt.resolved && |
| 1106 script.loaded && | 1106 script.loaded && |
| 1107 script.tokenToLine(result.tokenPos) != line) { | 1107 script.tokenToLine(result.tokenPos) != line) { |
| 1108 // Unable to set a breakpoint at desired line. | 1108 // Unable to set a breakpoint at desired line. |
| 1109 script.lines[line - 1].possibleBpt = false; | 1109 script.lines[line - 1].possibleBpt = false; |
| 1110 } | 1110 } |
| 1111 // TODO(turnidge): Instead of reloading all of the breakpoints, | 1111 // TODO(turnidge): Instead of reloading all of the breakpoints, |
| 1112 // rely on events to update the breakpoint list. | 1112 // rely on events to update the breakpoint list. |
| 1113 return reloadBreakpoints().then((_) { | 1113 return reloadBreakpoints().then((_) { |
| 1114 return result; | 1114 return result; |
| 1115 }); | 1115 }); |
| 1116 }); | 1116 }); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 Future<ServiceObject> addBreakpointAtEntry(ServiceFunction function) { |
| 1120 return invokeRpc('addBreakpointAtEntry', |
| 1121 { 'functionId': function.id }).then((result) { |
| 1122 // TODO(turnidge): Instead of reloading all of the breakpoints, |
| 1123 // rely on events to update the breakpoint list. |
| 1124 return reloadBreakpoints().then((_) { |
| 1125 return result; |
| 1126 }); |
| 1127 }); |
| 1128 } |
| 1129 |
| 1119 Future removeBreakpoint(Breakpoint bpt) { | 1130 Future removeBreakpoint(Breakpoint bpt) { |
| 1120 return invokeRpc('removeBreakpoint', | 1131 return invokeRpc('removeBreakpoint', |
| 1121 { 'breakpointId': bpt.id }).then((result) { | 1132 { 'breakpointId': bpt.id }).then((result) { |
| 1122 if (result is DartError) { | 1133 if (result is DartError) { |
| 1123 // TODO(turnidge): Handle this more gracefully. | 1134 // TODO(turnidge): Handle this more gracefully. |
| 1124 Logger.root.severe(result.message); | 1135 Logger.root.severe(result.message); |
| 1125 return result; | 1136 return result; |
| 1126 } | 1137 } |
| 1127 if (pauseEvent != null && | 1138 if (pauseEvent != null && |
| 1128 pauseEvent.breakpoint != null && | 1139 pauseEvent.breakpoint != null && |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 var v = list[i]; | 2918 var v = list[i]; |
| 2908 if ((v is ObservableMap) && _isServiceMap(v)) { | 2919 if ((v is ObservableMap) && _isServiceMap(v)) { |
| 2909 list[i] = owner.getFromMap(v); | 2920 list[i] = owner.getFromMap(v); |
| 2910 } else if (v is ObservableList) { | 2921 } else if (v is ObservableList) { |
| 2911 _upgradeObservableList(v, owner); | 2922 _upgradeObservableList(v, owner); |
| 2912 } else if (v is ObservableMap) { | 2923 } else if (v is ObservableMap) { |
| 2913 _upgradeObservableMap(v, owner); | 2924 _upgradeObservableMap(v, owner); |
| 2914 } | 2925 } |
| 2915 } | 2926 } |
| 2916 } | 2927 } |
| OLD | NEW |