OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Patch file for the dart:isolate library. | 5 // Patch file for the dart:isolate library. |
6 | 6 |
| 7 import 'dart:_isolate_helper' show IsolateNatives, |
| 8 lazyPort, |
| 9 ReceivePortImpl; |
| 10 |
7 patch class _Isolate { | 11 patch class _Isolate { |
8 patch ReceivePort get port { | 12 patch ReceivePort get port { |
9 if (lazyPort == null) { | 13 if (lazyPort == null) { |
10 lazyPort = new ReceivePort(); | 14 lazyPort = new ReceivePort(); |
11 } | 15 } |
12 return lazyPort; | 16 return lazyPort; |
13 } | 17 } |
14 | 18 |
15 patch SendPort spawnFunction(void topLevelFunction(), | 19 patch SendPort spawnFunction(void topLevelFunction(), |
16 [bool UnhandledExceptionCallback(IsolateUnhandledException e)]) { | 20 [bool UnhandledExceptionCallback(IsolateUnhandledException e)]) { |
17 return IsolateNatives.spawnFunction(topLevelFunction); | 21 return IsolateNatives.spawnFunction(topLevelFunction); |
18 } | 22 } |
19 | 23 |
20 patch SendPort spawnUri(String uri) { | 24 patch SendPort spawnUri(String uri) { |
21 return IsolateNatives.spawn(null, uri, false); | 25 return IsolateNatives.spawn(null, uri, false); |
22 } | 26 } |
23 } | 27 } |
24 | 28 |
25 /** Default factory for receive ports. */ | 29 /** Default factory for receive ports. */ |
26 patch class ReceivePort { | 30 patch class ReceivePort { |
27 patch factory ReceivePort() { | 31 patch factory ReceivePort() { |
28 return new ReceivePortImpl(); | 32 return new ReceivePortImpl(); |
29 } | 33 } |
30 } | 34 } |
OLD | NEW |