| 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 library compiler_isolate; | 5 library compiler_isolate; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
| 10 import 'dart:convert' show JSON; | 10 import 'dart:convert' show JSON; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 throw new Exception('Throw on error'); | 102 throw new Exception('Throw on error'); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 Stopwatch compilationTimer = new Stopwatch()..start(); | 105 Stopwatch compilationTimer = new Stopwatch()..start(); |
| 106 cachedCompiler = reuseCompiler( | 106 cachedCompiler = reuseCompiler( |
| 107 diagnosticHandler: handler, | 107 diagnosticHandler: handler, |
| 108 inputProvider: inputProvider, | 108 inputProvider: inputProvider, |
| 109 options: options, | 109 options: options, |
| 110 cachedCompiler: cachedCompiler, | 110 cachedCompiler: cachedCompiler, |
| 111 libraryRoot: sdkLocation, | 111 libraryRoot: sdkLocation, |
| 112 packageRoot: Uri.base.resolve('/packages/')); | 112 packageRoot: Uri.base.resolve('/packages/'), |
| 113 packagesAreImmutable: true); |
| 113 | 114 |
| 114 cachedCompiler.run(Uri.parse('$PRIVATE_SCHEME:/main.dart')).then((success) { | 115 cachedCompiler.run(Uri.parse('$PRIVATE_SCHEME:/main.dart')).then((success) { |
| 115 compilationTimer.stop(); | 116 compilationTimer.stop(); |
| 116 print('Compilation took ${compilationTimer.elapsed}'); | 117 print('Compilation took ${compilationTimer.elapsed}'); |
| 117 if (cachedCompiler.libraries.containsKey('dart:html')) { | 118 if (cachedCompiler.libraries.containsKey('dart:html')) { |
| 118 notifyDartHtml(replyTo); | 119 notifyDartHtml(replyTo); |
| 119 } | 120 } |
| 120 String js = cachedCompiler.assembledCode; | 121 String js = cachedCompiler.assembledCode; |
| 121 if (js == null) { | 122 if (js == null) { |
| 122 if (!options.contains('--analyze-only')) replyTo.send('failed'); | 123 if (!options.contains('--analyze-only')) replyTo.send('failed'); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 152 port.send(replyTo.sendPort); | 153 port.send(replyTo.sendPort); |
| 153 replyTo.listen((message) { | 154 replyTo.listen((message) { |
| 154 try { | 155 try { |
| 155 List list = message as List; | 156 List list = message as List; |
| 156 compile(list[0], list[1]); | 157 compile(list[0], list[1]); |
| 157 } catch (exception, stack) { | 158 } catch (exception, stack) { |
| 158 port.send('$exception\n$stack'); | 159 port.send('$exception\n$stack'); |
| 159 } | 160 } |
| 160 }); | 161 }); |
| 161 } | 162 } |
| OLD | NEW |