| 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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 Dart_ExitScope(); | 1339 Dart_ExitScope(); |
| 1340 // Shutdown the isolate. | 1340 // Shutdown the isolate. |
| 1341 Dart_ShutdownIsolate(); | 1341 Dart_ShutdownIsolate(); |
| 1342 | 1342 |
| 1343 // No restart. | 1343 // No restart. |
| 1344 return false; | 1344 return false; |
| 1345 } | 1345 } |
| 1346 | 1346 |
| 1347 #undef CHECK_RESULT | 1347 #undef CHECK_RESULT |
| 1348 | 1348 |
| 1349 extern unsigned int observatory_assets_archive_len; |
| 1350 extern const char* observatory_assets_archive; |
| 1351 |
| 1352 Dart_Handle GetVMServiceAssetsArchiveCallback() { |
| 1353 return DartUtils::MakeUint8Array( |
| 1354 reinterpret_cast<const uint8_t*>(&observatory_assets_archive[0]), |
| 1355 observatory_assets_archive_len); |
| 1356 } |
| 1357 |
| 1349 | 1358 |
| 1350 void main(int argc, char** argv) { | 1359 void main(int argc, char** argv) { |
| 1351 char* script_name; | 1360 char* script_name; |
| 1352 const int EXTRA_VM_ARGUMENTS = 2; | 1361 const int EXTRA_VM_ARGUMENTS = 2; |
| 1353 CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS); | 1362 CommandLineOptions vm_options(argc + EXTRA_VM_ARGUMENTS); |
| 1354 CommandLineOptions dart_options(argc); | 1363 CommandLineOptions dart_options(argc); |
| 1355 bool print_flags_seen = false; | 1364 bool print_flags_seen = false; |
| 1356 bool verbose_debug_seen = false; | 1365 bool verbose_debug_seen = false; |
| 1357 | 1366 |
| 1358 vm_options.AddArgument("--no_write_protect_code"); | 1367 vm_options.AddArgument("--no_write_protect_code"); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 } | 1438 } |
| 1430 | 1439 |
| 1431 // Initialize the Dart VM. | 1440 // Initialize the Dart VM. |
| 1432 char* error = Dart_Initialize( | 1441 char* error = Dart_Initialize( |
| 1433 vm_isolate_snapshot_buffer, instructions_snapshot, | 1442 vm_isolate_snapshot_buffer, instructions_snapshot, |
| 1434 CreateIsolateAndSetup, NULL, NULL, ShutdownIsolate, | 1443 CreateIsolateAndSetup, NULL, NULL, ShutdownIsolate, |
| 1435 DartUtils::OpenFile, | 1444 DartUtils::OpenFile, |
| 1436 DartUtils::ReadFile, | 1445 DartUtils::ReadFile, |
| 1437 DartUtils::WriteFile, | 1446 DartUtils::WriteFile, |
| 1438 DartUtils::CloseFile, | 1447 DartUtils::CloseFile, |
| 1439 DartUtils::EntropySource); | 1448 DartUtils::EntropySource, |
| 1449 GetVMServiceAssetsArchiveCallback); |
| 1440 if (error != NULL) { | 1450 if (error != NULL) { |
| 1441 if (do_vm_shutdown) { | 1451 if (do_vm_shutdown) { |
| 1442 DebuggerConnectionHandler::StopHandler(); | 1452 DebuggerConnectionHandler::StopHandler(); |
| 1443 EventHandler::Stop(); | 1453 EventHandler::Stop(); |
| 1444 } | 1454 } |
| 1445 fprintf(stderr, "VM initialization failed: %s\n", error); | 1455 fprintf(stderr, "VM initialization failed: %s\n", error); |
| 1446 fflush(stderr); | 1456 fflush(stderr); |
| 1447 free(error); | 1457 free(error); |
| 1448 exit(kErrorExitCode); | 1458 exit(kErrorExitCode); |
| 1449 } | 1459 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 exit(Process::GlobalExitCode()); | 1500 exit(Process::GlobalExitCode()); |
| 1491 } | 1501 } |
| 1492 | 1502 |
| 1493 } // namespace bin | 1503 } // namespace bin |
| 1494 } // namespace dart | 1504 } // namespace dart |
| 1495 | 1505 |
| 1496 int main(int argc, char** argv) { | 1506 int main(int argc, char** argv) { |
| 1497 dart::bin::main(argc, argv); | 1507 dart::bin::main(argc, argv); |
| 1498 UNREACHABLE(); | 1508 UNREACHABLE(); |
| 1499 } | 1509 } |
| OLD | NEW |