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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 packagesAreImmutable: true); |
114 | 114 |
115 cachedCompiler.run(Uri.parse('$PRIVATE_SCHEME:/main.dart')).then((success) { | 115 cachedCompiler.run(Uri.parse('$PRIVATE_SCHEME:/main.dart')).then((success) { |
116 compilationTimer.stop(); | 116 compilationTimer.stop(); |
117 print('Compilation took ${compilationTimer.elapsed}'); | 117 print('Compilation took ${compilationTimer.elapsed}'); |
118 if (cachedCompiler.libraries.containsKey('dart:html')) { | 118 if (cachedCompiler.libraryLoader |
| 119 .lookupLibrary(Uri.parse('dart:html')) != null) { |
119 notifyDartHtml(replyTo); | 120 notifyDartHtml(replyTo); |
120 } | 121 } |
121 String js = cachedCompiler.assembledCode; | 122 String js = cachedCompiler.assembledCode; |
122 if (js == null) { | 123 if (js == null) { |
123 if (!options.contains('--analyze-only')) replyTo.send('failed'); | 124 if (!options.contains('--analyze-only')) replyTo.send('failed'); |
124 } else { | 125 } else { |
125 var url; | 126 var url; |
126 handler(null, 0, 0, | 127 handler(null, 0, 0, |
127 'Compiled ${source.length}/${charactersRead} characters Dart' | 128 'Compiled ${source.length}/${charactersRead} characters Dart' |
128 ' -> ${js.length} characters.', | 129 ' -> ${js.length} characters.', |
(...skipping 24 matching lines...) Expand all Loading... |
153 port.send(replyTo.sendPort); | 154 port.send(replyTo.sendPort); |
154 replyTo.listen((message) { | 155 replyTo.listen((message) { |
155 try { | 156 try { |
156 List list = message as List; | 157 List list = message as List; |
157 compile(list[0], list[1]); | 158 compile(list[0], list[1]); |
158 } catch (exception, stack) { | 159 } catch (exception, stack) { |
159 port.send('$exception\n$stack'); | 160 port.send('$exception\n$stack'); |
160 } | 161 } |
161 }); | 162 }); |
162 } | 163 } |
OLD | NEW |