Chromium Code Reviews| 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 | |
| 505 // Make the isolate runnable so that it is ready to handle messages. | 503 // Make the isolate runnable so that it is ready to handle messages. |
| 506 Dart_ExitScope(); | 504 Dart_ExitScope(); |
| 507 Dart_ExitIsolate(); | 505 Dart_ExitIsolate(); |
| 508 bool retval = Dart_IsolateMakeRunnable(isolate); | 506 bool retval = Dart_IsolateMakeRunnable(isolate); |
| 509 if (!retval) { | 507 if (!retval) { |
| 510 *error = strdup("Invalid isolate state - Unable to make it runnable"); | 508 *error = strdup("Invalid isolate state - Unable to make it runnable"); |
| 511 Dart_EnterIsolate(isolate); | 509 Dart_EnterIsolate(isolate); |
| 512 Dart_ShutdownIsolate(); | 510 Dart_ShutdownIsolate(); |
| 513 return NULL; | 511 return NULL; |
| 514 } | 512 } |
| 515 | 513 |
| 514 Dart_EnterIsolate(isolate); | |
|
Ivan Posva
2013/08/07 23:33:38
You cannot enter the isolate after having made it
Cutch
2013/08/08 14:26:39
Done.
| |
| 515 Dart_EnterScope(); | |
| 516 | |
| 517 Dart_Handle debug_name = Dart_DebugName(); | |
| 518 CHECK_RESULT(debug_name); | |
| 519 VmService::SendIsolateStartupMessage(Dart_GetMainPortId(), debug_name); | |
| 520 | |
| 521 Dart_ExitScope(); | |
| 522 Dart_ExitIsolate(); | |
| 523 | |
| 516 return isolate; | 524 return isolate; |
| 517 } | 525 } |
| 518 | 526 |
| 519 | 527 |
| 520 static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, | 528 static Dart_Isolate CreateIsolateAndSetup(const char* script_uri, |
| 521 const char* main, | 529 const char* main, |
| 522 void* data, char** error) { | 530 void* data, char** error) { |
| 523 return CreateIsolateAndSetupHelper(script_uri, | 531 return CreateIsolateAndSetupHelper(script_uri, |
| 524 main, | 532 main, |
| 525 new IsolateData(), | 533 new IsolateData(), |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 888 | 896 |
| 889 return Process::GlobalExitCode(); | 897 return Process::GlobalExitCode(); |
| 890 } | 898 } |
| 891 | 899 |
| 892 } // namespace bin | 900 } // namespace bin |
| 893 } // namespace dart | 901 } // namespace dart |
| 894 | 902 |
| 895 int main(int argc, char** argv) { | 903 int main(int argc, char** argv) { |
| 896 return dart::bin::main(argc, argv); | 904 return dart::bin::main(argc, argv); |
| 897 } | 905 } |
| OLD | NEW |