| 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 "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 | 6 |
| 7 #include "bin/extensions.h" | 7 #include "bin/extensions.h" |
| 8 #include "bin/directory.h" | 8 #include "bin/directory.h" |
| 9 #include "bin/file.h" | 9 #include "bin/file.h" |
| 10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 } | 391 } |
| 392 return Dart_Error("wrong tag"); | 392 return Dart_Error("wrong tag"); |
| 393 } | 393 } |
| 394 | 394 |
| 395 | 395 |
| 396 Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root, | 396 Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root, |
| 397 Dart_Handle builtin_lib) { | 397 Dart_Handle builtin_lib) { |
| 398 // Setup the corelib 'print' function. | 398 // Setup the corelib 'print' function. |
| 399 Dart_Handle print = | 399 Dart_Handle print = |
| 400 Dart_Invoke(builtin_lib, Dart_NewString("_getPrintClosure"), 0, 0); | 400 Dart_Invoke(builtin_lib, Dart_NewString("_getPrintClosure"), 0, 0); |
| 401 Dart_Handle coreimpl = Dart_LookupLibrary(Dart_NewString("dart:coreimpl")); | 401 Dart_Handle corelib = Dart_LookupLibrary(Dart_NewString("dart:core")); |
| 402 Dart_Handle print_impl = | 402 Dart_Handle result = Dart_SetField(corelib, |
| 403 Dart_GetClass(coreimpl, Dart_NewString("PrintImplementation")); | |
| 404 Dart_Handle result = Dart_SetField(print_impl, | |
| 405 Dart_NewString("_printClosure"), print); | 403 Dart_NewString("_printClosure"), print); |
| 406 | 404 |
| 407 // Setup the 'timer' factory. | 405 // Setup the 'timer' factory. |
| 408 Dart_Handle url = Dart_NewString(kIsolateLibURL); | 406 Dart_Handle url = Dart_NewString(kIsolateLibURL); |
| 409 DART_CHECK_VALID(url); | 407 DART_CHECK_VALID(url); |
| 410 Dart_Handle isolate_lib = Dart_LookupLibrary(url); | 408 Dart_Handle isolate_lib = Dart_LookupLibrary(url); |
| 411 DART_CHECK_VALID(isolate_lib); | 409 DART_CHECK_VALID(isolate_lib); |
| 412 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); | 410 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); |
| 413 Dart_Handle timer_closure = | 411 Dart_Handle timer_closure = |
| 414 Dart_Invoke(io_lib, Dart_NewString("_getTimerFactoryClosure"), 0, NULL); | 412 Dart_Invoke(io_lib, Dart_NewString("_getTimerFactoryClosure"), 0, NULL); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 | 660 |
| 663 CObject* CObject::NewOSError(OSError* os_error) { | 661 CObject* CObject::NewOSError(OSError* os_error) { |
| 664 CObject* error_message = | 662 CObject* error_message = |
| 665 new CObjectString(CObject::NewString(os_error->message())); | 663 new CObjectString(CObject::NewString(os_error->message())); |
| 666 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 664 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 667 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 665 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 668 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 666 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 669 result->SetAt(2, error_message); | 667 result->SetAt(2, error_message); |
| 670 return result; | 668 return result; |
| 671 } | 669 } |
| OLD | NEW |