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_tools_api.h" | 10 #include "include/dart_tools_api.h" |
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1720 kPrecompiledLibraryName, | 1720 kPrecompiledLibraryName, |
1721 kPrecompiledInstructionsSymbolName)); | 1721 kPrecompiledInstructionsSymbolName)); |
1722 data_snapshot = reinterpret_cast<const uint8_t*>( | 1722 data_snapshot = reinterpret_cast<const uint8_t*>( |
1723 LoadLibrarySymbol(snapshot_filename, | 1723 LoadLibrarySymbol(snapshot_filename, |
1724 kPrecompiledLibraryName, | 1724 kPrecompiledLibraryName, |
1725 kPrecompiledDataSymbolName)); | 1725 kPrecompiledDataSymbolName)); |
1726 } | 1726 } |
1727 } | 1727 } |
1728 | 1728 |
1729 // Initialize the Dart VM. | 1729 // Initialize the Dart VM. |
1730 char* error = Dart_Initialize( | 1730 Dart_InitializeParams init_params; |
1731 vm_isolate_snapshot_buffer, instructions_snapshot, data_snapshot, | 1731 memset(&init_params, 0, sizeof(init_params)); |
1732 CreateIsolateAndSetup, NULL, NULL, ShutdownIsolate, | 1732 init_params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; |
1733 NULL, | 1733 init_params.vm_isolate_snapshot = vm_isolate_snapshot_buffer; |
1734 DartUtils::OpenFile, | 1734 init_params.instructions_snapshot = instructions_snapshot; |
1735 DartUtils::ReadFile, | 1735 init_params.data_snapshot = data_snapshot; |
1736 DartUtils::WriteFile, | 1736 init_params.create = CreateIsolateAndSetup; |
1737 DartUtils::CloseFile, | 1737 init_params.shutdown = ShutdownIsolate; |
1738 DartUtils::EntropySource, | 1738 init_params.file_open = DartUtils::OpenFile; |
1739 GetVMServiceAssetsArchiveCallback); | 1739 init_params.file_read = DartUtils::ReadFile; |
| 1740 init_params.file_write = DartUtils::WriteFile; |
| 1741 init_params.file_close = DartUtils::CloseFile; |
| 1742 init_params.entropy_source = DartUtils::EntropySource; |
| 1743 init_params.get_service_assets = GetVMServiceAssetsArchiveCallback; |
| 1744 |
| 1745 char* error = Dart_Initialize(&init_params); |
1740 if (error != NULL) { | 1746 if (error != NULL) { |
1741 EventHandler::Stop(); | 1747 EventHandler::Stop(); |
1742 fprintf(stderr, "VM initialization failed: %s\n", error); | 1748 fprintf(stderr, "VM initialization failed: %s\n", error); |
1743 fflush(stderr); | 1749 fflush(stderr); |
1744 free(error); | 1750 free(error); |
1745 Platform::Exit(kErrorExitCode); | 1751 Platform::Exit(kErrorExitCode); |
1746 } | 1752 } |
1747 | 1753 |
1748 Dart_RegisterIsolateServiceRequestCallback( | 1754 Dart_RegisterIsolateServiceRequestCallback( |
1749 "getIO", &ServiceGetIOHandler, NULL); | 1755 "getIO", &ServiceGetIOHandler, NULL); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 Platform::Exit(Process::GlobalExitCode()); | 1793 Platform::Exit(Process::GlobalExitCode()); |
1788 } | 1794 } |
1789 | 1795 |
1790 } // namespace bin | 1796 } // namespace bin |
1791 } // namespace dart | 1797 } // namespace dart |
1792 | 1798 |
1793 int main(int argc, char** argv) { | 1799 int main(int argc, char** argv) { |
1794 dart::bin::main(argc, argv); | 1800 dart::bin::main(argc, argv); |
1795 UNREACHABLE(); | 1801 UNREACHABLE(); |
1796 } | 1802 } |
OLD | NEW |