| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 dart2js.serialization_helper; | 5 library dart2js.serialization_helper; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:compiler/src/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 class SerializationResult { | 142 class SerializationResult { |
| 143 final Compiler compiler; | 143 final Compiler compiler; |
| 144 final SerializedData serializedData; | 144 final SerializedData serializedData; |
| 145 | 145 |
| 146 SerializationResult(this.compiler, this.serializedData); | 146 SerializationResult(this.compiler, this.serializedData); |
| 147 } | 147 } |
| 148 | 148 |
| 149 Future<SerializationResult> serialize(Uri entryPoint, | 149 Future<SerializationResult> serialize(Uri entryPoint, |
| 150 {Map<String, String> memorySourceFiles: const <String, String>{}, | 150 {Map<String, String> memorySourceFiles: const <String, String>{}, |
| 151 List<Uri> resolutionInputs: const <Uri>[], | 151 List<Uri> resolutionInputs: const <Uri>[], |
| 152 Uri dataUri}) async { | 152 Uri dataUri, |
| 153 bool deserializeCompilationDataForTesting: false}) async { |
| 153 if (dataUri == null) { | 154 if (dataUri == null) { |
| 154 dataUri = Uri.parse('memory:${DEFAULT_DATA_FILE_NAME}'); | 155 dataUri = Uri.parse('memory:${DEFAULT_DATA_FILE_NAME}'); |
| 155 } | 156 } |
| 156 OutputCollector outputCollector = new OutputCollector(); | 157 OutputCollector outputCollector = new OutputCollector(); |
| 157 Compiler compiler = compilerFor( | 158 Compiler compiler = compilerFor( |
| 158 options: [Flags.resolveOnly], | 159 options: [Flags.resolveOnly], |
| 159 memorySourceFiles: memorySourceFiles, | 160 memorySourceFiles: memorySourceFiles, |
| 160 resolutionInputs: resolutionInputs, | 161 resolutionInputs: resolutionInputs, |
| 161 outputProvider: outputCollector); | 162 outputProvider: outputCollector); |
| 163 compiler.serialization.deserializeCompilationDataForTesting = |
| 164 deserializeCompilationDataForTesting; |
| 162 await compiler.run(entryPoint); | 165 await compiler.run(entryPoint); |
| 163 SerializedData serializedData = new SerializedData( | 166 SerializedData serializedData = new SerializedData( |
| 164 dataUri, outputCollector.getOutput('', 'data')); | 167 dataUri, outputCollector.getOutput('', 'data')); |
| 165 return new SerializationResult(compiler, serializedData); | 168 return new SerializationResult(compiler, serializedData); |
| 166 } | 169 } |
| 167 | 170 |
| 168 class SerializedData { | 171 class SerializedData { |
| 169 final Uri uri; | 172 final Uri uri; |
| 170 final String data; | 173 final String data; |
| 171 | 174 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 print('$taskTitle: $title'); | 288 print('$taskTitle: $title'); |
| 286 print('----------------------------------------------------------------'); | 289 print('----------------------------------------------------------------'); |
| 287 var result = await task(); | 290 var result = await task(); |
| 288 stopwatch.stop(); | 291 stopwatch.stop(); |
| 289 int elapsedMilliseconds = stopwatch.elapsedMilliseconds; | 292 int elapsedMilliseconds = stopwatch.elapsedMilliseconds; |
| 290 print('$taskTitle: $title: ${elapsedMilliseconds}ms'); | 293 print('$taskTitle: $title: ${elapsedMilliseconds}ms'); |
| 291 measurementResults.add( | 294 measurementResults.add( |
| 292 new MeasurementResult(title, taskTitle, elapsedMilliseconds)); | 295 new MeasurementResult(title, taskTitle, elapsedMilliseconds)); |
| 293 return result; | 296 return result; |
| 294 } | 297 } |
| OLD | NEW |