| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 Dart_Handle VmService::LoadScript(const char* name) { | 187 Dart_Handle VmService::LoadScript(const char* name) { |
| 188 Dart_Handle url = Dart_NewStringFromCString("dart:vmservice_io"); | 188 Dart_Handle url = Dart_NewStringFromCString("dart:vmservice_io"); |
| 189 Dart_Handle source = GetSource(name); | 189 Dart_Handle source = GetSource(name); |
| 190 return Dart_LoadScript(url, source, 0, 0); | 190 return Dart_LoadScript(url, source, 0, 0); |
| 191 } | 191 } |
| 192 | 192 |
| 193 | 193 |
| 194 Dart_Handle VmService::LoadSource(Dart_Handle library, const char* name) { | 194 Dart_Handle VmService::LoadSource(Dart_Handle library, const char* name) { |
| 195 Dart_Handle url = Dart_NewStringFromCString(name); | 195 Dart_Handle url = Dart_NewStringFromCString(name); |
| 196 Dart_Handle source = GetSource(name); | 196 Dart_Handle source = GetSource(name); |
| 197 return Dart_LoadSource(library, url, source); | 197 return Dart_LoadSource(library, url, source, 0, 0); |
| 198 } | 198 } |
| 199 | 199 |
| 200 | 200 |
| 201 Dart_Handle VmService::LoadResource(Dart_Handle library, | 201 Dart_Handle VmService::LoadResource(Dart_Handle library, |
| 202 const char* resource_name, | 202 const char* resource_name, |
| 203 const char* prefix) { | 203 const char* prefix) { |
| 204 intptr_t prefix_len = strlen(prefix); | 204 intptr_t prefix_len = strlen(prefix); |
| 205 // Prepare for invoke call. | 205 // Prepare for invoke call. |
| 206 Dart_Handle name = Dart_NewStringFromCString(resource_name+prefix_len); | 206 Dart_Handle name = Dart_NewStringFromCString(resource_name+prefix_len); |
| 207 RETURN_ERROR_HANDLE(name); | 207 RETURN_ERROR_HANDLE(name); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 280 } |
| 281 ASSERT((tag == Dart_kSourceTag) || (tag == Dart_kCanonicalizeUrl)); | 281 ASSERT((tag == Dart_kSourceTag) || (tag == Dart_kCanonicalizeUrl)); |
| 282 if (tag == Dart_kCanonicalizeUrl) { | 282 if (tag == Dart_kCanonicalizeUrl) { |
| 283 // url is already canonicalized. | 283 // url is already canonicalized. |
| 284 return url; | 284 return url; |
| 285 } | 285 } |
| 286 Dart_Handle source = GetSource(url_string); | 286 Dart_Handle source = GetSource(url_string); |
| 287 if (Dart_IsError(source)) { | 287 if (Dart_IsError(source)) { |
| 288 return source; | 288 return source; |
| 289 } | 289 } |
| 290 return Dart_LoadSource(library, url, source); | 290 return Dart_LoadSource(library, url, source, 0, 0); |
| 291 } | 291 } |
| 292 | 292 |
| 293 | 293 |
| 294 void VmService::ThreadMain(uword parameters) { | 294 void VmService::ThreadMain(uword parameters) { |
| 295 ASSERT(Dart_CurrentIsolate() == NULL); | 295 ASSERT(Dart_CurrentIsolate() == NULL); |
| 296 Dart_Isolate service_isolate = Dart_GetServiceIsolate(NULL); | 296 Dart_Isolate service_isolate = Dart_GetServiceIsolate(NULL); |
| 297 Dart_EnterIsolate(service_isolate); | 297 Dart_EnterIsolate(service_isolate); |
| 298 Dart_EnterScope(); | 298 Dart_EnterScope(); |
| 299 Dart_Handle result = Dart_RunLoop(); | 299 Dart_Handle result = Dart_RunLoop(); |
| 300 if (Dart_IsError(result)) { | 300 if (Dart_IsError(result)) { |
| 301 printf("Service exited with an error:\n%s\n", Dart_GetError(result)); | 301 printf("Service exited with an error:\n%s\n", Dart_GetError(result)); |
| 302 } | 302 } |
| 303 Dart_ExitScope(); | 303 Dart_ExitScope(); |
| 304 Dart_ExitIsolate(); | 304 Dart_ExitIsolate(); |
| 305 } | 305 } |
| 306 | 306 |
| 307 | 307 |
| 308 | 308 |
| 309 } // namespace bin | 309 } // namespace bin |
| 310 } // namespace dart | 310 } // namespace dart |
| OLD | NEW |