| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 } | 568 } |
| 569 | 569 |
| 570 Dart_EnterScope(); | 570 Dart_EnterScope(); |
| 571 | 571 |
| 572 if (snapshot_buffer != NULL) { | 572 if (snapshot_buffer != NULL) { |
| 573 // Setup the native resolver as the snapshot does not carry it. | 573 // Setup the native resolver as the snapshot does not carry it. |
| 574 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); | 574 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); |
| 575 Builtin::SetNativeResolver(Builtin::kIOLibrary); | 575 Builtin::SetNativeResolver(Builtin::kIOLibrary); |
| 576 } | 576 } |
| 577 | 577 |
| 578 // Set up the library tag handler for this isolate. |
| 579 Dart_Handle result = Dart_SetLibraryTagHandler(DartUtils::LibraryTagHandler); |
| 580 CHECK_RESULT(result); |
| 581 |
| 578 if (Dart_IsServiceIsolate(isolate)) { | 582 if (Dart_IsServiceIsolate(isolate)) { |
| 579 // If this is the service isolate, load embedder specific bits and return. | 583 // If this is the service isolate, load embedder specific bits and return. |
| 580 if (!VmService::Setup(vm_service_server_ip, vm_service_server_port)) { | 584 if (!VmService::Setup(vm_service_server_ip, vm_service_server_port)) { |
| 581 *error = strdup(VmService::GetErrorMessage()); | 585 *error = strdup(VmService::GetErrorMessage()); |
| 582 return NULL; | 586 return NULL; |
| 583 } | 587 } |
| 584 Dart_ExitScope(); | 588 Dart_ExitScope(); |
| 585 Dart_ExitIsolate(); | 589 Dart_ExitIsolate(); |
| 586 return isolate; | 590 return isolate; |
| 587 } | 591 } |
| 588 | 592 |
| 589 // Load the specified application script into the newly created isolate. | 593 // Load the specified application script into the newly created isolate. |
| 590 | 594 |
| 591 // Set up the library tag handler for this isolate. | |
| 592 Dart_Handle result = Dart_SetLibraryTagHandler(DartUtils::LibraryTagHandler); | |
| 593 CHECK_RESULT(result); | |
| 594 | |
| 595 // Prepare builtin and its dependent libraries for use to resolve URIs. | 595 // Prepare builtin and its dependent libraries for use to resolve URIs. |
| 596 // The builtin library is part of the core snapshot and would already be | 596 // The builtin library is part of the core snapshot and would already be |
| 597 // available here in the case of script snapshot loading. | 597 // available here in the case of script snapshot loading. |
| 598 Dart_Handle builtin_lib = | 598 Dart_Handle builtin_lib = |
| 599 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); | 599 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); |
| 600 CHECK_RESULT(builtin_lib); | 600 CHECK_RESULT(builtin_lib); |
| 601 | 601 |
| 602 // Prepare for script loading by setting up the 'print' and 'timer' | 602 // Prepare for script loading by setting up the 'print' and 'timer' |
| 603 // closures and setting up 'package root' for URI resolution. | 603 // closures and setting up 'package root' for URI resolution. |
| 604 result = DartUtils::PrepareForScriptLoading(package_root, false, builtin_lib); | 604 result = DartUtils::PrepareForScriptLoading(package_root, false, builtin_lib); |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 exit(Process::GlobalExitCode()); | 1117 exit(Process::GlobalExitCode()); |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 } // namespace bin | 1120 } // namespace bin |
| 1121 } // namespace dart | 1121 } // namespace dart |
| 1122 | 1122 |
| 1123 int main(int argc, char** argv) { | 1123 int main(int argc, char** argv) { |
| 1124 dart::bin::main(argc, argv); | 1124 dart::bin::main(argc, argv); |
| 1125 UNREACHABLE(); | 1125 UNREACHABLE(); |
| 1126 } | 1126 } |
| OLD | NEW |