| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // The VM will invoke [_startIsolate] with entryPoint as argument. | 313 // The VM will invoke [_startIsolate] with entryPoint as argument. |
| 314 readyPort = new RawReceivePort(); | 314 readyPort = new RawReceivePort(); |
| 315 var packageRoot = null; | 315 var packageRoot = null; |
| 316 var packageConfig = null; | 316 var packageConfig = null; |
| 317 if (Isolate._packageSupported()) { | 317 if (Isolate._packageSupported()) { |
| 318 packageRoot = (await Isolate.packageRoot)?.toString(); | 318 packageRoot = (await Isolate.packageRoot)?.toString(); |
| 319 packageConfig = (await Isolate.packageConfig)?.toString(); | 319 packageConfig = (await Isolate.packageConfig)?.toString(); |
| 320 } | 320 } |
| 321 | 321 |
| 322 var script = VMLibraryHooks.platformScript; | 322 var script = VMLibraryHooks.platformScript; |
| 323 if (script != null) { | 323 if (script == null) { |
| 324 if (script.scheme == "package") { | 324 // We do not have enough information to support spawning the new |
| 325 script = await Isolate.resolvePackageUri(script); | 325 // isolate. |
| 326 } | 326 throw new UnsupportedError("Isolate.spawn"); |
| 327 } |
| 328 if (script.scheme == "package") { |
| 329 script = await Isolate.resolvePackageUri(script); |
| 327 } | 330 } |
| 328 | 331 |
| 329 _spawnFunction(readyPort.sendPort, script.toString(), entryPoint, message, | 332 _spawnFunction(readyPort.sendPort, script.toString(), entryPoint, message, |
| 330 paused, errorsAreFatal, onExit, onError, | 333 paused, errorsAreFatal, onExit, onError, |
| 331 packageRoot, packageConfig); | 334 packageRoot, packageConfig); |
| 332 return await _spawnCommon(readyPort); | 335 return await _spawnCommon(readyPort); |
| 333 } catch (e, st) { | 336 } catch (e, st) { |
| 334 if (readyPort != null) { | 337 if (readyPort != null) { |
| 335 readyPort.close(); | 338 readyPort.close(); |
| 336 } | 339 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 try { | 574 try { |
| 572 return Uri.parse(_getCurrentRootUriStr()); | 575 return Uri.parse(_getCurrentRootUriStr()); |
| 573 } catch (e, s) { | 576 } catch (e, s) { |
| 574 return null; | 577 return null; |
| 575 } | 578 } |
| 576 } | 579 } |
| 577 | 580 |
| 578 static String _getCurrentRootUriStr() | 581 static String _getCurrentRootUriStr() |
| 579 native "Isolate_getCurrentRootUriStr"; | 582 native "Isolate_getCurrentRootUriStr"; |
| 580 } | 583 } |
| OLD | NEW |