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 | 5 |
6 /** | 6 /** |
7 * The `dart:isolate` library defines APIs to spawn and communicate with | 7 * The `dart:isolate` library defines APIs to spawn and communicate with |
8 * isolates. | 8 * isolates. |
9 * | 9 * |
10 * All code in dart runs in the context of an isolate. Each isolate has its own | 10 * All code in dart runs in the context of an isolate. Each isolate has its own |
(...skipping 24 matching lines...) Expand all Loading... |
35 * [spawnFunction] and [spawnUri], and we have an API to spawn DOM isolates. | 35 * [spawnFunction] and [spawnUri], and we have an API to spawn DOM isolates. |
36 */ | 36 */ |
37 #library("dart:isolate"); | 37 #library("dart:isolate"); |
38 | 38 |
39 #import("dart:uri"); | 39 #import("dart:uri"); |
40 #source("isolate_api.dart"); | 40 #source("isolate_api.dart"); |
41 #source("frog/compiler_hooks.dart"); | 41 #source("frog/compiler_hooks.dart"); |
42 #source("frog/isolateimpl.dart"); | 42 #source("frog/isolateimpl.dart"); |
43 #source("frog/ports.dart"); | 43 #source("frog/ports.dart"); |
44 #source("frog/messages.dart"); | 44 #source("frog/messages.dart"); |
| 45 |
| 46 /** |
| 47 * Called by the compiler to support switching |
| 48 * between isolates when we get a callback from the DOM. |
| 49 */ |
| 50 void _callInIsolate(IsolateContext isolate, Function function) { |
| 51 isolate.eval(function); |
| 52 _globalState.topEventLoop.run(); |
| 53 } |
| 54 |
| 55 /** |
| 56 * Called by the compiler to fetch the current isolate context. |
| 57 */ |
| 58 void _currentIsolate() => _globalState.currentContext; |
OLD | NEW |