| 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 const char* kFormat = "%s/%s"; | 1145 const char* kFormat = "%s/%s"; |
| 1146 intptr_t len = strlen(script_name) + strlen(func_name) + 2; | 1146 intptr_t len = strlen(script_name) + strlen(func_name) + 2; |
| 1147 char* buffer = new char[len]; | 1147 char* buffer = new char[len]; |
| 1148 ASSERT(buffer != NULL); | 1148 ASSERT(buffer != NULL); |
| 1149 snprintf(buffer, len, kFormat, script_name, func_name); | 1149 snprintf(buffer, len, kFormat, script_name, func_name); |
| 1150 return buffer; | 1150 return buffer; |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 static void ShutdownIsolate(void* callback_data) { | 1153 |
| 1154 static void OnIsolateShutdown(void* callback_data) { |
| 1155 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data); |
| 1156 isolate_data->OnIsolateShutdown(); |
| 1157 } |
| 1158 |
| 1159 |
| 1160 static void DeleteIsolateData(void* callback_data) { |
| 1154 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data); | 1161 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data); |
| 1155 delete isolate_data; | 1162 delete isolate_data; |
| 1156 } | 1163 } |
| 1157 | 1164 |
| 1158 | 1165 |
| 1159 static const char* kStdoutStreamId = "Stdout"; | 1166 static const char* kStdoutStreamId = "Stdout"; |
| 1160 static const char* kStderrStreamId = "Stderr"; | 1167 static const char* kStderrStreamId = "Stderr"; |
| 1161 | 1168 |
| 1162 | 1169 |
| 1163 static bool ServiceStreamListenCallback(const char* stream_id) { | 1170 static bool ServiceStreamListenCallback(const char* stream_id) { |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 TimerUtils::InitOnce(); | 1613 TimerUtils::InitOnce(); |
| 1607 EventHandler::Start(); | 1614 EventHandler::Start(); |
| 1608 | 1615 |
| 1609 // Initialize the Dart VM. | 1616 // Initialize the Dart VM. |
| 1610 Dart_InitializeParams init_params; | 1617 Dart_InitializeParams init_params; |
| 1611 memset(&init_params, 0, sizeof(init_params)); | 1618 memset(&init_params, 0, sizeof(init_params)); |
| 1612 init_params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; | 1619 init_params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION; |
| 1613 init_params.vm_snapshot_data = vm_snapshot_data; | 1620 init_params.vm_snapshot_data = vm_snapshot_data; |
| 1614 init_params.vm_snapshot_instructions = vm_snapshot_instructions; | 1621 init_params.vm_snapshot_instructions = vm_snapshot_instructions; |
| 1615 init_params.create = CreateIsolateAndSetup; | 1622 init_params.create = CreateIsolateAndSetup; |
| 1616 init_params.shutdown = ShutdownIsolate; | 1623 init_params.shutdown = OnIsolateShutdown; |
| 1624 init_params.cleanup = DeleteIsolateData; |
| 1617 init_params.file_open = DartUtils::OpenFile; | 1625 init_params.file_open = DartUtils::OpenFile; |
| 1618 init_params.file_read = DartUtils::ReadFile; | 1626 init_params.file_read = DartUtils::ReadFile; |
| 1619 init_params.file_write = DartUtils::WriteFile; | 1627 init_params.file_write = DartUtils::WriteFile; |
| 1620 init_params.file_close = DartUtils::CloseFile; | 1628 init_params.file_close = DartUtils::CloseFile; |
| 1621 init_params.entropy_source = DartUtils::EntropySource; | 1629 init_params.entropy_source = DartUtils::EntropySource; |
| 1622 init_params.get_service_assets = GetVMServiceAssetsArchiveCallback; | 1630 init_params.get_service_assets = GetVMServiceAssetsArchiveCallback; |
| 1623 | 1631 |
| 1624 char* error = Dart_Initialize(&init_params); | 1632 char* error = Dart_Initialize(&init_params); |
| 1625 if (error != NULL) { | 1633 if (error != NULL) { |
| 1626 EventHandler::Stop(); | 1634 EventHandler::Stop(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 Platform::Exit(Process::GlobalExitCode()); | 1679 Platform::Exit(Process::GlobalExitCode()); |
| 1672 } | 1680 } |
| 1673 | 1681 |
| 1674 } // namespace bin | 1682 } // namespace bin |
| 1675 } // namespace dart | 1683 } // namespace dart |
| 1676 | 1684 |
| 1677 int main(int argc, char** argv) { | 1685 int main(int argc, char** argv) { |
| 1678 dart::bin::main(argc, argv); | 1686 dart::bin::main(argc, argv); |
| 1679 UNREACHABLE(); | 1687 UNREACHABLE(); |
| 1680 } | 1688 } |
| OLD | NEW |