| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// This library is injected into the applications under coverage. | 5 /// This library is injected into the applications under coverage. |
| 6 library coverage_lib; | 6 library coverage_lib; |
| 7 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:typed_data'; | 9 import 'dart:typed_data'; |
| 10 | 10 |
| 11 const PORT = 0; // replaced during rewrite | 11 const PORT = 0; // replaced during rewrite |
| 12 final _executedIds = new Uint8List(1024 * 64); | 12 final _executedIds = new Uint8List(1024 * 64); |
| 13 | 13 |
| 14 touch(int id) { | 14 touch(int id) { |
| 15 int listIndex = id ~/ 8; | 15 int listIndex = id ~/ 8; |
| 16 int bitIndex = id % 8; | 16 int bitIndex = id % 8; |
| 17 _executedIds[listIndex] |= 1 << bitIndex; | 17 _executedIds[listIndex] |= 1 << bitIndex; |
| 18 } | 18 } |
| 19 | 19 |
| 20 postStatistics() { | 20 postStatistics() { |
| 21 var httpClient = new HttpClient(); | 21 var httpClient = new HttpClient(); |
| 22 return httpClient.post('127.0.0.1', PORT, '/statistics') | 22 return httpClient.post('127.0.0.1', PORT, '/statistics') |
| 23 .then((request) { | 23 .then((request) { |
| 24 request.add(_executedIds); | 24 request.add(_executedIds); |
| 25 return request.close(); | 25 return request.close(); |
| 26 }); | 26 }); |
| 27 } | 27 } |
| OLD | NEW |