| 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 trydart.compilation; | 5 library trydart.compilation; |
| 6 | 6 |
| 7 import 'dart:html' show | 7 import 'dart:html' show |
| 8 Blob, | 8 Blob, |
| 9 Element, | 9 Element, |
| 10 ErrorEvent, | 10 ErrorEvent, |
| 11 IFrameElement, | 11 IFrameElement, |
| 12 MessageEvent, | 12 MessageEvent, |
| 13 Url, | 13 Url, |
| 14 Worker; | 14 Worker, |
| 15 window; |
| 15 | 16 |
| 16 import 'dart:async' show | 17 import 'dart:async' show |
| 17 Timer; | 18 Timer; |
| 18 | 19 |
| 19 import 'dart:isolate' show | 20 import 'dart:isolate' show |
| 20 ReceivePort, | 21 ReceivePort, |
| 21 SendPort; | 22 SendPort; |
| 22 | 23 |
| 23 import 'editor.dart' show | 24 import 'editor.dart' show |
| 24 addDiagnostic, | 25 addDiagnostic, |
| 25 currentSource, | |
| 26 isMalformedInput; | 26 isMalformedInput; |
| 27 | 27 |
| 28 import 'run.dart' show | 28 import 'run.dart' show |
| 29 makeOutputFrame; | 29 makeOutputFrame; |
| 30 | 30 |
| 31 import 'ui.dart' show | 31 import 'ui.dart' show |
| 32 buildButton, | 32 buildButton, |
| 33 outputDiv, | 33 outputDiv, |
| 34 outputFrame; | 34 outputFrame; |
| 35 | 35 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 56 * are encouraged to use a prefix based on their domain name, expressed | 56 * are encouraged to use a prefix based on their domain name, expressed |
| 57 * in reverse order. For example, a URI scheme name of com-example-info | 57 * in reverse order. For example, a URI scheme name of com-example-info |
| 58 * might be registered by the vendor that owns the example.com domain | 58 * might be registered by the vendor that owns the example.com domain |
| 59 * name. | 59 * name. |
| 60 */ | 60 */ |
| 61 const String PRIVATE_SCHEME = 'org-trydart'; | 61 const String PRIVATE_SCHEME = 'org-trydart'; |
| 62 | 62 |
| 63 SendPort compilerPort; | 63 SendPort compilerPort; |
| 64 Timer compilerTimer; | 64 Timer compilerTimer; |
| 65 | 65 |
| 66 // TODO(ahe): Remove this. |
| 67 String get currentSource => window.localStorage['currentSource']; |
| 68 |
| 69 void set currentSource(String text) { |
| 70 window.localStorage['currentSource'] = text; |
| 71 } |
| 72 |
| 66 void scheduleCompilation() { | 73 void scheduleCompilation() { |
| 67 if (compilationPaused) return; | 74 if (compilationPaused) return; |
| 68 if (compilerTimer != null) { | 75 if (compilerTimer != null) { |
| 69 compilerTimer.cancel(); | 76 compilerTimer.cancel(); |
| 70 compilerTimer = null; | 77 compilerTimer = null; |
| 71 } | 78 } |
| 72 compilerTimer = | 79 compilerTimer = |
| 73 new Timer(const Duration(milliseconds: 500), startCompilation); | 80 new Timer(const Duration(milliseconds: 500), startCompilation); |
| 74 } | 81 } |
| 75 | 82 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 compile(list[0], list[1]); | 306 compile(list[0], list[1]); |
| 300 } catch (exception, stack) { | 307 } catch (exception, stack) { |
| 301 port.send('$exception\n$stack'); | 308 port.send('$exception\n$stack'); |
| 302 } | 309 } |
| 303 }); | 310 }); |
| 304 var notTrue = false; // Confuse the analyzer. | 311 var notTrue = false; // Confuse the analyzer. |
| 305 if (notTrue) { | 312 if (notTrue) { |
| 306 cacheCompiler.compilerFor(null); | 313 cacheCompiler.compilerFor(null); |
| 307 } | 314 } |
| 308 } | 315 } |
| OLD | NEW |