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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 if (!Dart_IsLibrary(library)) { | 471 if (!Dart_IsLibrary(library)) { |
472 char errbuf[256]; | 472 char errbuf[256]; |
473 snprintf(errbuf, sizeof(errbuf), | 473 snprintf(errbuf, sizeof(errbuf), |
474 "Expected a library when loading script: %s", | 474 "Expected a library when loading script: %s", |
475 script_uri); | 475 script_uri); |
476 *error = strdup(errbuf); | 476 *error = strdup(errbuf); |
477 Dart_ExitScope(); | 477 Dart_ExitScope(); |
478 Dart_ShutdownIsolate(); | 478 Dart_ShutdownIsolate(); |
479 return false; | 479 return false; |
480 } | 480 } |
481 | |
482 // Make the isolate runnable so that it is ready to handle messages. | |
483 Dart_ExitIsolate(); | |
Ivan Posva
2013/04/05 15:51:59
If this method was changed to return the isolate i
siva
2013/04/05 17:43:29
Done.
| |
484 bool retval = Dart_MakeIsolateRunnable(isolate); | |
485 Dart_EnterIsolate(isolate); | |
486 if (!retval) { | |
487 *error = strdup("Invalid isolate state - Unable to make it runnable"); | |
488 Dart_ExitScope(); | |
489 Dart_ShutdownIsolate(); | |
490 return false; | |
491 } | |
492 | |
481 Dart_ExitScope(); | 493 Dart_ExitScope(); |
482 VmStats::AddIsolate(reinterpret_cast<IsolateData*>(data), isolate); | 494 VmStats::AddIsolate(reinterpret_cast<IsolateData*>(data), isolate); |
483 return true; | 495 return true; |
484 } | 496 } |
485 | 497 |
486 | 498 |
487 static bool CreateIsolateAndSetup(const char* script_uri, | 499 static bool CreateIsolateAndSetup(const char* script_uri, |
488 const char* main, | 500 const char* main, |
489 void* data, char** error) { | 501 void* data, char** error) { |
490 return CreateIsolateAndSetupHelper(script_uri, | 502 return CreateIsolateAndSetupHelper(script_uri, |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
831 Dart_ShutdownIsolate(); | 843 Dart_ShutdownIsolate(); |
832 // Terminate process exit-code handler. | 844 // Terminate process exit-code handler. |
833 Process::TerminateExitCodeHandler(); | 845 Process::TerminateExitCodeHandler(); |
834 // Free copied argument strings if converted. | 846 // Free copied argument strings if converted. |
835 if (argv_converted) { | 847 if (argv_converted) { |
836 for (int i = 0; i < argc; i++) free(argv[i]); | 848 for (int i = 0; i < argc; i++) free(argv[i]); |
837 } | 849 } |
838 | 850 |
839 return Process::GlobalExitCode(); | 851 return Process::GlobalExitCode(); |
840 } | 852 } |
OLD | NEW |