OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "bin/vmservice_impl.h" | 5 #include "bin/vmservice_impl.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 bool VmService::Setup(const char* server_ip, | 176 bool VmService::Setup(const char* server_ip, |
177 intptr_t server_port, | 177 intptr_t server_port, |
178 bool running_precompiled) { | 178 bool running_precompiled) { |
179 Dart_Isolate isolate = Dart_CurrentIsolate(); | 179 Dart_Isolate isolate = Dart_CurrentIsolate(); |
180 ASSERT(isolate != NULL); | 180 ASSERT(isolate != NULL); |
181 SetServerIPAndPort("", 0); | 181 SetServerIPAndPort("", 0); |
182 | 182 |
183 Dart_Handle result; | 183 Dart_Handle result; |
184 | 184 |
185 Dart_Handle builtin_lib = | 185 // Prepare builtin and its dependent libraries for use to resolve URIs. |
186 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); | 186 // Set up various closures, e.g: printing, timers etc. |
187 SHUTDOWN_ON_ERROR(builtin_lib); | 187 // Set up 'package root' for URI resolution. |
188 | 188 result = DartUtils::PrepareForScriptLoading(true, false); |
189 // Prepare for script loading by setting up the 'print' and 'timer' | |
190 // closures and setting up 'package root' for URI resolution. | |
191 result = DartUtils::PrepareForScriptLoading( | |
192 NULL, NULL, true, false, builtin_lib); | |
193 SHUTDOWN_ON_ERROR(result); | 189 SHUTDOWN_ON_ERROR(result); |
194 | 190 |
195 if (running_precompiled) { | 191 if (running_precompiled) { |
196 Dart_Handle url = DartUtils::NewString(kVMServiceIOLibraryUri); | 192 Dart_Handle url = DartUtils::NewString(kVMServiceIOLibraryUri); |
197 Dart_Handle library = Dart_LookupLibrary(url); | 193 Dart_Handle library = Dart_LookupLibrary(url); |
198 SHUTDOWN_ON_ERROR(library); | 194 SHUTDOWN_ON_ERROR(library); |
199 result = Dart_SetRootLibrary(library); | 195 result = Dart_SetRootLibrary(library); |
200 SHUTDOWN_ON_ERROR(library); | 196 SHUTDOWN_ON_ERROR(library); |
201 result = Dart_SetNativeResolver(library, VmServiceIONativeResolver, NULL); | 197 result = Dart_SetNativeResolver(library, VmServiceIONativeResolver, NULL); |
202 SHUTDOWN_ON_ERROR(result); | 198 SHUTDOWN_ON_ERROR(result); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 Dart_Handle source = GetSource(url_string); | 352 Dart_Handle source = GetSource(url_string); |
357 if (Dart_IsError(source)) { | 353 if (Dart_IsError(source)) { |
358 return source; | 354 return source; |
359 } | 355 } |
360 return Dart_LoadSource(library, url, source, 0, 0); | 356 return Dart_LoadSource(library, url, source, 0, 0); |
361 } | 357 } |
362 | 358 |
363 | 359 |
364 } // namespace bin | 360 } // namespace bin |
365 } // namespace dart | 361 } // namespace dart |
OLD | NEW |