| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 {bool paused: false, | 327 {bool paused: false, |
| 328 SendPort onExit, | 328 SendPort onExit, |
| 329 SendPort onError, | 329 SendPort onError, |
| 330 bool errorsAreFatal, | 330 bool errorsAreFatal, |
| 331 bool checked, | 331 bool checked, |
| 332 Map<String, String> environment, | 332 Map<String, String> environment, |
| 333 Uri packageRoot, | 333 Uri packageRoot, |
| 334 Map<String, Uri> packages}) { | 334 Map<String, Uri> packages}) { |
| 335 RawReceivePort readyPort; | 335 RawReceivePort readyPort; |
| 336 if (environment != null) throw new UnimplementedError("environment"); | 336 if (environment != null) throw new UnimplementedError("environment"); |
| 337 if (packages != null) throw new UnimplementedError("packages"); | |
| 338 try { | 337 try { |
| 339 // The VM will invoke [_startIsolate] and not `main`. | 338 // The VM will invoke [_startIsolate] and not `main`. |
| 340 // TODO: Handle [packages]. | |
| 341 readyPort = new RawReceivePort(); | 339 readyPort = new RawReceivePort(); |
| 342 var packageRootString = | 340 var packageRootString = |
| 343 (packageRoot == null) ? null : packageRoot.toString(); | 341 (packageRoot == null) ? null : packageRoot.toString(); |
| 344 var packagesList = null; | 342 var packagesList = null; |
| 343 if (packages != null) { |
| 344 packagesList = new List(2 * packages.length); |
| 345 var i = 0; |
| 346 packages.forEach((key, value) { |
| 347 packagesList[i++] = key; |
| 348 packagesList[i++] = Uri.base.resolveUri(value).toString(); |
| 349 }); |
| 350 } |
| 345 | 351 |
| 346 _spawnUri(readyPort.sendPort, uri.toString(), | 352 _spawnUri(readyPort.sendPort, uri.toString(), |
| 347 args, message, | 353 args, message, |
| 348 paused, onExit, onError, | 354 paused, onExit, onError, |
| 349 errorsAreFatal, checked, | 355 errorsAreFatal, checked, |
| 350 null, /* environment */ | 356 null, /* environment */ |
| 351 packageRootString, packagesList); | 357 packageRootString, packagesList); |
| 352 Completer completer = new Completer<Isolate>.sync(); | 358 Completer completer = new Completer<Isolate>.sync(); |
| 353 readyPort.handler = (readyMessage) { | 359 readyPort.handler = (readyMessage) { |
| 354 readyPort.close(); | 360 readyPort.close(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 static Isolate _getCurrentIsolate() { | 489 static Isolate _getCurrentIsolate() { |
| 484 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate(); | 490 List portAndCapabilities = _getPortAndCapabilitiesOfCurrentIsolate(); |
| 485 return new Isolate(portAndCapabilities[0], | 491 return new Isolate(portAndCapabilities[0], |
| 486 pauseCapability: portAndCapabilities[1], | 492 pauseCapability: portAndCapabilities[1], |
| 487 terminateCapability: portAndCapabilities[2]); | 493 terminateCapability: portAndCapabilities[2]); |
| 488 } | 494 } |
| 489 | 495 |
| 490 static List _getPortAndCapabilitiesOfCurrentIsolate() | 496 static List _getPortAndCapabilitiesOfCurrentIsolate() |
| 491 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate"; | 497 native "Isolate_getPortAndCapabilitiesOfCurrentIsolate"; |
| 492 } | 498 } |
| OLD | NEW |