| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 } | 384 } |
| 385 | 385 |
| 386 Dart_EnterScope(); | 386 Dart_EnterScope(); |
| 387 | 387 |
| 388 if (snapshot_buffer != NULL) { | 388 if (snapshot_buffer != NULL) { |
| 389 // Setup the native resolver as the snapshot does not carry it. | 389 // Setup the native resolver as the snapshot does not carry it. |
| 390 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); | 390 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); |
| 391 Builtin::SetNativeResolver(Builtin::kIOLibrary); | 391 Builtin::SetNativeResolver(Builtin::kIOLibrary); |
| 392 } | 392 } |
| 393 | 393 |
| 394 // Prepare builtin for use to resolve URIs. | 394 // Prepare builtin and its dependent libraries for use to resolve URIs. |
| 395 Dart_Handle uri_lib = Builtin::LoadLibrary(Builtin::kUriLibrary); |
| 395 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary); | 396 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary); |
| 396 Builtin::ImportLibrary(builtin_lib, Builtin::kUriLibrary); | 397 Dart_LibraryImportLibrary(builtin_lib, uri_lib); |
| 397 | 398 |
| 398 // Load the specified application script into the newly created isolate. | 399 // Load the specified application script into the newly created isolate. |
| 399 Dart_Handle library = LoadScript(builtin_lib, import_map_options); | 400 Dart_Handle library = LoadScript(builtin_lib, import_map_options); |
| 400 if (Dart_IsError(library)) { | 401 if (Dart_IsError(library)) { |
| 401 *error = strdup(Dart_GetError(library)); | 402 *error = strdup(Dart_GetError(library)); |
| 402 Dart_ExitScope(); | 403 Dart_ExitScope(); |
| 403 Dart_ShutdownIsolate(); | 404 Dart_ShutdownIsolate(); |
| 404 return false; | 405 return false; |
| 405 } | 406 } |
| 406 if (!Dart_IsLibrary(library)) { | 407 if (!Dart_IsLibrary(library)) { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 EventHandler::Terminate(); | 604 EventHandler::Terminate(); |
| 604 // Terminate process exit-code handler. | 605 // Terminate process exit-code handler. |
| 605 Process::TerminateExitCodeHandler(); | 606 Process::TerminateExitCodeHandler(); |
| 606 | 607 |
| 607 free(const_cast<char*>(original_script_name)); | 608 free(const_cast<char*>(original_script_name)); |
| 608 free(const_cast<char*>(original_working_directory)); | 609 free(const_cast<char*>(original_working_directory)); |
| 609 free(const_cast<char*>(original_script_url)); | 610 free(const_cast<char*>(original_script_url)); |
| 610 | 611 |
| 611 return 0; | 612 return 0; |
| 612 } | 613 } |
| OLD | NEW |