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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 /* patch */ static Future<Isolate> spawn( | 306 /* patch */ static Future<Isolate> spawn( |
307 void entryPoint(message), var message, | 307 void entryPoint(message), var message, |
308 {bool paused: false, bool errorsAreFatal, | 308 {bool paused: false, bool errorsAreFatal, |
309 SendPort onExit, SendPort onError}) async { | 309 SendPort onExit, SendPort onError}) async { |
310 // `paused` isn't handled yet. | 310 // `paused` isn't handled yet. |
311 RawReceivePort readyPort; | 311 RawReceivePort readyPort; |
312 try { | 312 try { |
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; | |
316 var packageConfig = null; | |
317 if (Isolate._packageSupported()) { | |
318 packageRoot = (await Isolate.packageRoot)?.toString(); | |
319 packageConfig = (await Isolate.packageConfig)?.toString(); | |
320 } | |
321 | 315 |
| 316 // We do not inherit the package root or package config settings |
| 317 // from the parent isolate, instead we use the values that were |
| 318 // set on the command line. |
| 319 var packageRoot = VMLibraryHooks.packageRootString; |
| 320 var packageConfig = VMLibraryHooks.packageConfigString; |
322 var script = VMLibraryHooks.platformScript; | 321 var script = VMLibraryHooks.platformScript; |
323 if (script == null) { | 322 if (script == null) { |
324 // We do not have enough information to support spawning the new | 323 // We do not have enough information to support spawning the new |
325 // isolate. | 324 // isolate. |
326 throw new UnsupportedError("Isolate.spawn"); | 325 throw new UnsupportedError("Isolate.spawn"); |
327 } | 326 } |
328 if (script.scheme == "package") { | 327 if (script.scheme == "package") { |
329 script = await Isolate.resolvePackageUri(script); | 328 script = await Isolate.resolvePackageUri(script); |
330 } | 329 } |
331 | 330 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 try { | 573 try { |
575 return Uri.parse(_getCurrentRootUriStr()); | 574 return Uri.parse(_getCurrentRootUriStr()); |
576 } catch (e, s) { | 575 } catch (e, s) { |
577 return null; | 576 return null; |
578 } | 577 } |
579 } | 578 } |
580 | 579 |
581 static String _getCurrentRootUriStr() | 580 static String _getCurrentRootUriStr() |
582 native "Isolate_getCurrentRootUriStr"; | 581 native "Isolate_getCurrentRootUriStr"; |
583 } | 582 } |
OLD | NEW |