| 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.main; | 5 library trydart.main; | 
| 6 | 6 | 
| 7 import 'dart:html' show | 7 import 'dart:html' show | 
| 8     HttpRequest, | 8     HttpRequest, | 
| 9     LinkElement, | 9     LinkElement, | 
| 10     querySelector, | 10     querySelector, | 
| 11     window; | 11     window; | 
| 12 | 12 | 
| 13 import 'dart:isolate' show | 13 import 'dart:isolate' show | 
| 14     ReceivePort, | 14     ReceivePort, | 
| 15     SendPort; | 15     SendPort; | 
| 16 | 16 | 
| 17 import 'compilation.dart' show | 17 import 'compilation.dart' show | 
| 18     compilerIsolate, | 18     compilerIsolate, | 
| 19     compilerPort; | 19     compilerPort, | 
|  | 20     currentSource; | 
| 20 | 21 | 
| 21 import 'isolate_legacy.dart' show | 22 import 'isolate_legacy.dart' show | 
| 22     spawnDomFunction, | 23     spawnDomFunction, | 
| 23     spawnFunction; | 24     spawnFunction; | 
| 24 | 25 | 
| 25 import 'samples.dart' show | 26 import 'samples.dart' show | 
| 26     EXAMPLE_HELLO; | 27     EXAMPLE_HELLO; | 
| 27 | 28 | 
| 28 import 'ui.dart' show | 29 import 'ui.dart' show | 
| 29     buildUI, | 30     buildUI, | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 43   try { | 44   try { | 
| 44     new HttpRequest(); | 45     new HttpRequest(); | 
| 45     replyTo.send(HAS_NON_DOM_HTTP_REQUEST); | 46     replyTo.send(HAS_NON_DOM_HTTP_REQUEST); | 
| 46   } catch (e, trace) { | 47   } catch (e, trace) { | 
| 47     replyTo.send(NO_NON_DOM_HTTP_REQUEST); | 48     replyTo.send(NO_NON_DOM_HTTP_REQUEST); | 
| 48   } | 49   } | 
| 49 } | 50 } | 
| 50 | 51 | 
| 51 main() { | 52 main() { | 
| 52   UserOption.storage = window.localStorage; | 53   UserOption.storage = window.localStorage; | 
| 53   if (window.localStorage['currentSource'] == null) { | 54   if (currentSource == null) { | 
| 54     window.localStorage['currentSource'] = EXAMPLE_HELLO; | 55     currentSource = EXAMPLE_HELLO; | 
| 55   } | 56   } | 
| 56 | 57 | 
| 57   buildUI(); | 58   buildUI(); | 
| 58   spawnFunction(checkHttpRequest).first.then((reply) { | 59   spawnFunction(checkHttpRequest).first.then((reply) { | 
| 59     ReceivePort port; | 60     ReceivePort port; | 
| 60     if (reply == HAS_NON_DOM_HTTP_REQUEST) { | 61     if (reply == HAS_NON_DOM_HTTP_REQUEST) { | 
| 61       port = spawnFunction(compilerIsolate); | 62       port = spawnFunction(compilerIsolate); | 
| 62     } else { | 63     } else { | 
| 63       port = spawnDomFunction(compilerIsolate); | 64       port = spawnDomFunction(compilerIsolate); | 
| 64     } | 65     } | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 80           interaction.onMutation([], observer); | 81           interaction.onMutation([], observer); | 
| 81           break; | 82           break; | 
| 82         default: | 83         default: | 
| 83           // TODO(ahe): Close [port]? | 84           // TODO(ahe): Close [port]? | 
| 84           print('Unexpected message received: $message'); | 85           print('Unexpected message received: $message'); | 
| 85           break; | 86           break; | 
| 86       } | 87       } | 
| 87     }); | 88     }); | 
| 88   }); | 89   }); | 
| 89 } | 90 } | 
| OLD | NEW | 
|---|