Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: runtime/bin/dartutils.cc

Issue 23686021: Add property base to the Uri class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed more review comments Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/builtin.dart ('k') | runtime/lib/uri.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 return Dart_LoadLibrary(url, source); 652 return Dart_LoadLibrary(url, source);
653 } else if (tag == Dart_kSourceTag) { 653 } else if (tag == Dart_kSourceTag) {
654 return Dart_LoadSource(library, url, source); 654 return Dart_LoadSource(library, url, source);
655 } 655 }
656 return Dart_Error("wrong tag"); 656 return Dart_Error("wrong tag");
657 } 657 }
658 658
659 659
660 Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root, 660 Dart_Handle DartUtils::PrepareForScriptLoading(const char* package_root,
661 Dart_Handle builtin_lib) { 661 Dart_Handle builtin_lib) {
662 Dart_Handle corelib = Dart_LookupLibrary(NewString("dart:core"));
663 DART_CHECK_VALID(corelib);
664
662 // Setup the corelib 'print' function. 665 // Setup the corelib 'print' function.
663 Dart_Handle print = Dart_Invoke( 666 Dart_Handle print = Dart_Invoke(
664 builtin_lib, NewString("_getPrintClosure"), 0, NULL); 667 builtin_lib, NewString("_getPrintClosure"), 0, NULL);
665 Dart_Handle corelib = Dart_LookupLibrary(NewString("dart:core"));
666 Dart_Handle result = Dart_SetField(corelib, 668 Dart_Handle result = Dart_SetField(corelib,
667 NewString("_printClosure"), 669 NewString("_printClosure"),
668 print); 670 print);
671 DART_CHECK_VALID(result);
669 672
670 // Setup the 'timer' factory. 673 // Setup the 'timer' factory.
671 Dart_Handle url = NewString(kAsyncLibURL); 674 Dart_Handle url = NewString(kAsyncLibURL);
672 DART_CHECK_VALID(url); 675 DART_CHECK_VALID(url);
673 Dart_Handle async_lib = Dart_LookupLibrary(url); 676 Dart_Handle async_lib = Dart_LookupLibrary(url);
674 DART_CHECK_VALID(async_lib); 677 DART_CHECK_VALID(async_lib);
675 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); 678 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
676 Dart_Handle timer_closure = 679 Dart_Handle timer_closure =
677 Dart_Invoke(io_lib, NewString("_getTimerFactoryClosure"), 0, NULL); 680 Dart_Invoke(io_lib, NewString("_getTimerFactoryClosure"), 0, NULL);
678 Dart_Handle args[1]; 681 Dart_Handle args[1];
679 args[0] = timer_closure; 682 args[0] = timer_closure;
680 DART_CHECK_VALID(Dart_Invoke( 683 DART_CHECK_VALID(Dart_Invoke(
681 async_lib, NewString("_setTimerFactoryClosure"), 1, args)); 684 async_lib, NewString("_setTimerFactoryClosure"), 1, args));
682 685
686 // Setup the corelib 'Uri.base' getter.
687 Dart_Handle uri_base = Dart_Invoke(
688 builtin_lib, NewString("_getUriBaseClosure"), 0, NULL);
689 DART_CHECK_VALID(uri_base);
690 result = Dart_SetField(corelib,
691 NewString("_uriBaseClosure"),
692 uri_base);
693 DART_CHECK_VALID(result);
683 694
684 if (IsWindowsHost()) { 695 if (IsWindowsHost()) {
685 // Set running on Windows flag. 696 // Set running on Windows flag.
686 result = Dart_Invoke(builtin_lib, NewString("_setWindows"), 0, NULL); 697 result = Dart_Invoke(builtin_lib, NewString("_setWindows"), 0, NULL);
687 if (Dart_IsError(result)) { 698 if (Dart_IsError(result)) {
688 return result; 699 return result;
689 } 700 }
690 } 701 }
691 702
692 // Set current working directory. 703 // Set current working directory.
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 new CObjectString(CObject::NewString(os_error->message())); 1023 new CObjectString(CObject::NewString(os_error->message()));
1013 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1024 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1014 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1025 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1015 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1026 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1016 result->SetAt(2, error_message); 1027 result->SetAt(2, error_message);
1017 return result; 1028 return result;
1018 } 1029 }
1019 1030
1020 } // namespace bin 1031 } // namespace bin
1021 } // namespace dart 1032 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/builtin.dart ('k') | runtime/lib/uri.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698