| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 wrapper on top of the [IncrementalKernelGenerator] that tracks | 5 /// A wrapper on top of the [IncrementalKernelGenerator] that tracks |
| 6 /// file modifications between subsequent compilation requests and only | 6 /// file modifications between subsequent compilation requests and only |
| 7 /// invalidates those files that appear to be modified. | 7 /// invalidates those files that appear to be modified. |
| 8 library front_end.example.incremental_reload.compiler_with_invalidation; | 8 library front_end.example.incremental_reload.compiler_with_invalidation; |
| 9 | 9 |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 _generator.invalidate(uri); | 100 _generator.invalidate(uri); |
| 101 changed++; | 101 changed++; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 invalidateTimer.stop(); | 104 invalidateTimer.stop(); |
| 105 invalidateTime = invalidateTimer.elapsedMilliseconds; | 105 invalidateTime = invalidateTimer.elapsedMilliseconds; |
| 106 if (changed == 0 && lastModified.isNotEmpty) return null; | 106 if (changed == 0 && lastModified.isNotEmpty) return null; |
| 107 | 107 |
| 108 var compileTimer = new Stopwatch()..start(); | 108 var compileTimer = new Stopwatch()..start(); |
| 109 var delta = await _generator.computeDelta(); | 109 var delta = await _generator.computeDelta(); |
| 110 _generator.acceptLastDelta(); |
| 110 compileTimer.stop(); | 111 compileTimer.stop(); |
| 111 compileTime = compileTimer.elapsedMilliseconds; | 112 compileTime = compileTimer.elapsedMilliseconds; |
| 112 var program = delta.newProgram; | 113 var program = delta.newProgram; |
| 113 return program; | 114 return program; |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 | 117 |
| 117 /// The result of an incremental compile and metrics collected during the | 118 /// The result of an incremental compile and metrics collected during the |
| 118 /// the compilation. | 119 /// the compilation. |
| 119 class CompilationResult { | 120 class CompilationResult { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 result.errorSeen = true; | 163 result.errorSeen = true; |
| 163 } | 164 } |
| 164 | 165 |
| 165 result.changed = compiler.changed; | 166 result.changed = compiler.changed; |
| 166 result.totalFiles = compiler.lastModified.length; | 167 result.totalFiles = compiler.lastModified.length; |
| 167 result.invalidateTime = compiler.invalidateTime; | 168 result.invalidateTime = compiler.invalidateTime; |
| 168 result.compileTime = compiler.compileTime; | 169 result.compileTime = compiler.compileTime; |
| 169 result.reloadTime = 0; | 170 result.reloadTime = 0; |
| 170 return result; | 171 return result; |
| 171 } | 172 } |
| OLD | NEW |