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

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

Issue 11318018: - Represent strings internally in UTF-16 format, this makes it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
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 <stdio.h> 5 #include <stdio.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 15 matching lines...) Expand all
26 kInvalidLibrary); 26 kInvalidLibrary);
27 return Dart_NewApiError("Unreachable code in Builtin::Source (%d).", id); 27 return Dart_NewApiError("Unreachable code in Builtin::Source (%d).", id);
28 } 28 }
29 29
30 30
31 void Builtin::SetNativeResolver(BuiltinLibraryId id) { 31 void Builtin::SetNativeResolver(BuiltinLibraryId id) {
32 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == 32 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) ==
33 kInvalidLibrary); 33 kInvalidLibrary);
34 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); 34 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary);
35 if (builtin_libraries_[id].has_natives_) { 35 if (builtin_libraries_[id].has_natives_) {
36 Dart_Handle url = Dart_NewString(builtin_libraries_[id].url_); 36 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
37 Dart_Handle library = Dart_LookupLibrary(url); 37 Dart_Handle library = Dart_LookupLibrary(url);
38 ASSERT(!Dart_IsError(library)); 38 ASSERT(!Dart_IsError(library));
39 // Setup the native resolver for built in library functions. 39 // Setup the native resolver for built in library functions.
40 DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup)); 40 DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup));
41 } 41 }
42 } 42 }
43 43
44 44
45 Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) { 45 Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) {
46 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) == 46 ASSERT((sizeof(builtin_libraries_) / sizeof(builtin_lib_props)) ==
47 kInvalidLibrary); 47 kInvalidLibrary);
48 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary); 48 ASSERT(id >= kBuiltinLibrary && id < kInvalidLibrary);
49 Dart_Handle url = Dart_NewString(builtin_libraries_[id].url_); 49 Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
50 Dart_Handle library = Dart_LookupLibrary(url); 50 Dart_Handle library = Dart_LookupLibrary(url);
51 if (Dart_IsError(library)) { 51 if (Dart_IsError(library)) {
52 ASSERT(id > kUtfLibrary); 52 ASSERT(id > kUtfLibrary);
53 library = Dart_LoadLibrary(url, Source(id)); 53 library = Dart_LoadLibrary(url, Source(id));
54 if (!Dart_IsError(library) && (builtin_libraries_[id].has_natives_)) { 54 if (!Dart_IsError(library) && (builtin_libraries_[id].has_natives_)) {
55 // Setup the native resolver for built in library functions. 55 // Setup the native resolver for built in library functions.
56 DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup)); 56 DART_CHECK_VALID(Dart_SetNativeResolver(library, NativeLookup));
57 } 57 }
58 } 58 }
59 DART_CHECK_VALID(library); 59 DART_CHECK_VALID(library);
60 return library; 60 return library;
61 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698