OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Generate a snapshot file after loading all the scripts specified on the | 5 // Generate a snapshot file after loading all the scripts specified on the |
6 // command line. | 6 // command line. |
7 | 7 |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 // invoke the dart uri resolution code like _resolveURI. App script is | 533 // invoke the dart uri resolution code like _resolveURI. App script is |
534 // loaded into a separate isolate. | 534 // loaded into a separate isolate. |
535 | 535 |
536 SetupForUriResolution(); | 536 SetupForUriResolution(); |
537 | 537 |
538 // Get handle to builtin library. | 538 // Get handle to builtin library. |
539 Dart_Handle builtin_lib = | 539 Dart_Handle builtin_lib = |
540 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); | 540 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); |
541 CHECK_RESULT(builtin_lib); | 541 CHECK_RESULT(builtin_lib); |
542 | 542 |
| 543 // Ensure that we mark all libraries as loaded. |
| 544 Dart_Handle result = Dart_FinalizeLoading(false); |
| 545 if (Dart_IsError(result)) { |
| 546 const char* err_msg = Dart_GetError(library); |
| 547 Log::PrintErr("Errors encountered while loading: %s\n", err_msg); |
| 548 Dart_ExitScope(); |
| 549 Dart_ShutdownIsolate(); |
| 550 exit(255); |
| 551 } |
| 552 |
543 // Prepare for script loading by setting up the 'print' and 'timer' | 553 // Prepare for script loading by setting up the 'print' and 'timer' |
544 // closures and setting up 'package root' for URI resolution. | 554 // closures and setting up 'package root' for URI resolution. |
545 result = DartUtils::PrepareForScriptLoading(package_root, builtin_lib); | 555 result = DartUtils::PrepareForScriptLoading(package_root, builtin_lib); |
546 CHECK_RESULT(result); | 556 CHECK_RESULT(result); |
547 Dart_ExitScope(); | 557 Dart_ExitScope(); |
548 | 558 |
549 UriResolverIsolateScope::isolate = isolate; | 559 UriResolverIsolateScope::isolate = isolate; |
550 | 560 |
551 // Now we create an isolate into which we load all the code that needs to | 561 // Now we create an isolate into which we load all the code that needs to |
552 // be in the snapshot. | 562 // be in the snapshot. |
(...skipping 21 matching lines...) Expand all Loading... |
574 } | 584 } |
575 return 0; | 585 return 0; |
576 } | 586 } |
577 | 587 |
578 } // namespace bin | 588 } // namespace bin |
579 } // namespace dart | 589 } // namespace dart |
580 | 590 |
581 int main(int argc, char** argv) { | 591 int main(int argc, char** argv) { |
582 return dart::bin::main(argc, argv); | 592 return dart::bin::main(argc, argv); |
583 } | 593 } |
OLD | NEW |