| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 | 5 |
| 6 // Dart isolate's API and implementation for frog. Since dartdocs are generated | 6 // Dart isolate's API and implementation for frog. Since dartdocs are generated |
| 7 // using frog, we include here some additional library level comments. | 7 // using frog, we include here some additional library level comments. |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * The `dart:isolate` library defines APIs to spawn and communicate with | 10 * The `dart:isolate` library defines APIs to spawn and communicate with |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 */ | 39 */ |
| 40 #library("dart:isolate"); | 40 #library("dart:isolate"); |
| 41 | 41 |
| 42 #import("../uri/uri.dart"); | 42 #import("../uri/uri.dart"); |
| 43 #source("isolate_api.dart"); | 43 #source("isolate_api.dart"); |
| 44 #source("frog/compiler_hooks.dart"); | 44 #source("frog/compiler_hooks.dart"); |
| 45 #source("frog/isolateimpl.dart"); | 45 #source("frog/isolateimpl.dart"); |
| 46 #source("frog/ports.dart"); | 46 #source("frog/ports.dart"); |
| 47 #source("frog/messages.dart"); | 47 #source("frog/messages.dart"); |
| 48 #native("frog/natives.js"); | 48 #native("frog/natives.js"); |
| 49 | |
| 50 ReceivePort _port; | |
| 51 | |
| 52 SendPort _spawnFunction(void topLevelFunction()) { | |
| 53 final name = _IsolateNatives._getJSFunctionName(topLevelFunction); | |
| 54 if (name == null) { | |
| 55 throw new UnsupportedOperationException( | |
| 56 "only top-level functions can be spawned."); | |
| 57 } | |
| 58 return _IsolateNatives._spawn2(name, null, false); | |
| 59 } | |
| 60 | |
| 61 SendPort _spawnUri(String uri) { | |
| 62 return _IsolateNatives._spawn2(null, uri, false); | |
| 63 } | |
| OLD | NEW |