| 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 /// A library for code coverage support for Dart. | 5 /// A library for code coverage support for Dart. |
| 6 library runtime.coverage.impl; | 6 library runtime.coverage.impl; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:collection' show SplayTreeMap; | 9 import 'dart:collection' show SplayTreeMap; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 | 113 |
| 114 String getFilePath(Uri uri) { | 114 String getFilePath(Uri uri) { |
| 115 var path = uri.path; | 115 var path = uri.path; |
| 116 path = pathos.joinAll(uri.pathSegments); | 116 path = pathos.joinAll(uri.pathSegments); |
| 117 path = pathos.join(basePath, path); | 117 path = pathos.join(basePath, path); |
| 118 return pathos.normalize(path); | 118 return pathos.normalize(path); |
| 119 } | 119 } |
| 120 | 120 |
| 121 Future sendFile(HttpRequest request, File file) { | 121 Future sendFile(HttpRequest request, File file) { |
| 122 file.resolveSymbolicLinks().then((fullPath) { | 122 return file.resolveSymbolicLinks().then((fullPath) { |
| 123 return file.openRead().pipe(request.response); | 123 return file.openRead().pipe(request.response); |
| 124 }); | 124 }); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool shouldRewriteFile(String path); | 127 bool shouldRewriteFile(String path); |
| 128 | 128 |
| 129 /// Subclasses implement this method to rewrite the provided [code] of the | 129 /// Subclasses implement this method to rewrite the provided [code] of the |
| 130 /// file with [path]. Returns some content or `null` if file content | 130 /// file with [path]. Returns some content or `null` if file content |
| 131 /// should be requested. | 131 /// should be requested. |
| 132 String rewritePathContent(String path); | 132 String rewritePathContent(String path); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 var lastOffset = 0; | 330 var lastOffset = 0; |
| 331 offsetFragmentMap.forEach((offset, fragment) { | 331 offsetFragmentMap.forEach((offset, fragment) { |
| 332 sb.write(_code.substring(lastOffset, offset)); | 332 sb.write(_code.substring(lastOffset, offset)); |
| 333 sb.write(fragment); | 333 sb.write(fragment); |
| 334 lastOffset = offset; | 334 lastOffset = offset; |
| 335 }); | 335 }); |
| 336 sb.write(_code.substring(lastOffset, _code.length)); | 336 sb.write(_code.substring(lastOffset, _code.length)); |
| 337 return sb.toString(); | 337 return sb.toString(); |
| 338 } | 338 } |
| 339 } | 339 } |
| OLD | NEW |