| 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 Dart_Isolate isolate = | 505 Dart_Isolate isolate = |
| 506 Dart_CreateIsolate(script_uri, main, snapshot_buffer, data, error); | 506 Dart_CreateIsolate(script_uri, main, snapshot_buffer, data, error); |
| 507 if (isolate == NULL) { | 507 if (isolate == NULL) { |
| 508 return false; | 508 return false; |
| 509 } | 509 } |
| 510 | 510 |
| 511 Dart_EnterScope(); | 511 Dart_EnterScope(); |
| 512 | 512 |
| 513 if (snapshot_buffer != NULL) { | 513 if (snapshot_buffer != NULL) { |
| 514 // Setup the native resolver as the snapshot does not carry it. | 514 // Setup the native resolver as the snapshot does not carry it. |
| 515 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); | 515 Builtin::SetupLibrary(Builtin::LoadLibrary(Builtin::kBuiltinLibrary), |
| 516 Builtin::SetNativeResolver(Builtin::kIOLibrary); | 516 Builtin::kBuiltinLibrary); |
| 517 Builtin::SetupLibrary(Builtin::LoadLibrary(Builtin::kIOLibrary), |
| 518 Builtin::kIOLibrary); |
| 517 } | 519 } |
| 518 | 520 |
| 519 // Set up the library tag handler for this isolate. | 521 // Set up the library tag handler for this isolate. |
| 520 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler); | 522 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler); |
| 521 if (Dart_IsError(result)) { | 523 if (Dart_IsError(result)) { |
| 522 *error = strdup(Dart_GetError(result)); | 524 *error = strdup(Dart_GetError(result)); |
| 523 Dart_ExitScope(); | 525 Dart_ExitScope(); |
| 524 Dart_ShutdownIsolate(); | 526 Dart_ShutdownIsolate(); |
| 525 return false; | 527 return false; |
| 526 } | 528 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 543 return false; | 545 return false; |
| 544 } | 546 } |
| 545 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary); | 547 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary); |
| 546 if (Dart_IsError(builtin_lib)) { | 548 if (Dart_IsError(builtin_lib)) { |
| 547 *error = strdup(Dart_GetError(builtin_lib)); | 549 *error = strdup(Dart_GetError(builtin_lib)); |
| 548 Dart_ExitScope(); | 550 Dart_ExitScope(); |
| 549 Dart_ShutdownIsolate(); | 551 Dart_ShutdownIsolate(); |
| 550 return false; | 552 return false; |
| 551 } | 553 } |
| 552 | 554 |
| 555 // Setup the IO library. |
| 556 Dart_Handle io_lib = Builtin::LoadLibrary(Builtin::kIOLibrary); |
| 557 Builtin::SetupIOLibrary(io_lib); |
| 558 |
| 553 if (package_root != NULL) { | 559 if (package_root != NULL) { |
| 554 const int kNumArgs = 1; | 560 const int kNumArgs = 1; |
| 555 Dart_Handle dart_args[kNumArgs]; | 561 Dart_Handle dart_args[kNumArgs]; |
| 556 | 562 |
| 557 Dart_Handle handle = Dart_NewString(package_root); | 563 Dart_Handle handle = Dart_NewString(package_root); |
| 558 if (Dart_IsError(handle)) { | 564 if (Dart_IsError(handle)) { |
| 559 *error = strdup(Dart_GetError(handle)); | 565 *error = strdup(Dart_GetError(handle)); |
| 560 Dart_ExitScope(); | 566 Dart_ExitScope(); |
| 561 Dart_ShutdownIsolate(); | 567 Dart_ShutdownIsolate(); |
| 562 return false; | 568 return false; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 DumpPprofSymbolInfo(); | 804 DumpPprofSymbolInfo(); |
| 799 // Shutdown the isolate. | 805 // Shutdown the isolate. |
| 800 Dart_ShutdownIsolate(); | 806 Dart_ShutdownIsolate(); |
| 801 // Terminate process exit-code handler. | 807 // Terminate process exit-code handler. |
| 802 Process::TerminateExitCodeHandler(); | 808 Process::TerminateExitCodeHandler(); |
| 803 | 809 |
| 804 free(const_cast<char*>(original_working_directory)); | 810 free(const_cast<char*>(original_working_directory)); |
| 805 | 811 |
| 806 return 0; | 812 return 0; |
| 807 } | 813 } |
| OLD | NEW |