Chromium Code Reviews| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 509 const char* err_msg = Dart_GetError(library); | 509 const char* err_msg = Dart_GetError(library); |
| 510 Log::PrintErr("Errors encountered while loading: %s\n", err_msg); | 510 Log::PrintErr("Errors encountered while loading: %s\n", err_msg); |
| 511 Dart_ExitScope(); | 511 Dart_ExitScope(); |
| 512 Dart_ShutdownIsolate(); | 512 Dart_ShutdownIsolate(); |
| 513 exit(255); | 513 exit(255); |
| 514 } | 514 } |
| 515 } | 515 } |
| 516 | 516 |
| 517 | 517 |
| 518 int main(int argc, char** argv) { | 518 int main(int argc, char** argv) { |
| 519 CommandLineOptions vm_options(argc); | 519 CommandLineOptions vm_options(argc); |
|
siva
2015/05/27 21:39:11
Should be (argc + 1) to account for the extra argu
srdjan
2015/05/27 22:46:33
Done.
| |
| 520 | 520 |
| 521 // Initialize the URL mapping array. | 521 // Initialize the URL mapping array. |
| 522 CommandLineOptions url_mapping_array(argc); | 522 CommandLineOptions url_mapping_array(argc); |
| 523 url_mapping = &url_mapping_array; | 523 url_mapping = &url_mapping_array; |
| 524 | 524 |
| 525 // Parse command line arguments. | 525 // Parse command line arguments. |
| 526 if (ParseArguments(argc, | 526 if (ParseArguments(argc, |
| 527 argv, | 527 argv, |
| 528 &vm_options, | 528 &vm_options, |
| 529 &app_script_name) < 0) { | 529 &app_script_name) < 0) { |
| 530 PrintUsage(); | 530 PrintUsage(); |
| 531 return 255; | 531 return 255; |
| 532 } | 532 } |
| 533 | 533 |
| 534 Thread::InitOnce(); | 534 Thread::InitOnce(); |
| 535 DartUtils::SetOriginalWorkingDirectory(); | 535 DartUtils::SetOriginalWorkingDirectory(); |
| 536 | 536 |
| 537 vm_options.AddArgument("--load_deferred_eagerly"); | |
| 538 | |
| 537 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 539 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 538 | 540 |
| 539 // Initialize the Dart VM. | 541 // Initialize the Dart VM. |
| 540 // Note: We don't expect isolates to be created from dart code during | 542 // Note: We don't expect isolates to be created from dart code during |
| 541 // snapshot generation. | 543 // snapshot generation. |
| 542 if (!Dart_Initialize(NULL, | 544 if (!Dart_Initialize(NULL, |
| 543 NULL, NULL, NULL, NULL, | 545 NULL, NULL, NULL, NULL, |
| 544 DartUtils::OpenFile, | 546 DartUtils::OpenFile, |
| 545 DartUtils::ReadFile, | 547 DartUtils::ReadFile, |
| 546 DartUtils::WriteFile, | 548 DartUtils::WriteFile, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 } | 626 } |
| 625 return 0; | 627 return 0; |
| 626 } | 628 } |
| 627 | 629 |
| 628 } // namespace bin | 630 } // namespace bin |
| 629 } // namespace dart | 631 } // namespace dart |
| 630 | 632 |
| 631 int main(int argc, char** argv) { | 633 int main(int argc, char** argv) { |
| 632 return dart::bin::main(argc, argv); | 634 return dart::bin::main(argc, argv); |
| 633 } | 635 } |
| OLD | NEW |