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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 (VMLibraryHooks.packageConfigUriFuture != null) && | 303 (VMLibraryHooks.packageConfigUriFuture != null) && |
304 (VMLibraryHooks.resolvePackageUriFuture != null); | 304 (VMLibraryHooks.resolvePackageUriFuture != null); |
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 // Check for the type of `entryPoint` on the spawning isolate to make | |
314 // error-handling easier. | |
315 if (entryPoint is! _MainFunctionArgs) { | |
Lasse Reichstein Nielsen
2016/10/14 10:13:56
_MainFunctionArgs is not really the correct type n
floitsch
2016/10/14 11:25:58
Done.
| |
316 throw new ArgumentError(entryPoint); | |
317 } | |
313 // The VM will invoke [_startIsolate] with entryPoint as argument. | 318 // The VM will invoke [_startIsolate] with entryPoint as argument. |
314 readyPort = new RawReceivePort(); | 319 readyPort = new RawReceivePort(); |
315 | 320 |
316 // We do not inherit the package root or package config settings | 321 // We do not inherit the package root or package config settings |
317 // from the parent isolate, instead we use the values that were | 322 // from the parent isolate, instead we use the values that were |
318 // set on the command line. | 323 // set on the command line. |
319 var packageRoot = VMLibraryHooks.packageRootString; | 324 var packageRoot = VMLibraryHooks.packageRootString; |
320 var packageConfig = VMLibraryHooks.packageConfigString; | 325 var packageConfig = VMLibraryHooks.packageConfigString; |
321 var script = VMLibraryHooks.platformScript; | 326 var script = VMLibraryHooks.platformScript; |
322 if (script == null) { | 327 if (script == null) { |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
573 try { | 578 try { |
574 return Uri.parse(_getCurrentRootUriStr()); | 579 return Uri.parse(_getCurrentRootUriStr()); |
575 } catch (e, s) { | 580 } catch (e, s) { |
576 return null; | 581 return null; |
577 } | 582 } |
578 } | 583 } |
579 | 584 |
580 static String _getCurrentRootUriStr() | 585 static String _getCurrentRootUriStr() |
581 native "Isolate_getCurrentRootUriStr"; | 586 native "Isolate_getCurrentRootUriStr"; |
582 } | 587 } |
OLD | NEW |