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 result = Dart_MakeIsolateRunnable(); |
| 484 CHECK_RESULT(result); |
| 485 |
481 Dart_ExitScope(); | 486 Dart_ExitScope(); |
482 VmStats::AddIsolate(reinterpret_cast<IsolateData*>(data), isolate); | 487 VmStats::AddIsolate(reinterpret_cast<IsolateData*>(data), isolate); |
483 return true; | 488 return true; |
484 } | 489 } |
485 | 490 |
486 | 491 |
487 static bool CreateIsolateAndSetup(const char* script_uri, | 492 static bool CreateIsolateAndSetup(const char* script_uri, |
488 const char* main, | 493 const char* main, |
489 void* data, char** error) { | 494 void* data, char** error) { |
490 return CreateIsolateAndSetupHelper(script_uri, | 495 return CreateIsolateAndSetupHelper(script_uri, |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 Dart_ShutdownIsolate(); | 836 Dart_ShutdownIsolate(); |
832 // Terminate process exit-code handler. | 837 // Terminate process exit-code handler. |
833 Process::TerminateExitCodeHandler(); | 838 Process::TerminateExitCodeHandler(); |
834 // Free copied argument strings if converted. | 839 // Free copied argument strings if converted. |
835 if (argv_converted) { | 840 if (argv_converted) { |
836 for (int i = 0; i < argc; i++) free(argv[i]); | 841 for (int i = 0; i < argc; i++) free(argv[i]); |
837 } | 842 } |
838 | 843 |
839 return Process::GlobalExitCode(); | 844 return Process::GlobalExitCode(); |
840 } | 845 } |
OLD | NEW |