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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 145 } |
146 } | 146 } |
147 return NULL; | 147 return NULL; |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 const char* VmService::error_msg_ = NULL; | 151 const char* VmService::error_msg_ = NULL; |
152 char VmService::server_uri_[kServerUriStringBufferSize]; | 152 char VmService::server_uri_[kServerUriStringBufferSize]; |
153 | 153 |
154 | 154 |
155 bool VmService::LoadForGenPrecompiled() { | 155 bool VmService::LoadForGenPrecompiled(void* vmservice_kernel) { |
156 Dart_Handle result; | 156 Dart_Handle result; |
157 Dart_SetLibraryTagHandler(LibraryTagHandler); | 157 Dart_SetLibraryTagHandler(LibraryTagHandler); |
158 Dart_Handle library = | 158 Dart_Handle library; |
159 LookupOrLoadLibrary(kVMServiceIOLibraryScriptResourceName); | 159 if (vmservice_kernel != NULL) { |
| 160 library = Dart_LoadLibrary( |
| 161 Dart_NewStringFromCString(kVMServiceIOLibraryUri), Dart_Null(), |
| 162 reinterpret_cast<Dart_Handle>(vmservice_kernel), 0, 0); |
| 163 } else { |
| 164 library = LookupOrLoadLibrary(kVMServiceIOLibraryScriptResourceName); |
| 165 } |
160 ASSERT(library != Dart_Null()); | 166 ASSERT(library != Dart_Null()); |
161 SHUTDOWN_ON_ERROR(library); | 167 SHUTDOWN_ON_ERROR(library); |
162 result = Dart_SetNativeResolver(library, VmServiceIONativeResolver, NULL); | 168 result = Dart_SetNativeResolver(library, VmServiceIONativeResolver, NULL); |
163 SHUTDOWN_ON_ERROR(result); | 169 SHUTDOWN_ON_ERROR(result); |
164 result = Dart_FinalizeLoading(false); | 170 result = Dart_FinalizeLoading(false); |
165 SHUTDOWN_ON_ERROR(result); | 171 SHUTDOWN_ON_ERROR(result); |
166 return true; | 172 return true; |
167 } | 173 } |
168 | 174 |
169 | 175 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 Dart_Handle source = GetSource(url_string); | 378 Dart_Handle source = GetSource(url_string); |
373 if (Dart_IsError(source)) { | 379 if (Dart_IsError(source)) { |
374 return source; | 380 return source; |
375 } | 381 } |
376 return Dart_LoadSource(library, url, Dart_Null(), source, 0, 0); | 382 return Dart_LoadSource(library, url, Dart_Null(), source, 0, 0); |
377 } | 383 } |
378 | 384 |
379 | 385 |
380 } // namespace bin | 386 } // namespace bin |
381 } // namespace dart | 387 } // namespace dart |
OLD | NEW |