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 import "dart:collection" show HashMap; | 5 import "dart:collection" show HashMap; |
6 import "dart:_internal"; | 6 import "dart:_internal"; |
7 | 7 |
8 patch class ReceivePort { | 8 patch class ReceivePort { |
9 /* patch */ factory ReceivePort() = _ReceivePortImpl; | 9 /* patch */ factory ReceivePort() = _ReceivePortImpl; |
10 | 10 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } catch (e, st) { | 299 } catch (e, st) { |
300 if (readyPort != null) { | 300 if (readyPort != null) { |
301 readyPort.close(); | 301 readyPort.close(); |
302 } | 302 } |
303 return new Future<Isolate>.error(e, st); | 303 return new Future<Isolate>.error(e, st); |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 /* patch */ static Future<Isolate> spawnUri( | 307 /* patch */ static Future<Isolate> spawnUri( |
308 Uri uri, List<String> args, var message, | 308 Uri uri, List<String> args, var message, |
309 {bool paused: false, bool checked, Uri packageRoot, bool errorsAreFatal, | 309 {bool paused: false, |
310 SendPort onExit, SendPort onError}) { | 310 bool checked, |
| 311 Uri packageRoot, |
| 312 Map<String, Uri> packages, |
| 313 bool errorsAreFatal, |
| 314 SendPort onExit, |
| 315 SendPort onError}) { |
311 RawReceivePort readyPort; | 316 RawReceivePort readyPort; |
312 try { | 317 try { |
313 // The VM will invoke [_startIsolate] and not `main`. | 318 // The VM will invoke [_startIsolate] and not `main`. |
| 319 // TODO: Handle [packages]. |
314 readyPort = new RawReceivePort(); | 320 readyPort = new RawReceivePort(); |
315 var packageRootString = | 321 var packageRootString = |
316 (packageRoot == null) ? null : packageRoot.toString(); | 322 (packageRoot == null) ? null : packageRoot.toString(); |
317 _spawnUri(readyPort.sendPort, uri.toString(), args, message, | 323 _spawnUri(readyPort.sendPort, uri.toString(), args, message, |
318 paused, checked, packageRootString, | 324 paused, checked, packageRootString, |
319 errorsAreFatal, onExit, onError); | 325 errorsAreFatal, onExit, onError); |
320 Completer completer = new Completer<Isolate>.sync(); | 326 Completer completer = new Completer<Isolate>.sync(); |
321 readyPort.handler = (readyMessage) { | 327 readyPort.handler = (readyMessage) { |
322 readyPort.close(); | 328 readyPort.close(); |
323 assert(readyMessage is List); | 329 assert(readyMessage is List); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 static Isolate _getCurrentIsolate() { | 455 static Isolate _getCurrentIsolate() { |
450 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate(); | 456 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate(); |
451 return new Isolate(portAndCapabilities[0], | 457 return new Isolate(portAndCapabilities[0], |
452 pauseCapability: portAndCapabilities[1], | 458 pauseCapability: portAndCapabilities[1], |
453 terminateCapability: portAndCapabilities[2]); | 459 terminateCapability: portAndCapabilities[2]); |
454 } | 460 } |
455 | 461 |
456 static List _getPortAndCapabilitiesOfCurrentIsolate() | 462 static List _getPortAndCapabilitiesOfCurrentIsolate() |
457 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate"; | 463 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate"; |
458 } | 464 } |
OLD | NEW |