| 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 analyzer.instrumentation.instrumentation; | 5 library analyzer.instrumentation.instrumentation; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:analyzer/task/model.dart'; | 10 import 'package:analyzer/task/model.dart'; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 buffer.write(field.substring(start)); | 313 buffer.write(field.substring(start)); |
| 314 } | 314 } |
| 315 | 315 |
| 316 /** | 316 /** |
| 317 * Return the result of joining the values of the given fields, escaping the | 317 * Return the result of joining the values of the given fields, escaping the |
| 318 * separator character by doubling it. | 318 * separator character by doubling it. |
| 319 */ | 319 */ |
| 320 String _join(List<String> fields) { | 320 String _join(List<String> fields) { |
| 321 StringBuffer buffer = new StringBuffer(); | 321 StringBuffer buffer = new StringBuffer(); |
| 322 buffer.write(_timestamp); | 322 buffer.write(_timestamp); |
| 323 for (String field in fields) { | 323 int length = fields.length; |
| 324 for (int i = 0; i < length; i++) { |
| 324 buffer.write(':'); | 325 buffer.write(':'); |
| 325 _escape(buffer, field); | 326 _escape(buffer, fields[i]); |
| 326 } | 327 } |
| 327 return buffer.toString(); | 328 return buffer.toString(); |
| 328 } | 329 } |
| 329 | 330 |
| 330 /** | 331 /** |
| 331 * Log the given message with the given tag. | 332 * Log the given message with the given tag. |
| 332 */ | 333 */ |
| 333 void _log(String tag, String message) { | 334 void _log(String tag, String message) { |
| 334 if (_instrumentationServer != null) { | 335 if (_instrumentationServer != null) { |
| 335 _instrumentationServer.log(_join([tag, message])); | 336 _instrumentationServer.log(_join([tag, message])); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 370 } |
| 370 } | 371 } |
| 371 | 372 |
| 372 @override | 373 @override |
| 373 Future shutdown() async { | 374 Future shutdown() async { |
| 374 for (InstrumentationServer server in _servers) { | 375 for (InstrumentationServer server in _servers) { |
| 375 await server.shutdown(); | 376 await server.shutdown(); |
| 376 } | 377 } |
| 377 } | 378 } |
| 378 } | 379 } |
| OLD | NEW |