| 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 library instrumentation; | 5 library instrumentation; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * The interface used by client code to communicate with an instrumentation | 8 * The interface used by client code to communicate with an instrumentation |
| 9 * server. | 9 * server. |
| 10 */ | 10 */ |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 * should be invoked on this instance after this method has been invoked. | 128 * should be invoked on this instance after this method has been invoked. |
| 129 */ | 129 */ |
| 130 void shutdown() { | 130 void shutdown() { |
| 131 if (_instrumentationServer != null) { | 131 if (_instrumentationServer != null) { |
| 132 _instrumentationServer.shutdown(); | 132 _instrumentationServer.shutdown(); |
| 133 _instrumentationServer = null; | 133 _instrumentationServer = null; |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * Write an escaped version of the given [string] to the given [buffer]. | 138 * Write an escaped version of the given [field] to the given [buffer]. |
| 139 */ | 139 */ |
| 140 void _escape(StringBuffer buffer, String field) { | 140 void _escape(StringBuffer buffer, String field) { |
| 141 int index = field.indexOf(':'); | 141 int index = field.indexOf(':'); |
| 142 if (index < 0) { | 142 if (index < 0) { |
| 143 buffer.write(field); | 143 buffer.write(field); |
| 144 return; | 144 return; |
| 145 } | 145 } |
| 146 int start = 0; | 146 int start = 0; |
| 147 while (index > 0) { | 147 while (index >= 0) { |
| 148 buffer.write(field.substring(start, index)); | 148 buffer.write(field.substring(start, index)); |
| 149 buffer.write('::'); | 149 buffer.write('::'); |
| 150 start = index + 1; | 150 start = index + 1; |
| 151 index = field.indexOf(':', start); | 151 index = field.indexOf(':', start); |
| 152 } | 152 } |
| 153 buffer.write(field.substring(start)); | 153 buffer.write(field.substring(start)); |
| 154 } | 154 } |
| 155 | 155 |
| 156 /** | 156 /** |
| 157 * Return the result of joining the values of the given fields, escaping the | 157 * Return the result of joining the values of the given fields, escaping the |
| (...skipping 21 matching lines...) Expand all Loading... |
| 179 /** | 179 /** |
| 180 * Convert the given [object] to a string. | 180 * Convert the given [object] to a string. |
| 181 */ | 181 */ |
| 182 String _toString(Object object) { | 182 String _toString(Object object) { |
| 183 if (object == null) { | 183 if (object == null) { |
| 184 return 'null'; | 184 return 'null'; |
| 185 } | 185 } |
| 186 return object.toString(); | 186 return object.toString(); |
| 187 } | 187 } |
| 188 } | 188 } |
| OLD | NEW |