| 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 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "include/dart_debugger_api.h" | 10 #include "include/dart_debugger_api.h" |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 argv, | 533 argv, |
| 534 &vm_options, | 534 &vm_options, |
| 535 &script_name, | 535 &script_name, |
| 536 &dart_options) < 0) { | 536 &dart_options) < 0) { |
| 537 PrintUsage(); | 537 PrintUsage(); |
| 538 return kErrorExitCode; | 538 return kErrorExitCode; |
| 539 } | 539 } |
| 540 | 540 |
| 541 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); | 541 Dart_SetVMFlags(vm_options.count(), vm_options.arguments()); |
| 542 | 542 |
| 543 // Initialize event handler. | |
| 544 EventHandler::Initialize(); | |
| 545 | |
| 546 // Initialize the Dart VM. | 543 // Initialize the Dart VM. |
| 547 Dart_Initialize(CreateIsolateAndSetup, NULL); | 544 Dart_Initialize(CreateIsolateAndSetup, NULL); |
| 548 | 545 |
| 549 original_script_name = strdup(script_name); | 546 original_script_name = strdup(script_name); |
| 550 original_working_directory = Directory::Current(); | 547 original_working_directory = Directory::Current(); |
| 551 | 548 |
| 552 // Call CreateIsolateAndSetup which creates an isolate and loads up | 549 // Call CreateIsolateAndSetup which creates an isolate and loads up |
| 553 // the specified application script. | 550 // the specified application script. |
| 554 char* error = NULL; | 551 char* error = NULL; |
| 555 char* isolate_name = BuildIsolateName(original_script_name, "main"); | 552 char* isolate_name = BuildIsolateName(original_script_name, "main"); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 result = Dart_RunLoop(); | 607 result = Dart_RunLoop(); |
| 611 if (Dart_IsError(result)) { | 608 if (Dart_IsError(result)) { |
| 612 return ErrorExit("%s\n", Dart_GetError(result)); | 609 return ErrorExit("%s\n", Dart_GetError(result)); |
| 613 } | 610 } |
| 614 | 611 |
| 615 Dart_ExitScope(); | 612 Dart_ExitScope(); |
| 616 // Dump symbol information for the profiler. | 613 // Dump symbol information for the profiler. |
| 617 DumpPprofSymbolInfo(); | 614 DumpPprofSymbolInfo(); |
| 618 // Shutdown the isolate. | 615 // Shutdown the isolate. |
| 619 Dart_ShutdownIsolate(); | 616 Dart_ShutdownIsolate(); |
| 620 // Terminate event handler. | |
| 621 EventHandler::Terminate(); | |
| 622 // Terminate process exit-code handler. | 617 // Terminate process exit-code handler. |
| 623 Process::TerminateExitCodeHandler(); | 618 Process::TerminateExitCodeHandler(); |
| 624 | 619 |
| 625 free(const_cast<char*>(original_script_name)); | 620 free(const_cast<char*>(original_script_name)); |
| 626 free(const_cast<char*>(original_working_directory)); | 621 free(const_cast<char*>(original_working_directory)); |
| 627 free(const_cast<char*>(original_script_url)); | 622 free(const_cast<char*>(original_script_url)); |
| 628 | 623 |
| 629 return 0; | 624 return 0; |
| 630 } | 625 } |
| OLD | NEW |