OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 |
| 6 // Dart isolate's API and implementation for frog. |
| 7 #library("dart:isolate"); |
| 8 |
| 9 #import("frog/isolateimpl.dart"); |
| 10 #import("frog/ports.dart"); |
| 11 |
| 12 #source("isolate_api.dart"); |
| 13 #source("frog/compiler_hooks.dart"); |
| 14 |
| 15 /** Default factory for [Isolate2]. */ |
| 16 class _IsolateFactory { |
| 17 |
| 18 factory Isolate2.fromCode(Function topLevelFunction) { |
| 19 final name = IsolateNatives._getJSFunctionName(topLevelFunction); |
| 20 if (name == null) { |
| 21 throw new UnsupportedOperationException( |
| 22 "only top-level functions can be spawned."); |
| 23 } |
| 24 return new Isolate2Impl(IsolateNatives._spawn2(name, null, false)); |
| 25 } |
| 26 |
| 27 factory Isolate2.fromUri(String uri) { |
| 28 return new Isolate2Impl(IsolateNatives._spawn2(null, uri, false)); |
| 29 } |
| 30 } |
| 31 |
| 32 class _IsolateNatives { |
| 33 static Future<SendPort> spawn(Isolate isolate, bool isLight) { |
| 34 return IsolateNatives.spawn(isolate, isLight); |
| 35 } |
| 36 } |
OLD | NEW |