| 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 char errbuf[256]; | 493 char errbuf[256]; |
| 494 snprintf(errbuf, sizeof(errbuf), | 494 snprintf(errbuf, sizeof(errbuf), |
| 495 "Expected a library when loading script: %s", | 495 "Expected a library when loading script: %s", |
| 496 script_uri); | 496 script_uri); |
| 497 *error = strdup(errbuf); | 497 *error = strdup(errbuf); |
| 498 Dart_ExitScope(); | 498 Dart_ExitScope(); |
| 499 Dart_ShutdownIsolate(); | 499 Dart_ShutdownIsolate(); |
| 500 return NULL; | 500 return NULL; |
| 501 } | 501 } |
| 502 | 502 |
| 503 VmService::SendIsolateStartupMessage(Dart_GetMainPortId()); |
| 504 |
| 503 // Make the isolate runnable so that it is ready to handle messages. | 505 // Make the isolate runnable so that it is ready to handle messages. |
| 504 Dart_ExitScope(); | 506 Dart_ExitScope(); |
| 505 Dart_ExitIsolate(); | 507 Dart_ExitIsolate(); |
| 506 bool retval = Dart_IsolateMakeRunnable(isolate); | 508 bool retval = Dart_IsolateMakeRunnable(isolate); |
| 507 if (!retval) { | 509 if (!retval) { |
| 508 *error = strdup("Invalid isolate state - Unable to make it runnable"); | 510 *error = strdup("Invalid isolate state - Unable to make it runnable"); |
| 509 Dart_EnterIsolate(isolate); | 511 Dart_EnterIsolate(isolate); |
| 510 Dart_ShutdownIsolate(); | 512 Dart_ShutdownIsolate(); |
| 511 return NULL; | 513 return NULL; |
| 512 } | 514 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 | 648 |
| 647 | 649 |
| 648 static int DartErrorExit(Dart_Handle error) { | 650 static int DartErrorExit(Dart_Handle error) { |
| 649 const int exit_code = Dart_IsCompilationError(error) ? | 651 const int exit_code = Dart_IsCompilationError(error) ? |
| 650 kCompilationErrorExitCode : kErrorExitCode; | 652 kCompilationErrorExitCode : kErrorExitCode; |
| 651 return ErrorExit(exit_code, "%s\n", Dart_GetError(error)); | 653 return ErrorExit(exit_code, "%s\n", Dart_GetError(error)); |
| 652 } | 654 } |
| 653 | 655 |
| 654 | 656 |
| 655 static void ShutdownIsolate(void* callback_data) { | 657 static void ShutdownIsolate(void* callback_data) { |
| 658 VmService::VmServiceShutdownCallback(callback_data); |
| 656 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data); | 659 IsolateData* isolate_data = reinterpret_cast<IsolateData*>(callback_data); |
| 657 delete isolate_data; | 660 delete isolate_data; |
| 658 } | 661 } |
| 659 | 662 |
| 660 | 663 |
| 661 static Dart_Handle GenerateScriptSource() { | 664 static Dart_Handle GenerateScriptSource() { |
| 662 Dart_Handle library_url = Dart_LibraryUrl(Dart_RootLibrary()); | 665 Dart_Handle library_url = Dart_LibraryUrl(Dart_RootLibrary()); |
| 663 if (Dart_IsError(library_url)) { | 666 if (Dart_IsError(library_url)) { |
| 664 return library_url; | 667 return library_url; |
| 665 } | 668 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 | 888 |
| 886 return Process::GlobalExitCode(); | 889 return Process::GlobalExitCode(); |
| 887 } | 890 } |
| 888 | 891 |
| 889 } // namespace bin | 892 } // namespace bin |
| 890 } // namespace dart | 893 } // namespace dart |
| 891 | 894 |
| 892 int main(int argc, char** argv) { | 895 int main(int argc, char** argv) { |
| 893 return dart::bin::main(argc, argv); | 896 return dart::bin::main(argc, argv); |
| 894 } | 897 } |
| OLD | NEW |